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,28 +1023,30 @@
} }
}, },
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);
if (dialog = $('#qr')) {
qr.autohide.unset();
} else {
dialog = qr.dialog(target);
}
id = target.textContent;
text = ">>" + id + "\n";
selection = window.getSelection();
if (s = selection.toString()) {
selectionID = (_ref = $.x('preceding::input[@type="checkbox"][1]', selection.anchorNode)) != null ? _ref.name : void 0;
if (selectionID === id) {
text += ">" + s + "\n";
}
}
ta = $('textarea', dialog);
ta.focus();
return ta.value += text;
} }
}, },
quote: function(link) {
var dialog, id, s, selection, selectionID, ta, text, _ref;
if (dialog = $('#qr')) {
qr.autohide.unset();
} else {
dialog = qr.dialog(link);
}
id = link.textContent;
text = ">>" + id + "\n";
selection = window.getSelection();
if (s = selection.toString()) {
selectionID = (_ref = $.x('preceding::input[@type="checkbox"][1]', selection.anchorNode)) != null ? _ref.name : void 0;
if (selectionID === id) {
text += ">" + s + "\n";
}
}
ta = $('textarea', dialog);
ta.focus();
return ta.value += text;
},
refresh: function(dialog) { refresh: function(dialog) {
var f; var f;
$('textarea', dialog).value = ''; $('textarea', dialog).value = '';

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,24 +777,26 @@ qr =
quote: (e) -> quote: (e) ->
e.preventDefault() e.preventDefault()
{target} = e qr.quote e.target
if dialog = $ '#qr'
qr.autohide.unset()
else
dialog = qr.dialog target
id = target.textContent quote: (link) ->
text = ">>#{id}\n" if dialog = $ '#qr'
qr.autohide.unset()
else
dialog = qr.dialog link
selection = window.getSelection() id = link.textContent
if s = selection.toString() text = ">>#{id}\n"
selectionID = $.x('preceding::input[@type="checkbox"][1]', selection.anchorNode)?.name
if selectionID == id
text += ">#{s}\n"
ta = $ 'textarea', dialog selection = window.getSelection()
ta.focus() if s = selection.toString()
ta.value += text selectionID = $.x('preceding::input[@type="checkbox"][1]', selection.anchorNode)?.name
if selectionID == id
text += ">#{s}\n"
ta = $ 'textarea', dialog
ta.focus()
ta.value += text
refresh: (dialog) -> refresh: (dialog) ->
$('textarea', dialog).value = '' $('textarea', dialog).value = ''