From 9527da25736f851dc32619e2a598736676cff065 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Mar 2013 20:32:58 +0100 Subject: [PATCH] Add a keybind to toggle the board list. #932 --- 4chan_x.user.js | 14 ++++++++++---- src/config.coffee | 5 +++-- src/features.coffee | 7 +++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index bb31838eb..cdf750c52 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -150,6 +150,7 @@ favicon: 'ferongr', usercss: '', hotkeys: { + 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'], 'Open empty QR': ['q', 'Open QR without post number inserted.'], 'Open QR': ['Shift+q', 'Open QR with post number inserted.'], 'Open settings': ['Alt+o', 'Open Settings.'], @@ -160,7 +161,7 @@ 'Math tags': ['Alt+m', 'Insert math tags.'], 'Submit QR': ['Alt+s', 'Submit post.'], 'Watch': ['w', 'Watch thread.'], - 'Update': ['r', 'Update the thread now.'], + 'Update': ['r', 'Update the thread.'], 'Expand image': ['Shift+e', 'Expand selected image.'], 'Expand images': ['e', 'Expand all images.'], 'Front page': ['0', 'Jump to page 0.'], @@ -2881,7 +2882,7 @@ }); }, keydown: function(e) { - var form, key, notification, notifications, target, thread, threadRoot, _i, _len, _ref; + var el, form, key, notification, notifications, target, thread, threadRoot, _i, _len, _ref; if (!(key = Keybinds.keyCode(e))) { return; } @@ -2894,6 +2895,11 @@ threadRoot = Nav.getThread(); 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); + } + break; case Conf['Open empty QR']: Keybinds.qr(threadRoot); break; @@ -5490,7 +5496,7 @@ html += "
"; } checked = Conf['Auto Update'] ? 'checked' : ''; - html = "
\n" + html + "\n
\n
\n
"; + html = "
\n" + html + "\n
\n
\n
"; this.dialog = UI.dialog('updater', 'bottom: 0; right: 0;', html); this.timer = $('#update-timer', this.dialog); this.status = $('#update-status', this.dialog); @@ -5525,7 +5531,7 @@ $.on(input, 'change', ThreadUpdater.cb.interval); ThreadUpdater.cb.interval.call(input); break; - case 'Update Now': + case 'Update': $.on(input, 'click', ThreadUpdater.update); } } diff --git a/src/config.coffee b/src/config.coffee index 73bff664e..9ca1bde9a 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -137,7 +137,8 @@ Config = favicon: 'ferongr' usercss: '' hotkeys: - # QR & Options + # Header, QR & Options + 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'] 'Open empty QR': ['q', 'Open QR without post number inserted.'] 'Open QR': ['Shift+q', 'Open QR with post number inserted.'] 'Open settings': ['Alt+o', 'Open Settings.'] @@ -149,7 +150,7 @@ Config = 'Submit QR': ['Alt+s', 'Submit post.'] # Thread related 'Watch': ['w', 'Watch thread.'] - 'Update': ['r', 'Update the thread now.'] + 'Update': ['r', 'Update the thread.'] # Images 'Expand image': ['Shift+e', 'Expand selected image.'] 'Expand images': ['e', 'Expand all images.'] diff --git a/src/features.coffee b/src/features.coffee index 5556442e7..a8a9a80ed 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -1619,6 +1619,9 @@ Keybinds = thread = Get.postFromNode($('.op', threadRoot)).thread 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 when Conf['Open empty QR'] Keybinds.qr threadRoot when Conf['Open QR'] @@ -3727,7 +3730,7 @@ ThreadUpdater = #{html}
-
+
""" @dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html @@ -3758,7 +3761,7 @@ ThreadUpdater = when 'Interval' $.on input, 'change', ThreadUpdater.cb.interval ThreadUpdater.cb.interval.call input - when 'Update Now' + when 'Update' $.on input, 'click', ThreadUpdater.update $.on window, 'online offline', ThreadUpdater.cb.online