Fix board list toggle keybind not working where there are no toggle button.

This commit is contained in:
Nicolas Stepien 2013-03-14 21:29:56 +01:00
parent 1692b5de3b
commit 9682fbd149
2 changed files with 17 additions and 13 deletions

View File

@ -1123,11 +1123,13 @@
return $.add(list, nodes);
},
toggleBoardList: function() {
var bar, showBoardList;
showBoardList = $.hasClass(this, 'show-board-list-button');
var bar, custom, full, showBoardList;
bar = Header.bar;
$('#custom-board-list', bar).hidden = showBoardList;
return $('#full-board-list', bar).hidden = !showBoardList;
custom = $('#custom-board-list', bar);
full = $('#full-board-list', bar);
showBoardList = !full.hidden;
custom.hidden = !showBoardList;
return full.hidden = showBoardList;
},
setCatalogLinks: function(useCatalog) {
var a, as, str, _i, _len;
@ -2887,7 +2889,7 @@
});
},
keydown: function(e) {
var el, form, key, notification, notifications, target, thread, threadRoot, _i, _len, _ref;
var form, key, notification, notifications, target, thread, threadRoot, _i, _len, _ref;
if (!(key = Keybinds.keyCode(e))) {
return;
}
@ -2901,8 +2903,8 @@
thread = Get.postFromNode($('.op', threadRoot)).thread;
switch (key) {
case Conf['Toggle board list']:
if (Conf['Custom Board Navigation'] && (el = $('span:not([hidden]) > .show-board-list-button, span:not([hidden]) > .hide-board-list-button', Header.bar))) {
Header.toggleBoardList.call(el);
if (Conf['Custom Board Navigation']) {
Header.toggleBoardList();
}
break;
case Conf['Open empty QR']:

View File

@ -95,10 +95,12 @@ Header =
$.add list, nodes
toggleBoardList: ->
showBoardList = $.hasClass @, 'show-board-list-button'
{bar} = Header
$('#custom-board-list', bar).hidden = showBoardList
$('#full-board-list', bar).hidden = !showBoardList
{bar} = Header
custom = $ '#custom-board-list', bar
full = $ '#full-board-list', bar
showBoardList = !full.hidden
custom.hidden = !showBoardList
full.hidden = showBoardList
setCatalogLinks: (useCatalog) ->
as = $$ '#board-list a[href*="boards.4chan.org"]', Header.bar
@ -1624,8 +1626,8 @@ Keybinds =
switch key
# QR & Options
when Conf['Toggle board list']
if Conf['Custom Board Navigation'] and el = $ 'span:not([hidden]) > .show-board-list-button, span:not([hidden]) > .hide-board-list-button', Header.bar
Header.toggleBoardList.call el
if Conf['Custom Board Navigation']
Header.toggleBoardList()
when Conf['Open empty QR']
Keybinds.qr threadRoot
when Conf['Open QR']