Add active class to .menu-button if open

Close #106
This commit is contained in:
Jordan Bates 2013-06-15 07:57:32 -07:00
parent c1dfa9ecf6
commit 96e5f3139b
5 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.15 - 2013-06-14
* 4chan X - Version 1.2.15 - 2013-06-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.15 - 2013-06-14
* 4chan X - Version 1.2.15 - 2013-06-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -2327,6 +2327,7 @@
entry = _ref[_i];
this.insertEntry(entry, menu, data);
}
$.addClass(lastToggledButton, 'active');
$.on(d, 'click', this.close);
$.on(d, 'CloseMenu', this.close);
$.add(Header.hover, menu);
@ -2379,6 +2380,7 @@
close = function() {
$.rm(currentMenu);
$.rmClass(lastToggledButton, 'active');
currentMenu = null;
lastToggledButton = null;
return $.off(d, 'click CloseMenu', this.close);

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.15 - 2013-06-14
* 4chan X - Version 1.2.15 - 2013-06-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -2323,6 +2323,7 @@
entry = _ref[_i];
this.insertEntry(entry, menu, data);
}
$.addClass(lastToggledButton, 'active');
$.on(d, 'click', this.close);
$.on(d, 'CloseMenu', this.close);
$.add(Header.hover, menu);
@ -2375,6 +2376,7 @@
close = function() {
$.rm(currentMenu);
$.rmClass(lastToggledButton, 'active');
currentMenu = null;
lastToggledButton = null;
return $.off(d, 'click CloseMenu', this.close);

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.15 - 2013-06-14
* 4chan X - Version 1.2.15 - 2013-06-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -2329,6 +2329,7 @@
entry = _ref[_i];
this.insertEntry(entry, menu, data);
}
$.addClass(lastToggledButton, 'active');
$.on(d, 'click', this.close);
$.on(d, 'CloseMenu', this.close);
$.add(Header.hover, menu);
@ -2381,6 +2382,7 @@
close = function() {
$.rm(currentMenu);
$.rmClass(lastToggledButton, 'active');
currentMenu = null;
lastToggledButton = null;
return $.off(d, 'click CloseMenu', this.close);

View File

@ -61,6 +61,8 @@ UI = do ->
for entry in @entries
@insertEntry entry, menu, data
$.addClass lastToggledButton, 'active'
$.on d, 'click', @close
$.on d, 'CloseMenu', @close
$.add Header.hover, menu
@ -114,6 +116,7 @@ UI = do ->
close = ->
$.rm currentMenu
$.rmClass lastToggledButton, 'active'
currentMenu = null
lastToggledButton = null
$.off d, 'click CloseMenu', @close