Convert hotkeys too.
This commit is contained in:
parent
0f0d08ecd4
commit
c925959370
@ -1341,7 +1341,7 @@
|
||||
return reader.readAsText(file);
|
||||
},
|
||||
loadSettings: function(data) {
|
||||
var key, val, version, _ref;
|
||||
var key, val, version, _ref, _ref1;
|
||||
version = data.version.split('.');
|
||||
if (version[0] === '2') {
|
||||
data = Settings.convertSettings(data, {
|
||||
@ -1372,8 +1372,8 @@
|
||||
'watch': 'Watch',
|
||||
'update': 'Update',
|
||||
'unreadCountTo0': '',
|
||||
'expandAllImages': 'Expand image',
|
||||
'expandImage': 'Expand images',
|
||||
'expandAllImages': 'Expand images',
|
||||
'expandImage': 'Expand image',
|
||||
'zero': 'Front page',
|
||||
'nextPage': 'Next page',
|
||||
'previousPage': 'Previous page',
|
||||
@ -1389,7 +1389,6 @@
|
||||
'Verbose': ''
|
||||
});
|
||||
data.Conf.sauces = data.Conf.sauces.replace(/\$\d/g, function(c) {
|
||||
$.log(c);
|
||||
switch (c) {
|
||||
case '$1':
|
||||
return '%turl';
|
||||
@ -1403,10 +1402,22 @@
|
||||
return c;
|
||||
}
|
||||
});
|
||||
_ref = Config.hotkeys;
|
||||
for (key in _ref) {
|
||||
val = _ref[key];
|
||||
if (!(key in data.Conf)) {
|
||||
continue;
|
||||
}
|
||||
data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, function(s) {
|
||||
return "" + (s[0].toUpperCase()) + s.slice(1);
|
||||
}).replace(/(^|.+\+)[A-Z]$/g, function(s) {
|
||||
return "Shift+" + s.slice(0, -1) + (s.slice(-1).toLowerCase());
|
||||
});
|
||||
}
|
||||
}
|
||||
_ref = data.Conf;
|
||||
for (key in _ref) {
|
||||
val = _ref[key];
|
||||
_ref1 = data.Conf;
|
||||
for (key in _ref1) {
|
||||
val = _ref1[key];
|
||||
$.set(key, val);
|
||||
}
|
||||
return $.set('WatchedThreads', data.WatchedThreads);
|
||||
@ -2694,7 +2705,7 @@
|
||||
}
|
||||
target = e.target;
|
||||
if ((_ref = target.nodeName) === 'INPUT' || _ref === 'TEXTAREA') {
|
||||
if (!((key === 'Esc') || (/(Alt|Ctrl|Meta)\+/.test(key)))) {
|
||||
if (!/(Esc|Alt|Ctrl|Meta)/.test(key)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2707,7 +2718,7 @@
|
||||
case Conf['Open QR']:
|
||||
Keybinds.qr(threadRoot, true);
|
||||
break;
|
||||
case Conf['Open options']:
|
||||
case Conf['Open settings']:
|
||||
Settings.open();
|
||||
break;
|
||||
case Conf['Close']:
|
||||
|
||||
@ -337,8 +337,8 @@ Settings =
|
||||
'watch': 'Watch'
|
||||
'update': 'Update'
|
||||
'unreadCountTo0': ''
|
||||
'expandAllImages': 'Expand image'
|
||||
'expandImage': 'Expand images'
|
||||
'expandAllImages': 'Expand images'
|
||||
'expandImage': 'Expand image'
|
||||
'zero': 'Front page'
|
||||
'nextPage': 'Next page'
|
||||
'previousPage': 'Previous page'
|
||||
@ -354,7 +354,6 @@ Settings =
|
||||
'Scrolling': 'Auto Scroll'
|
||||
'Verbose': ''
|
||||
data.Conf.sauces = data.Conf.sauces.replace /\$\d/g, (c) ->
|
||||
$.log c
|
||||
switch c
|
||||
when '$1'
|
||||
'%turl'
|
||||
@ -366,6 +365,10 @@ Settings =
|
||||
'%board'
|
||||
else
|
||||
c
|
||||
for key, val of Config.hotkeys
|
||||
continue unless key of data.Conf
|
||||
data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, (s) -> "#{s[0].toUpperCase()}#{s[1..]}").replace /(^|.+\+)[A-Z]$/g, (s) ->
|
||||
"Shift+#{s[0...-1]}#{s[-1..].toLowerCase()}"
|
||||
for key, val of data.Conf
|
||||
$.set key, val
|
||||
$.set 'WatchedThreads', data.WatchedThreads
|
||||
@ -1481,7 +1484,7 @@ Keybinds =
|
||||
return unless key = Keybinds.keyCode e
|
||||
{target} = e
|
||||
if target.nodeName in ['INPUT', 'TEXTAREA']
|
||||
return unless (key is 'Esc') or (/(Alt|Ctrl|Meta)\+/.test key)
|
||||
return unless /(Esc|Alt|Ctrl|Meta)/.test key
|
||||
|
||||
threadRoot = Nav.getThread()
|
||||
thread = Get.postFromNode($('.op', threadRoot)).thread
|
||||
@ -1491,7 +1494,7 @@ Keybinds =
|
||||
Keybinds.qr threadRoot
|
||||
when Conf['Open QR']
|
||||
Keybinds.qr threadRoot, true
|
||||
when Conf['Open options']
|
||||
when Conf['Open settings']
|
||||
Settings.open()
|
||||
when Conf['Close']
|
||||
if $.id 'settings'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user