diff --git a/4chan_x.user.js b/4chan_x.user.js
index f6f9e3856..37abc457b 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -715,32 +715,32 @@
};
keybinds = {
init: function() {
- var key, node, _i, _len, _ref;
+ var node, _i, _len, _ref;
_ref = $$('[accesskey]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
node.removeAttribute('accesskey');
}
- keybinds.close = (key = $.getValue('key/close', 0)).length >= 0 ? key : 'Esc';
- keybinds.spoiler = (key = $.getValue('key/spoiler', 0)).length >= 0 ? key : 'ctrl+s';
- keybinds.openQR = (key = $.getValue('key/openQR', 0)).length >= 0 ? key : 'i';
- keybinds.openEmptyQR = (key = $.getValue('key/openEmptyQR', 0)).length >= 0 ? key : 'I';
- keybinds.submit = (key = $.getValue('key/submit', 0)).length >= 0 ? key : 'alt+s';
- keybinds.nextReply = (key = $.getValue('key/nextReply', 0)).length >= 0 ? key : 'J';
- keybinds.previousReply = (key = $.getValue('key/previousReply', 0)).length >= 0 ? key : 'K';
- keybinds.nextThread = (key = $.getValue('key/nextThread', 0)).length >= 0 ? key : 'n';
- keybinds.previousThread = (key = $.getValue('key/previousThread', 0)).length >= 0 ? key : 'p';
- keybinds.nextPage = (key = $.getValue('key/nextPage', 0)).length >= 0 ? key : 'alt+x';
- keybinds.previousPage = (key = $.getValue('key/previousPage', 0)).length >= 0 ? key : 'alt+z';
- keybinds.zero = (key = $.getValue('key/zero', 0)).length >= 0 ? key : '0';
- keybinds.openThreadTab = (key = $.getValue('key/openThreadTab', 0)).length >= 0 ? key : 'o';
- keybinds.openThread = (key = $.getValue('key/openThread', 0)).length >= 0 ? key : 'O';
- keybinds.expandThread = (key = $.getValue('key/expandThread', 0)).length >= 0 ? key : 'e';
- keybinds.watch = (key = $.getValue('key/watch', 0)).length >= 0 ? key : 'w';
- keybinds.hide = (key = $.getValue('key/hide', 0)).length >= 0 ? key : 'x';
- keybinds.expandImages = (key = $.getValue('key/expandImages', 0)).length >= 0 ? key : 'm';
- keybinds.expandAllImages = (key = $.getValue('key/expandAllImages', 0)).length >= 0 ? key : 'M';
- keybinds.update = (key = $.getValue('key/update', 0)).length >= 0 ? key : 'u';
+ keybinds.close = $.getValue('key/close', config.hotkeys.close);
+ keybinds.spoiler = $.getValue('key/spoiler', config.hotkeys.spoiler);
+ keybinds.openQR = $.getValue('key/openQR', config.hotkeys.openQR);
+ keybinds.openEmptyQR = $.getValue('key/openEmptyQR', config.hotkeys.openEmptyQR);
+ keybinds.submit = $.getValue('key/submit', config.hotkeys.submit);
+ keybinds.nextReply = $.getValue('key/nextReply', config.hotkeys.nextReply);
+ keybinds.previousReply = $.getValue('key/previousReply', config.hotkeys.previousReply);
+ keybinds.nextThread = $.getValue('key/nextThread', config.hotkeys.nextThread);
+ keybinds.previousThread = $.getValue('key/previousThread', config.hotkeys.previousThread);
+ keybinds.nextPage = $.getValue('key/nextPage', config.hotkeys.nextPage);
+ keybinds.previousPage = $.getValue('key/previousPage', config.hotkeys.previousPage);
+ keybinds.zero = $.getValue('key/zero', config.hotkeys.zero);
+ keybinds.openThreadTab = $.getValue('key/openThreadTab', config.hotkeys.openThreadTab);
+ keybinds.openThread = $.getValue('key/openThread', config.hotkeys.openThread);
+ keybinds.expandThread = $.getValue('key/expandThread', config.hotkeys.expandThread);
+ keybinds.watch = $.getValue('key/watch', config.hotkeys.watch);
+ keybinds.hide = $.getValue('key/hide', config.hotkeys.hide);
+ keybinds.expandImages = $.getValue('key/expandImages', config.hotkeys.expandImages);
+ keybinds.expandAllImages = $.getValue('key/expandAllImages', config.hotkeys.expandAllImages);
+ keybinds.update = $.getValue('key/update', config.hotkeys.update);
return $.bind(d, 'keydown', keybinds.cb.keydown);
},
cb: {
@@ -1048,7 +1048,7 @@
var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, link, main, obj, overlay, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {});
hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length;
- html = "
";
+ html = " ";
dialog = $.el('div', {
id: 'options',
innerHTML: html
@@ -1095,10 +1095,8 @@
_ref4 = $$('#keybinds input', dialog);
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
input = _ref4[_k];
+ input.value = $.getValue("key/" + input.name, config.hotkeys[input.name]);
$.bind(input, 'keydown', options.cb.keybind);
- if ((key = $.getValue("key/" + input.name, 0)).length >= 0) {
- input.value = key;
- }
}
/*
https://bugzilla.mozilla.org/show_bug.cgi?id=579776
diff --git a/script.coffee b/script.coffee
index 3b197a1bd..b2a7e814f 100644
--- a/script.coffee
+++ b/script.coffee
@@ -514,26 +514,26 @@ keybinds =
for node in $$ '[accesskey]'
node.removeAttribute 'accesskey'
- keybinds.close = if (key = $.getValue 'key/close', 0).length >= 0 then key else 'Esc'
- keybinds.spoiler = if (key = $.getValue 'key/spoiler', 0).length >= 0 then key else 'ctrl+s'
- keybinds.openQR = if (key = $.getValue 'key/openQR', 0).length >= 0 then key else 'i'
- keybinds.openEmptyQR = if (key = $.getValue 'key/openEmptyQR', 0).length >= 0 then key else 'I'
- keybinds.submit = if (key = $.getValue 'key/submit', 0).length >= 0 then key else 'alt+s'
- keybinds.nextReply = if (key = $.getValue 'key/nextReply', 0).length >= 0 then key else 'J'
- keybinds.previousReply = if (key = $.getValue 'key/previousReply', 0).length >= 0 then key else 'K'
- keybinds.nextThread = if (key = $.getValue 'key/nextThread', 0).length >= 0 then key else 'n'
- keybinds.previousThread = if (key = $.getValue 'key/previousThread', 0).length >= 0 then key else 'p'
- keybinds.nextPage = if (key = $.getValue 'key/nextPage', 0).length >= 0 then key else 'alt+x'
- keybinds.previousPage = if (key = $.getValue 'key/previousPage', 0).length >= 0 then key else 'alt+z'
- keybinds.zero = if (key = $.getValue 'key/zero', 0).length >= 0 then key else '0'
- keybinds.openThreadTab = if (key = $.getValue 'key/openThreadTab', 0).length >= 0 then key else 'o'
- keybinds.openThread = if (key = $.getValue 'key/openThread', 0).length >= 0 then key else 'O'
- keybinds.expandThread = if (key = $.getValue 'key/expandThread', 0).length >= 0 then key else 'e'
- keybinds.watch = if (key = $.getValue 'key/watch', 0).length >= 0 then key else 'w'
- keybinds.hide = if (key = $.getValue 'key/hide', 0).length >= 0 then key else 'x'
- keybinds.expandImages = if (key = $.getValue 'key/expandImages', 0).length >= 0 then key else 'm'
- keybinds.expandAllImages = if (key = $.getValue 'key/expandAllImages', 0).length >= 0 then key else 'M'
- keybinds.update = if (key = $.getValue 'key/update', 0).length >= 0 then key else 'u'
+ keybinds.close = $.getValue 'key/close', config.hotkeys.close
+ keybinds.spoiler = $.getValue 'key/spoiler', config.hotkeys.spoiler
+ keybinds.openQR = $.getValue 'key/openQR', config.hotkeys.openQR
+ keybinds.openEmptyQR = $.getValue 'key/openEmptyQR', config.hotkeys.openEmptyQR
+ keybinds.submit = $.getValue 'key/submit', config.hotkeys.submit
+ keybinds.nextReply = $.getValue 'key/nextReply', config.hotkeys.nextReply
+ keybinds.previousReply = $.getValue 'key/previousReply', config.hotkeys.previousReply
+ keybinds.nextThread = $.getValue 'key/nextThread', config.hotkeys.nextThread
+ keybinds.previousThread = $.getValue 'key/previousThread', config.hotkeys.previousThread
+ keybinds.nextPage = $.getValue 'key/nextPage', config.hotkeys.nextPage
+ keybinds.previousPage = $.getValue 'key/previousPage', config.hotkeys.previousPage
+ keybinds.zero = $.getValue 'key/zero', config.hotkeys.zero
+ keybinds.openThreadTab = $.getValue 'key/openThreadTab', config.hotkeys.openThreadTab
+ keybinds.openThread = $.getValue 'key/openThread', config.hotkeys.openThread
+ keybinds.expandThread = $.getValue 'key/expandThread', config.hotkeys.expandThread
+ keybinds.watch = $.getValue 'key/watch', config.hotkeys.watch
+ keybinds.hide = $.getValue 'key/hide', config.hotkeys.hide
+ keybinds.expandImages = $.getValue 'key/expandImages', config.hotkeys.expandImages
+ keybinds.expandAllImages = $.getValue 'key/expandAllImages', config.hotkeys.expandAllImages
+ keybinds.update = $.getValue 'key/update', config.hotkeys.update
$.bind d, 'keydown', keybinds.cb.keydown
@@ -818,26 +818,26 @@ options =
@@ -871,9 +871,8 @@ options =
$.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value
$.bind $('input[name=time]', dialog), 'keyup', options.cb.time
for input in $$ '#keybinds input', dialog
+ input.value = $.getValue "key/#{input.name}", config.hotkeys[input.name]
$.bind input, 'keydown', options.cb.keybind
- if (key = $.getValue "key/#{input.name}", 0).length >= 0
- input.value = key
###
https://bugzilla.mozilla.org/show_bug.cgi?id=579776