g.startup; better qr keybind

This commit is contained in:
James Campos 2010-11-18 19:26:04 -08:00
parent 5e86a62974
commit 0df39c402a
2 changed files with 10 additions and 10 deletions

View File

@ -407,8 +407,6 @@ keypress = (e) ->
when "I" when "I"
qrLink = $ "#{hash} ~ span[id] a:not(:first-child)" qrLink = $ "#{hash} ~ span[id] a:not(:first-child)"
quickReply.call qrLink quickReply.call qrLink
ta = $ '#qr textarea'
ta.focus()
when "J" when "J"
temp = position + count temp = position + count
if temp > 9 then temp = 9 if temp > 9 then temp = 9
@ -577,8 +575,8 @@ quickReply = (e) ->
inBefore submit, auto inBefore submit, auto
addTo qr, clone addTo qr, clone
addTo d.body, qr addTo d.body, qr
if e unless g.startup
e.preventDefault() e?.preventDefault()
$('input[title=autohide]:checked', qr)?.click() $('input[title=autohide]:checked', qr)?.click()
selection = window.getSelection() selection = window.getSelection()
id = x('preceding::span[@id][1]', selection.anchorNode)?.id id = x('preceding::span[@id][1]', selection.anchorNode)?.id
@ -723,6 +721,7 @@ g =
'http://saucenao.com/search.php?db=999&url=' 'http://saucenao.com/search.php?db=999&url='
'http://tineye.com/search?url=' 'http://tineye.com/search?url='
].join '\n' ].join '\n'
startup: true
pathname = location.pathname.substring(1).split('/') pathname = location.pathname.substring(1).split('/')
[g.BOARD, temp] = pathname [g.BOARD, temp] = pathname
if temp is 'res' if temp is 'res'
@ -1042,3 +1041,4 @@ else #not reply
callback() for callback in g.callbacks callback() for callback in g.callbacks
d.body.addEventListener('DOMNodeInserted', nodeInserted, true) d.body.addEventListener('DOMNodeInserted', nodeInserted, true)
g.startup = false

View File

@ -447,7 +447,7 @@
return recaptchaReload(); return recaptchaReload();
}; };
keypress = function(e) { keypress = function(e) {
var _i, _len, char, count, hash, href, img, kc, position, qrLink, ta, temp; var _i, _len, char, count, hash, href, img, kc, position, qrLink, temp;
kc = g.keyCode; kc = g.keyCode;
if (kc === -1) { if (kc === -1) {
return null; return null;
@ -506,8 +506,6 @@
case "I": case "I":
qrLink = $("" + (hash) + " ~ span[id] a:not(:first-child)"); qrLink = $("" + (hash) + " ~ span[id] a:not(:first-child)");
quickReply.call(qrLink); quickReply.call(qrLink);
ta = $('#qr textarea');
ta.focus();
break; break;
case "J": case "J":
temp = position + count; temp = position + count;
@ -747,8 +745,8 @@
addTo(qr, clone); addTo(qr, clone);
addTo(d.body, qr); addTo(d.body, qr);
} }
if (e) { if (!(g.startup)) {
e.preventDefault(); (typeof e === "undefined" || e === null) ? undefined : e.preventDefault();
(typeof (_ref2 = ((_ref = $('input[title=autohide]:checked', qr)))) === "undefined" || _ref2 === null) ? undefined : _ref2.click(); (typeof (_ref2 = ((_ref = $('input[title=autohide]:checked', qr)))) === "undefined" || _ref2 === null) ? undefined : _ref2.click();
selection = window.getSelection(); selection = window.getSelection();
id = (typeof (_ref2 = ((_ref = x('preceding::span[@id][1]', selection.anchorNode)))) === "undefined" || _ref2 === null) ? undefined : _ref2.id; id = (typeof (_ref2 = ((_ref = x('preceding::span[@id][1]', selection.anchorNode)))) === "undefined" || _ref2 === null) ? undefined : _ref2.id;
@ -921,7 +919,8 @@
watched: JSON.parse(GM_getValue('watched', '{}')), watched: JSON.parse(GM_getValue('watched', '{}')),
favEmpty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==', favEmpty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==',
favNormal: ((typeof (_ref2 = ((_ref = $('link[rel="shortcut icon"]', $('head', d))))) === "undefined" || _ref2 === null) ? undefined : _ref2.href) || 'http://static.4chan.org/image/favicon.ico', favNormal: ((typeof (_ref2 = ((_ref = $('link[rel="shortcut icon"]', $('head', d))))) === "undefined" || _ref2 === null) ? undefined : _ref2.href) || 'http://static.4chan.org/image/favicon.ico',
flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://saucenao.com/search.php?db=999&url=', 'http://tineye.com/search?url='].join('\n') flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://saucenao.com/search.php?db=999&url=', 'http://tineye.com/search?url='].join('\n'),
startup: true
}; };
pathname = location.pathname.substring(1).split('/'); pathname = location.pathname.substring(1).split('/');
_ref = pathname; _ref = pathname;
@ -1350,4 +1349,5 @@
callback(); callback();
} }
d.body.addEventListener('DOMNodeInserted', nodeInserted, true); d.body.addEventListener('DOMNodeInserted', nodeInserted, true);
g.startup = false;
}).call(this); }).call(this);