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) {
var e, qrLink;
var qrLink;
if (!(qrLink = $('td.replyhl span[id] a:not(:first-child)', thread))) {
qrLink = $("span[id^=nothread] a:not(:first-child)", thread);
}
if (quote) {
e = {
preventDefault: function() {},
target: qrLink
};
return qr.cb.quote(e);
return qr.quote(qrLink);
} else {
if (!$('#qr')) {
qr.dialog(qrLink);
@ -1027,28 +1023,30 @@
}
},
quote: function(e) {
var dialog, id, s, selection, selectionID, ta, target, text, _ref;
e.preventDefault();
target = 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;
return qr.quote(e.target);
}
},
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) {
var f;
$('textarea', dialog).value = '';

View File

@ -499,11 +499,7 @@ keybinds =
qrLink = $ "span[id^=nothread] a:not(:first-child)", thread
if quote
# qrLink.click() doesn't work, so use this hack
e =
preventDefault: ->
target: qrLink
qr.cb.quote e
qr.quote qrLink
else
unless $ '#qr'
qr.dialog qrLink
@ -781,24 +777,26 @@ qr =
quote: (e) ->
e.preventDefault()
{target} = e
if dialog = $ '#qr'
qr.autohide.unset()
else
dialog = qr.dialog target
qr.quote e.target
id = target.textContent
text = ">>#{id}\n"
quote: (link) ->
if dialog = $ '#qr'
qr.autohide.unset()
else
dialog = qr.dialog link
selection = window.getSelection()
if s = selection.toString()
selectionID = $.x('preceding::input[@type="checkbox"][1]', selection.anchorNode)?.name
if selectionID == id
text += ">#{s}\n"
id = link.textContent
text = ">>#{id}\n"
ta = $ 'textarea', dialog
ta.focus()
ta.value += text
selection = window.getSelection()
if s = selection.toString()
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) ->
$('textarea', dialog).value = ''