Add a keybind to toggle the board list. #932

This commit is contained in:
Nicolas Stepien 2013-03-13 20:32:58 +01:00
parent 2860471bd6
commit 9527da2573
3 changed files with 18 additions and 8 deletions

View File

@ -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 += "<div><label title='" + conf[1] + "'><input name='" + name + "' type=checkbox " + checked + "> " + name + "</label></div>";
}
checked = Conf['Auto Update'] ? 'checked' : '';
html = "<div class=move><span id=update-status></span> <span id=update-timer></span></div>\n" + html + "\n<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' " + checked + "> Auto Update This</label></div>\n<div><label><input type=number name=Interval class=field min=5 value=" + Conf['Interval'] + "> Refresh rate (s)</label></div>\n<div><input value='Update Now' type=button name='Update Now'></div>";
html = "<div class=move><span id=update-status></span> <span id=update-timer></span></div>\n" + html + "\n<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' " + checked + "> Auto Update This</label></div>\n<div><label><input type=number name=Interval class=field min=5 value=" + Conf['Interval'] + "> Refresh rate (s)</label></div>\n<div><input value='Update' type=button name='Update'></div>";
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);
}
}

View File

@ -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.']

View File

@ -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}
<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' #{checked}> Auto Update This</label></div>
<div><label><input type=number name=Interval class=field min=5 value=#{Conf['Interval']}> Refresh rate (s)</label></div>
<div><input value='Update Now' type=button name='Update Now'></div>
<div><input value='Update' type=button name='Update'></div>
"""
@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