This commit is contained in:
James Campos 2011-04-20 00:16:32 -07:00
parent 8977f055cc
commit 0575c17582
2 changed files with 41 additions and 45 deletions

View File

@ -684,16 +684,12 @@
} }
}, },
qr: function(thread, quote) { qr: function(thread, quote) {
var e, qrLink; var qrLink;
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);
} }
if (quote) { if (quote) {
e = { return qr.quote(qrLink);
preventDefault: function() {},
target: qrLink
};
return qr.cb.quote(e);
} else { } else {
if (!$('#qr')) { if (!$('#qr')) {
qr.dialog(qrLink); qr.dialog(qrLink);
@ -1027,15 +1023,18 @@
} }
}, },
quote: function(e) { quote: function(e) {
var dialog, id, s, selection, selectionID, ta, target, text, _ref;
e.preventDefault(); e.preventDefault();
target = e.target; return qr.quote(e.target);
}
},
quote: function(link) {
var dialog, id, s, selection, selectionID, ta, text, _ref;
if (dialog = $('#qr')) { if (dialog = $('#qr')) {
qr.autohide.unset(); qr.autohide.unset();
} else { } else {
dialog = qr.dialog(target); dialog = qr.dialog(link);
} }
id = target.textContent; id = link.textContent;
text = ">>" + id + "\n"; text = ">>" + id + "\n";
selection = window.getSelection(); selection = window.getSelection();
if (s = selection.toString()) { if (s = selection.toString()) {
@ -1047,7 +1046,6 @@
ta = $('textarea', dialog); ta = $('textarea', dialog);
ta.focus(); ta.focus();
return ta.value += text; return ta.value += text;
}
}, },
refresh: function(dialog) { refresh: function(dialog) {
var f; var f;

View File

@ -499,11 +499,7 @@ keybinds =
qrLink = $ "span[id^=nothread] a:not(:first-child)", thread qrLink = $ "span[id^=nothread] a:not(:first-child)", thread
if quote if quote
# qrLink.click() doesn't work, so use this hack qr.quote qrLink
e =
preventDefault: ->
target: qrLink
qr.cb.quote e
else else
unless $ '#qr' unless $ '#qr'
qr.dialog qrLink qr.dialog qrLink
@ -781,13 +777,15 @@ qr =
quote: (e) -> quote: (e) ->
e.preventDefault() e.preventDefault()
{target} = e qr.quote e.target
quote: (link) ->
if dialog = $ '#qr' if dialog = $ '#qr'
qr.autohide.unset() qr.autohide.unset()
else else
dialog = qr.dialog target dialog = qr.dialog link
id = target.textContent id = link.textContent
text = ">>#{id}\n" text = ">>#{id}\n"
selection = window.getSelection() selection = window.getSelection()