Custom hotkey binding.
This commit is contained in:
parent
4adb7f3c8b
commit
75618fb788
@ -692,6 +692,23 @@
|
|||||||
};
|
};
|
||||||
keybinds = {
|
keybinds = {
|
||||||
init: function() {
|
init: function() {
|
||||||
|
var key;
|
||||||
|
keybinds.close = (key = $.getValue('key/close')) ? key : '<Esc>';
|
||||||
|
keybinds.zero = (key = $.getValue('key/zero')) ? key : '0';
|
||||||
|
keybinds.openQR = (key = $.getValue('key/openQR')) ? key : 'i';
|
||||||
|
keybinds.openEmptyQR = (key = $.getValue('key/openEmptyQR')) ? key : 'I';
|
||||||
|
keybinds.nextReply = (key = $.getValue('key/nextReply')) ? key : 'J';
|
||||||
|
keybinds.previousReply = (key = $.getValue('key/previousReply')) ? key : 'K';
|
||||||
|
keybinds.nextThread = (key = $.getValue('key/nextThread')) ? key : 'n';
|
||||||
|
keybinds.previousThread = (key = $.getValue('key/previousThread')) ? key : 'p';
|
||||||
|
keybinds.openThreadTab = (key = $.getValue('key/openThreadTab')) ? key : 'o';
|
||||||
|
keybinds.openThread = (key = $.getValue('key/openThread')) ? key : 'O';
|
||||||
|
keybinds.expandThread = (key = $.getValue('key/expandThread')) ? key : 'e';
|
||||||
|
keybinds.watch = (key = $.getValue('key/watch')) ? key : 'w';
|
||||||
|
keybinds.hide = (key = $.getValue('key/hide')) ? key : 'x';
|
||||||
|
keybinds.expandImages = (key = $.getValue('key/expandImages')) ? key : 'm';
|
||||||
|
keybinds.expandAllImages = (key = $.getValue('key/expandAllImages')) ? key : 'M';
|
||||||
|
keybinds.update = (key = $.getValue('key/update')) ? key : 'u';
|
||||||
$.bind(d, 'keydown', keybinds.cb.keydown);
|
$.bind(d, 'keydown', keybinds.cb.keydown);
|
||||||
return $.bind(d, 'keypress', keybinds.cb.keypress);
|
return $.bind(d, 'keypress', keybinds.cb.keypress);
|
||||||
},
|
},
|
||||||
@ -728,7 +745,7 @@
|
|||||||
insert: function(e) {
|
insert: function(e) {
|
||||||
var range, selEnd, selStart, ta, valEnd, valMid, valStart, value;
|
var range, selEnd, selStart, ta, valEnd, valMid, valStart, value;
|
||||||
switch (keybinds.key) {
|
switch (keybinds.key) {
|
||||||
case '<Esc>':
|
case keybinds.close:
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return $.rm($('#qr'));
|
return $.rm($('#qr'));
|
||||||
case '^s':
|
case '^s':
|
||||||
@ -752,40 +769,40 @@
|
|||||||
var o, thread;
|
var o, thread;
|
||||||
thread = nav.getThread();
|
thread = nav.getThread();
|
||||||
switch (keybinds.key) {
|
switch (keybinds.key) {
|
||||||
case '<Esc>':
|
case keybinds.close:
|
||||||
if (o = $('#overlay')) {
|
if (o = $('#overlay')) {
|
||||||
return $.rm(o);
|
return $.rm(o);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '0':
|
case keybinds.zero:
|
||||||
return window.location = "/" + g.BOARD + "/0#0";
|
return window.location = "/" + g.BOARD + "/0#0";
|
||||||
case 'I':
|
case keybinds.openEmptyQR:
|
||||||
return keybinds.qr(thread);
|
return keybinds.qr(thread);
|
||||||
case 'J':
|
case keybinds.nextReply:
|
||||||
return keybinds.hl.next(thread);
|
return keybinds.hl.next(thread);
|
||||||
case 'K':
|
case keybinds.previousReply:
|
||||||
return keybinds.hl.prev(thread);
|
return keybinds.hl.prev(thread);
|
||||||
case 'M':
|
case keybinds.expandAllImages:
|
||||||
return keybinds.img(thread, true);
|
return keybinds.img(thread, true);
|
||||||
case 'O':
|
case keybinds.openThread:
|
||||||
return keybinds.open(thread);
|
return keybinds.open(thread);
|
||||||
case 'e':
|
case keybinds.expandThread:
|
||||||
return expandThread.toggle(thread);
|
return expandThread.toggle(thread);
|
||||||
case 'i':
|
case keybinds.openQR:
|
||||||
return keybinds.qr(thread, true);
|
return keybinds.qr(thread, true);
|
||||||
case 'm':
|
case keybinds.expandImages:
|
||||||
return keybinds.img(thread);
|
return keybinds.img(thread);
|
||||||
case 'n':
|
case keybinds.nextThread:
|
||||||
return nav.next();
|
return nav.next();
|
||||||
case 'o':
|
case keybinds.openThreadTab:
|
||||||
return keybinds.open(thread, true);
|
return keybinds.open(thread, true);
|
||||||
case 'p':
|
case keybinds.previousThread:
|
||||||
return nav.prev();
|
return nav.prev();
|
||||||
case 'u':
|
case keybinds.update:
|
||||||
return updater.update();
|
return updater.update();
|
||||||
case 'w':
|
case keybinds.watch:
|
||||||
return watcher.toggle(thread);
|
return watcher.toggle(thread);
|
||||||
case 'x':
|
case keybinds.hide:
|
||||||
return threadHiding.toggle(thread);
|
return threadHiding.toggle(thread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -969,10 +986,10 @@
|
|||||||
return $.replace(home, a);
|
return $.replace(home, a);
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, link, main, obj, overlay, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3;
|
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 + "/", {});
|
hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {});
|
||||||
hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length;
|
hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length;
|
||||||
html = " <div class='reply dialog'> <div id=optionsbar> <div id=floaty> <a name=main>main</a> | <a name=flavors>sauce</a> | <a name=time>time</a> </div> <div id=credits> <a href=http://chat.now.im/x/aeos>support throd</a> | <a href=https://github.com/aeosynth/4chan-x/issues>github</a> | <a href=http://userscripts.org/scripts/show/51412>uso</a> | <a href=https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2DBVZBUAM4DHC&lc=US&item_name=Aeosynth¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted>donate</a> </div> </div> <hr> <div id=content> <div id=main> </div> <textarea style='display: none;' name=flavors id=flavors>" + ($.config('flavors')) + "</textarea> <div style='display: none;' id=time> <div><input type=text name=time value='" + ($.config('time')) + "'> <span id=timePreview></span></div> <table> <caption>Format specifiers <a href=http://en.wikipedia.org/wiki/Date_%28Unix%29#Formatting>(source)</a></caption> <tbody> <tr><th>Specifier</th><th>Description</th><th>Values/Example</th></tr> <tr><td>%a</td><td>weekday, abbreviated</td><td>Sat</td></tr> <tr><td>%A</td><td>weekday, full</td><td>Saturday</td></tr> <tr><td>%b</td><td>month, abbreviated</td><td>Jun</td></tr> <tr><td>%B</td><td>month, full length</td><td>June</td></tr> <tr><td>%d</td><td>day of the month, zero padded</td><td>03</td></tr> <tr><td>%H</td><td>hour (24 hour clock) zero padded</td><td>13</td></tr> <tr><td>%I (uppercase i)</td><td>hour (12 hour clock) zero padded</td><td>02</td></tr> <tr><td>%m</td><td>month, zero padded</td><td>06</td></tr> <tr><td>%M</td><td>minutes, zero padded</td><td>54</td></tr> <tr><td>%p</td><td>upper case AM or PM</td><td>PM</td></tr> <tr><td>%P</td><td>lower case am or pm</td><td>pm</td></tr> <tr><td>%y</td><td>two digit year</td><td>00-99</td></tr> </tbody> </table> </div> </div> </div> ";
|
html = " <div class='reply dialog'> <div id=optionsbar> <div id=floaty> <a name=main>main</a> | <a name=flavors>sauce</a> | <a name=time>time</a> | <a name=keybinds>keybinds</a> </div> <div id=credits> <a href=http://chat.now.im/x/aeos>support throd</a> | <a href=https://github.com/aeosynth/4chan-x/issues>github</a> | <a href=http://userscripts.org/scripts/show/51412>uso</a> | <a href=https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2DBVZBUAM4DHC&lc=US&item_name=Aeosynth¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted>donate</a> </div> </div> <hr> <div id=content> <div id=main> </div> <textarea style='display: none;' name=flavors id=flavors>" + ($.config('flavors')) + "</textarea> <div style='display: none;' id=time> <div><input type=text name=time value='" + ($.config('time')) + "'> <span id=timePreview></span></div> <table> <caption>Format specifiers <a href=http://en.wikipedia.org/wiki/Date_%28Unix%29#Formatting>(source)</a></caption> <tbody> <tr><th>Specifier</th><th>Description</th><th>Values/Example</th></tr> <tr><td>%a</td><td>weekday, abbreviated</td><td>Sat</td></tr> <tr><td>%A</td><td>weekday, full</td><td>Saturday</td></tr> <tr><td>%b</td><td>month, abbreviated</td><td>Jun</td></tr> <tr><td>%B</td><td>month, full length</td><td>June</td></tr> <tr><td>%d</td><td>day of the month, zero padded</td><td>03</td></tr> <tr><td>%H</td><td>hour (24 hour clock) zero padded</td><td>13</td></tr> <tr><td>%I (uppercase i)</td><td>hour (12 hour clock) zero padded</td><td>02</td></tr> <tr><td>%m</td><td>month, zero padded</td><td>06</td></tr> <tr><td>%M</td><td>minutes, zero padded</td><td>54</td></tr> <tr><td>%p</td><td>upper case AM or PM</td><td>PM</td></tr> <tr><td>%P</td><td>lower case am or pm</td><td>pm</td></tr> <tr><td>%y</td><td>two digit year</td><td>00-99</td></tr> </tbody> </table> </div> <div style='display: none;' id=keybinds> <table> <tbody> <tr><th>Actions</th><th>Keybinds</th></tr> <tr><td>Close Options or QR</td><td><input type=text name=close value='<Esc>'></td></tr> <tr><td>Quick spoiler</td><td><input type=text name=spoiler value='^s'></td></tr> <tr><td>Jump to page 0</td><td><input type=text name=zero value='0'></td></tr> <tr><td>Open QR with post number inserted</td><td><input type=text name=openQR value='i'></td></tr> <tr><td>Open QR without post number inserted</td><td><input type=text name=openEmptyQR value='I'></td></tr> <tr><td>Select next reply</td><td><input type=text name=nextReply value='J'></td></tr> <tr><td>Select previous reply</td><td><input type=text name=previousReply value='K'></td></tr> <tr><td>See next thread</td><td><input type=text name=nextThread value='n'></td></tr> <tr><td>See previous thread</td><td><input type=text name=previousThread value='p'></td></tr> <tr><td>Open thread in current tab</td><td><input type=text name=openThread value='O'></td></tr> <tr><td>Open thread in new tab</td><td><input type=text name=openThreadTab value='o'></td></tr> <tr><td>Expand thread</td><td><input type=text name=expandThread value='e'></td></tr> <tr><td>Watch thread</td><td><input type=text name=watch value='w'></td></tr> <tr><td>Hide thread</td><td><input type=text name=hide value='x'></td></tr> <tr><td>Expand selected images</td><td><input type=text name=expandImages value='m'></td></tr> <tr><td>Expand all images</td><td><input type=text name=expandAllImages value='M'></td></tr> <tr><td>Update now</td><td><input type=text name=update value='u'></td></tr> </tbody> </table> </div> </div> </div> ";
|
||||||
dialog = $.el('div', {
|
dialog = $.el('div', {
|
||||||
id: 'options',
|
id: 'options',
|
||||||
innerHTML: html
|
innerHTML: html
|
||||||
@ -1016,6 +1033,14 @@
|
|||||||
}
|
}
|
||||||
$.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value);
|
$.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value);
|
||||||
$.bind($('input[name=time]', dialog), 'keyup', options.cb.time);
|
$.bind($('input[name=time]', dialog), 'keyup', options.cb.time);
|
||||||
|
_ref4 = $$('#keybinds input', dialog);
|
||||||
|
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
|
||||||
|
input = _ref4[_k];
|
||||||
|
$.bind(input, 'keydown', options.cb.keybind);
|
||||||
|
if (key = $.getValue("key/" + input.name, 0)) {
|
||||||
|
input.value = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=579776
|
https://bugzilla.mozilla.org/show_bug.cgi?id=579776
|
||||||
position:fixed and position:absolute shouldn't turn display:-moz-box into display:block
|
position:fixed and position:absolute shouldn't turn display:-moz-box into display:block
|
||||||
@ -1038,7 +1063,7 @@
|
|||||||
},
|
},
|
||||||
tab: function() {
|
tab: function() {
|
||||||
var content, div, _i, _len, _results;
|
var content, div, _i, _len, _results;
|
||||||
content = $$('#main, #flavors, #time');
|
content = $$('#main, #flavors, #time, #keybinds');
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
||||||
div = content[_i];
|
div = content[_i];
|
||||||
@ -1053,6 +1078,30 @@
|
|||||||
this.value = "hidden: 0";
|
this.value = "hidden: 0";
|
||||||
return g.hiddenReplies = {};
|
return g.hiddenReplies = {};
|
||||||
},
|
},
|
||||||
|
keybind: function(e) {
|
||||||
|
var kc, key;
|
||||||
|
e.preventDefault();
|
||||||
|
kc = e.keyCode;
|
||||||
|
if ((65 <= kc && kc <= 90)) {
|
||||||
|
key = String.fromCharCode(kc);
|
||||||
|
if (!e.shiftKey) {
|
||||||
|
key = key.toLowerCase();
|
||||||
|
}
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
key = '^' + key;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (kc === 27) {
|
||||||
|
key = '<Esc>';
|
||||||
|
} else if ((48 <= kc && kc <= 57)) {
|
||||||
|
key = String.fromCharCode(kc);
|
||||||
|
} else {
|
||||||
|
key = this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.value = key;
|
||||||
|
return $.setValue("key/" + this.name, key);
|
||||||
|
},
|
||||||
time: function(e) {
|
time: function(e) {
|
||||||
$.setValue('time', this.value);
|
$.setValue('time', this.value);
|
||||||
Time.foo();
|
Time.foo();
|
||||||
|
|||||||
100
script.coffee
100
script.coffee
@ -489,6 +489,23 @@ replyHiding =
|
|||||||
|
|
||||||
keybinds =
|
keybinds =
|
||||||
init: ->
|
init: ->
|
||||||
|
keybinds.close = if key = $.getValue 'key/close' then key else '<Esc>'
|
||||||
|
keybinds.zero = if key = $.getValue 'key/zero' then key else '0'
|
||||||
|
keybinds.openQR = if key = $.getValue 'key/openQR' then key else 'i'
|
||||||
|
keybinds.openEmptyQR = if key = $.getValue 'key/openEmptyQR' then key else 'I'
|
||||||
|
keybinds.nextReply = if key = $.getValue 'key/nextReply' then key else 'J'
|
||||||
|
keybinds.previousReply = if key = $.getValue 'key/previousReply' then key else 'K'
|
||||||
|
keybinds.nextThread = if key = $.getValue 'key/nextThread' then key else 'n'
|
||||||
|
keybinds.previousThread = if key = $.getValue 'key/previousThread' then key else 'p'
|
||||||
|
keybinds.openThreadTab = if key = $.getValue 'key/openThreadTab' then key else 'o'
|
||||||
|
keybinds.openThread = if key = $.getValue 'key/openThread' then key else 'O'
|
||||||
|
keybinds.expandThread = if key = $.getValue 'key/expandThread' then key else 'e'
|
||||||
|
keybinds.watch = if key = $.getValue 'key/watch' then key else 'w'
|
||||||
|
keybinds.hide = if key = $.getValue 'key/hide' then key else 'x'
|
||||||
|
keybinds.expandImages = if key = $.getValue 'key/expandImages' then key else 'm'
|
||||||
|
keybinds.expandAllImages = if key = $.getValue 'key/expandAllImages' then key else 'M'
|
||||||
|
keybinds.update = if key = $.getValue 'key/update' then key else 'u'
|
||||||
|
|
||||||
$.bind d, 'keydown', keybinds.cb.keydown
|
$.bind d, 'keydown', keybinds.cb.keydown
|
||||||
$.bind d, 'keypress', keybinds.cb.keypress
|
$.bind d, 'keypress', keybinds.cb.keypress
|
||||||
|
|
||||||
@ -517,7 +534,7 @@ keybinds =
|
|||||||
|
|
||||||
insert: (e) ->
|
insert: (e) ->
|
||||||
switch keybinds.key
|
switch keybinds.key
|
||||||
when '<Esc>'
|
when keybinds.close
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$.rm $ '#qr'
|
$.rm $ '#qr'
|
||||||
when '^s'
|
when '^s'
|
||||||
@ -541,37 +558,37 @@ keybinds =
|
|||||||
normal: (e) ->
|
normal: (e) ->
|
||||||
thread = nav.getThread()
|
thread = nav.getThread()
|
||||||
switch keybinds.key
|
switch keybinds.key
|
||||||
when '<Esc>'
|
when keybinds.close
|
||||||
$.rm o if o = $ '#overlay'
|
$.rm o if o = $ '#overlay'
|
||||||
when '0'
|
when keybinds.zero
|
||||||
window.location = "/#{g.BOARD}/0#0"
|
window.location = "/#{g.BOARD}/0#0"
|
||||||
when 'I'
|
when keybinds.openEmptyQR
|
||||||
keybinds.qr thread
|
keybinds.qr thread
|
||||||
when 'J'
|
when keybinds.nextReply
|
||||||
keybinds.hl.next thread
|
keybinds.hl.next thread
|
||||||
when 'K'
|
when keybinds.previousReply
|
||||||
keybinds.hl.prev thread
|
keybinds.hl.prev thread
|
||||||
when 'M'
|
when keybinds.expandAllImages
|
||||||
keybinds.img thread, true
|
keybinds.img thread, true
|
||||||
when 'O'
|
when keybinds.openThread
|
||||||
keybinds.open thread
|
keybinds.open thread
|
||||||
when 'e'
|
when keybinds.expandThread
|
||||||
expandThread.toggle thread
|
expandThread.toggle thread
|
||||||
when 'i'
|
when keybinds.openQR
|
||||||
keybinds.qr thread, true
|
keybinds.qr thread, true
|
||||||
when 'm'
|
when keybinds.expandImages
|
||||||
keybinds.img thread
|
keybinds.img thread
|
||||||
when 'n'
|
when keybinds.nextThread
|
||||||
nav.next()
|
nav.next()
|
||||||
when 'o'
|
when keybinds.openThreadTab
|
||||||
keybinds.open thread, true
|
keybinds.open thread, true
|
||||||
when 'p'
|
when keybinds.previousThread
|
||||||
nav.prev()
|
nav.prev()
|
||||||
when 'u'
|
when keybinds.update
|
||||||
updater.update()
|
updater.update()
|
||||||
when 'w'
|
when keybinds.watch
|
||||||
watcher.toggle thread
|
watcher.toggle thread
|
||||||
when 'x'
|
when keybinds.hide
|
||||||
threadHiding.toggle thread
|
threadHiding.toggle thread
|
||||||
|
|
||||||
img: (thread, all) ->
|
img: (thread, all) ->
|
||||||
@ -730,7 +747,7 @@ options =
|
|||||||
<div class='reply dialog'>
|
<div class='reply dialog'>
|
||||||
<div id=optionsbar>
|
<div id=optionsbar>
|
||||||
<div id=floaty>
|
<div id=floaty>
|
||||||
<a name=main>main</a> | <a name=flavors>sauce</a> | <a name=time>time</a>
|
<a name=main>main</a> | <a name=flavors>sauce</a> | <a name=time>time</a> | <a name=keybinds>keybinds</a>
|
||||||
</div>
|
</div>
|
||||||
<div id=credits>
|
<div id=credits>
|
||||||
<a href=http://chat.now.im/x/aeos>support throd</a> |
|
<a href=http://chat.now.im/x/aeos>support throd</a> |
|
||||||
@ -765,6 +782,30 @@ options =
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div style='display: none;' id=keybinds>
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr><th>Actions</th><th>Keybinds</th></tr>
|
||||||
|
<tr><td>Close Options or QR</td><td><input type=text name=close value='<Esc>'></td></tr>
|
||||||
|
<tr><td>Quick spoiler</td><td><input type=text name=spoiler value='^s'></td></tr>
|
||||||
|
<tr><td>Jump to page 0</td><td><input type=text name=zero value='0'></td></tr>
|
||||||
|
<tr><td>Open QR with post number inserted</td><td><input type=text name=openQR value='i'></td></tr>
|
||||||
|
<tr><td>Open QR without post number inserted</td><td><input type=text name=openEmptyQR value='I'></td></tr>
|
||||||
|
<tr><td>Select next reply</td><td><input type=text name=nextReply value='J'></td></tr>
|
||||||
|
<tr><td>Select previous reply</td><td><input type=text name=previousReply value='K'></td></tr>
|
||||||
|
<tr><td>See next thread</td><td><input type=text name=nextThread value='n'></td></tr>
|
||||||
|
<tr><td>See previous thread</td><td><input type=text name=previousThread value='p'></td></tr>
|
||||||
|
<tr><td>Open thread in current tab</td><td><input type=text name=openThread value='O'></td></tr>
|
||||||
|
<tr><td>Open thread in new tab</td><td><input type=text name=openThreadTab value='o'></td></tr>
|
||||||
|
<tr><td>Expand thread</td><td><input type=text name=expandThread value='e'></td></tr>
|
||||||
|
<tr><td>Watch thread</td><td><input type=text name=watch value='w'></td></tr>
|
||||||
|
<tr><td>Hide thread</td><td><input type=text name=hide value='x'></td></tr>
|
||||||
|
<tr><td>Expand selected images</td><td><input type=text name=expandImages value='m'></td></tr>
|
||||||
|
<tr><td>Expand all images</td><td><input type=text name=expandAllImages value='M'></td></tr>
|
||||||
|
<tr><td>Update now</td><td><input type=text name=update value='u'></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
"
|
"
|
||||||
@ -794,6 +835,10 @@ options =
|
|||||||
$.bind link, 'click', options.tab for link in $$ '#floaty a', dialog
|
$.bind link, 'click', options.tab for link in $$ '#floaty a', dialog
|
||||||
$.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value
|
$.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value
|
||||||
$.bind $('input[name=time]', dialog), 'keyup', options.cb.time
|
$.bind $('input[name=time]', dialog), 'keyup', options.cb.time
|
||||||
|
for input in $$ '#keybinds input', dialog
|
||||||
|
$.bind input, 'keydown', options.cb.keybind
|
||||||
|
if key = $.getValue "key/#{input.name}", 0
|
||||||
|
input.value = key
|
||||||
|
|
||||||
###
|
###
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=579776
|
https://bugzilla.mozilla.org/show_bug.cgi?id=579776
|
||||||
@ -812,7 +857,7 @@ options =
|
|||||||
$.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation()
|
$.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation()
|
||||||
|
|
||||||
tab: ->
|
tab: ->
|
||||||
content = $$ '#main, #flavors, #time'
|
content = $$ '#main, #flavors, #time, #keybinds'
|
||||||
for div in content
|
for div in content
|
||||||
if div.id is @name
|
if div.id is @name
|
||||||
$.show div
|
$.show div
|
||||||
@ -827,6 +872,23 @@ options =
|
|||||||
$.deleteValue "hiddenThreads/#{g.BOARD}/"
|
$.deleteValue "hiddenThreads/#{g.BOARD}/"
|
||||||
@value = "hidden: 0"
|
@value = "hidden: 0"
|
||||||
g.hiddenReplies = {}
|
g.hiddenReplies = {}
|
||||||
|
keybind: (e) ->
|
||||||
|
e.preventDefault()
|
||||||
|
kc = e.keyCode
|
||||||
|
if 65 <= kc <= 90 #A-Z
|
||||||
|
key = String.fromCharCode kc
|
||||||
|
if !e.shiftKey
|
||||||
|
key = key.toLowerCase()
|
||||||
|
if e.ctrlKey then key = '^' + key
|
||||||
|
else
|
||||||
|
if kc is 27
|
||||||
|
key = '<Esc>'
|
||||||
|
else if 48 <= kc <= 57 #0-9
|
||||||
|
key = String.fromCharCode kc
|
||||||
|
else
|
||||||
|
key = @value
|
||||||
|
@value = key
|
||||||
|
$.setValue "key/#{@name}", key
|
||||||
time: (e) ->
|
time: (e) ->
|
||||||
$.setValue 'time', @value
|
$.setValue 'time', @value
|
||||||
Time.foo()
|
Time.foo()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user