Add the CloseMenu event/API.
This commit is contained in:
parent
4f28b6d2e5
commit
2d677acad4
@ -261,6 +261,7 @@
|
|||||||
}
|
}
|
||||||
this.focus($('.entry', menu));
|
this.focus($('.entry', menu));
|
||||||
$.on(d, 'click', this.close);
|
$.on(d, 'click', this.close);
|
||||||
|
$.on(d, 'CloseMenu', this.close);
|
||||||
$.add(d.body, menu);
|
$.add(d.body, menu);
|
||||||
mRect = menu.getBoundingClientRect();
|
mRect = menu.getBoundingClientRect();
|
||||||
bRect = button.getBoundingClientRect();
|
bRect = button.getBoundingClientRect();
|
||||||
@ -305,7 +306,8 @@
|
|||||||
$.rm(currentMenu);
|
$.rm(currentMenu);
|
||||||
currentMenu = null;
|
currentMenu = null;
|
||||||
lastToggledButton = null;
|
lastToggledButton = null;
|
||||||
return $.off(d, 'click', this.close);
|
$.off(d, 'click', this.close);
|
||||||
|
return $.off(d, 'CloseMenu', this.close);
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype.keybinds = function(e) {
|
Menu.prototype.keybinds = function(e) {
|
||||||
@ -1060,7 +1062,7 @@
|
|||||||
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
||||||
},
|
},
|
||||||
open: function() {
|
open: function() {
|
||||||
return Header.menu.close();
|
return $.event('CloseMenu');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1459,7 +1461,7 @@
|
|||||||
thread = ThreadHiding.menu.thread;
|
thread = ThreadHiding.menu.thread;
|
||||||
ThreadHiding.hide(thread, makeStub);
|
ThreadHiding.hide(thread, makeStub);
|
||||||
ThreadHiding.saveHiddenState(thread, makeStub);
|
ThreadHiding.saveHiddenState(thread, makeStub);
|
||||||
return Menu.close();
|
return $.event('CloseMenu');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
makeButton: function(thread, type) {
|
makeButton: function(thread, type) {
|
||||||
@ -1680,7 +1682,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ReplyHiding.saveHiddenState(post, true, thisPost, makeStub, replies);
|
ReplyHiding.saveHiddenState(post, true, thisPost, makeStub, replies);
|
||||||
return Menu.close();
|
return $.event('CloseMenu');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
makeButton: function(post, type) {
|
makeButton: function(post, type) {
|
||||||
@ -3809,7 +3811,7 @@
|
|||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(link, 'click', function() {
|
$.on(link, 'click', function() {
|
||||||
Header.menu.close();
|
$.event('CloseMenu');
|
||||||
QR.open();
|
QR.open();
|
||||||
if (g.BOARD.ID === 'f') {
|
if (g.BOARD.ID === 'f') {
|
||||||
if (g.VIEW === 'index') {
|
if (g.VIEW === 'index') {
|
||||||
|
|||||||
@ -53,7 +53,8 @@ UI = (->
|
|||||||
@insertEntry entry, menu, data
|
@insertEntry entry, menu, data
|
||||||
|
|
||||||
@focus $ '.entry', menu
|
@focus $ '.entry', menu
|
||||||
$.on d, 'click', @close
|
$.on d, 'click', @close
|
||||||
|
$.on d, 'CloseMenu', @close
|
||||||
$.add d.body, menu
|
$.add d.body, menu
|
||||||
|
|
||||||
# Position
|
# Position
|
||||||
@ -99,7 +100,8 @@ UI = (->
|
|||||||
$.rm currentMenu
|
$.rm currentMenu
|
||||||
currentMenu = null
|
currentMenu = null
|
||||||
lastToggledButton = null
|
lastToggledButton = null
|
||||||
$.off d, 'click', @close
|
$.off d, 'click', @close
|
||||||
|
$.off d, 'CloseMenu', @close
|
||||||
|
|
||||||
keybinds: (e) ->
|
keybinds: (e) ->
|
||||||
entry = $ '.focused', currentMenu
|
entry = $ '.focused', currentMenu
|
||||||
|
|||||||
@ -128,7 +128,7 @@ Settings =
|
|||||||
settings.disableAll = true
|
settings.disableAll = true
|
||||||
localStorage.setItem '4chan-settings', JSON.stringify settings
|
localStorage.setItem '4chan-settings', JSON.stringify settings
|
||||||
open: ->
|
open: ->
|
||||||
Header.menu.close()
|
$.event 'CloseMenu'
|
||||||
# Here be settings
|
# Here be settings
|
||||||
|
|
||||||
Filter =
|
Filter =
|
||||||
@ -500,7 +500,7 @@ ThreadHiding =
|
|||||||
{thread} = ThreadHiding.menu
|
{thread} = ThreadHiding.menu
|
||||||
ThreadHiding.hide thread, makeStub
|
ThreadHiding.hide thread, makeStub
|
||||||
ThreadHiding.saveHiddenState thread, makeStub
|
ThreadHiding.saveHiddenState thread, makeStub
|
||||||
Menu.close()
|
$.event 'CloseMenu'
|
||||||
|
|
||||||
makeButton: (thread, type) ->
|
makeButton: (thread, type) ->
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
@ -661,7 +661,7 @@ ReplyHiding =
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
ReplyHiding.saveHiddenState post, true, thisPost, makeStub, replies
|
ReplyHiding.saveHiddenState post, true, thisPost, makeStub, replies
|
||||||
Menu.close()
|
$.event 'CloseMenu'
|
||||||
|
|
||||||
makeButton: (post, type) ->
|
makeButton: (post, type) ->
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
|
|||||||
@ -10,7 +10,7 @@ QR =
|
|||||||
textContent: 'Quick Reply'
|
textContent: 'Quick Reply'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on link, 'click', ->
|
$.on link, 'click', ->
|
||||||
Header.menu.close()
|
$.event 'CloseMenu'
|
||||||
QR.open()
|
QR.open()
|
||||||
if g.BOARD.ID is 'f'
|
if g.BOARD.ID is 'f'
|
||||||
if g.VIEW is 'index'
|
if g.VIEW is 'index'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user