Toggle through alignment options (Fix #56)
Change-Id: Ife23578c74ea75d4748b4e779d0aa870e6b34776
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index bee0409..a572180 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -65,9 +65,22 @@
* Toggle the alignment (left <=> right)
*/
this.actions.add(loc.TOGGLE_ALIGN, ['align','right','button-icon'], function (e) {
- var ol = d.querySelector('#search > ol');
- ol.toggleClass("align-left", "align-right");
- this.button.toggleClass("left", "right");
+ var olCl = d.querySelector('#search > ol').classList;
+ if (olCl.contains('align-left')) {
+ olCl.remove('align-left');
+ olCl.add('align-right');
+ this.button.toggleClass("right", "center");
+ }
+ else if (olCl.contains('align-right')) {
+ olCl.remove('align-right');
+ olCl.add('align-center');
+ this.button.toggleClass("center", "left");
+ }
+ else if (olCl.contains('align-center')) {
+ olCl.remove('align-center');
+ olCl.add('align-left');
+ this.button.toggleClass("left", "right");
+ };
});
}
}