quote keybind

This commit is contained in:
James Campos 2011-09-03 15:30:44 -07:00
parent ee040e52ad
commit 37f8c16c88
2 changed files with 19 additions and 14 deletions

View File

@ -907,17 +907,19 @@
} }
}, },
qr: function(thread, quote) { qr: function(thread, quote) {
var qrLink; var qrLink, tid;
if (!(qrLink = $('td.replyhl span[id] a:not(:first-child)', thread))) { if (!(qrLink = $('td.replyhl span[id] a:not(:first-child)', thread))) {
qrLink = $("span[id^=nothread] a:not(:first-child)", thread); qrLink = $("span[id^=nothread] a:not(:first-child)", thread);
} }
tid = g.THREAD_ID || thread.firstChild.id;
if (quote) { if (quote) {
return qr.quote.call(qrLink); return QR.quote.call(qrLink);
} else { } else {
if (!qr.el) { if (QR.qr) {
qr.dialog(qrLink); return $('textarea', QR.qr).focus();
} else {
return QR.dialog('', tid);
} }
return $('textarea', qr.el).focus();
} }
}, },
open: function(thread, tab) { open: function(thread, tab) {
@ -1405,9 +1407,11 @@
e.preventDefault(); e.preventDefault();
return QR.submit(); return QR.submit();
}, },
quote: function(e) { quote: function(e, blank) {
var i, id, qr, s, sel, ss, ta, text, tid, v, _ref; var i, id, qr, s, sel, ss, ta, text, tid, v, _ref;
e.preventDefault(); if (e != null) {
e.preventDefault();
}
tid = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', this).id; tid = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', this).id;
id = this.textContent; id = this.textContent;
text = ">>" + id + "\n"; text = ">>" + id + "\n";

View File

@ -652,13 +652,14 @@ keybinds =
qr: (thread, quote) -> qr: (thread, quote) ->
unless qrLink = $ 'td.replyhl span[id] a:not(:first-child)', thread unless qrLink = $ 'td.replyhl span[id] a:not(:first-child)', thread
qrLink = $ "span[id^=nothread] a:not(:first-child)", thread qrLink = $ "span[id^=nothread] a:not(:first-child)", thread
tid = g.THREAD_ID or thread.firstChild.id
if quote if quote
qr.quote.call qrLink QR.quote.call qrLink
else else
unless qr.el if QR.qr
qr.dialog qrLink $('textarea', QR.qr).focus()
$('textarea', qr.el).focus() else
QR.dialog '', tid
open: (thread, tab) -> open: (thread, tab) ->
id = thread.firstChild.id id = thread.firstChild.id
@ -1107,8 +1108,8 @@ QR =
QR.captchaPush @ QR.captchaPush @
e.preventDefault() e.preventDefault()
QR.submit() #derpy, but prevents calling QR.hasContent twice QR.submit() #derpy, but prevents calling QR.hasContent twice
quote: (e) -> quote: (e, blank) ->
e.preventDefault() e?.preventDefault()
tid = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', @).id tid = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', @).id
id = @textContent id = @textContent
text = ">>#{id}\n" text = ">>#{id}\n"