Revert "Close #772."

This reverts commit 859c5db1f089f7ece73a3706e94b7ef4262cf72b.
This commit is contained in:
Nicolas Stepien 2013-03-08 17:52:07 +01:00
parent f34aaca331
commit c02991ef4a
4 changed files with 11 additions and 19 deletions

View File

@ -20,7 +20,7 @@
// @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7 // @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7
// ==/UserScript== // ==/UserScript==
/* 4chan X Beta - Version 3.0.0 - 2013-03-07 /* 4chan X Beta - Version 3.0.0 - 2013-03-08
* http://mayhemydg.github.com/4chan-x/ * http://mayhemydg.github.com/4chan-x/
* *
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com> * Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
@ -3000,7 +3000,7 @@
return key; return key;
}, },
qr: function(thread, quote) { qr: function(thread, quote) {
if (!(Conf['Quick Reply'] && QR.postingIsEnable)) { if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
return; return;
} }
QR.open(); QR.open();
@ -5823,8 +5823,8 @@
}, },
initReady: function() { initReady: function() {
var link; var link;
QR.postingIsEnable = !!$.id('postForm'); QR.postingIsEnabled = !!$.id('postForm');
if (!QR.postingIsEnable) { if (!QR.postingIsEnabled) {
return; return;
} }
link = $.el('a', { link = $.el('a', {
@ -6105,19 +6105,18 @@
if (e != null) { if (e != null) {
e.preventDefault(); e.preventDefault();
} }
if (!QR.postingIsEnable) { if (!QR.postingIsEnabled) {
return; return;
} }
text = "";
sel = d.getSelection(); sel = d.getSelection();
selectionRoot = $.x('ancestor::div[contains(@class,"postContainer")][1]', sel.anchorNode); selectionRoot = $.x('ancestor::div[contains(@class,"postContainer")][1]', sel.anchorNode);
post = Get.postFromNode(this); post = Get.postFromNode(this);
OP = Get.contextFromLink(this).thread.OP; OP = Get.contextFromLink(this).thread.OP;
text = ">>" + post + "\n";
if ((s = sel.toString().trim()) && post.nodes.root === selectionRoot) { if ((s = sel.toString().trim()) && post.nodes.root === selectionRoot) {
s = s.replace(/\n/g, '\n>'); s = s.replace(/\n/g, '\n>');
text += ">" + s + "\n"; text += ">" + s + "\n";
} }
text = !text && post === OP && (!QR.nodes || QR.nodes.el.hidden) ? "" : ">>" + post + "\n" + text;
QR.open(); QR.open();
ta = QR.nodes.com; ta = QR.nodes.com;
if (!ta.value) { if (!ta.value) {

View File

@ -24,7 +24,6 @@ beta
Closing the QR while uploading will abort the upload and won't close the QR anymore. Closing the QR while uploading will abort the upload and won't close the QR anymore.
Creating threads outside of the index is now possible. Creating threads outside of the index is now possible.
Selection-to-quote also applies to selected text inside the post, not just inside the comment. Selection-to-quote also applies to selected text inside the post, not just inside the comment.
Quoting the OP will not insert the >>opnumber anymore unless the QR was already opened.
Added thumbnailing support for Opera. Added thumbnailing support for Opera.
Image Expansion changes: Image Expansion changes:

View File

@ -1662,7 +1662,7 @@ Keybinds =
key key
qr: (thread, quote) -> qr: (thread, quote) ->
return unless Conf['Quick Reply'] and QR.postingIsEnable return unless Conf['Quick Reply'] and QR.postingIsEnabled
QR.open() QR.open()
if quote if quote
QR.quote.call $ 'input', $('.post.highlight', thread) or thread QR.quote.call $ 'input', $('.post.highlight', thread) or thread

View File

@ -15,8 +15,8 @@ QR =
cb: @node cb: @node
initReady: -> initReady: ->
QR.postingIsEnable = !!$.id 'postForm' QR.postingIsEnabled = !!$.id 'postForm'
return unless QR.postingIsEnable return unless QR.postingIsEnabled
link = $.el 'a', link = $.el 'a',
className: 'qr-shortcut' className: 'qr-shortcut'
@ -250,25 +250,19 @@ QR =
quote: (e) -> quote: (e) ->
e?.preventDefault() e?.preventDefault()
return unless QR.postingIsEnable return unless QR.postingIsEnabled
text = ""
sel = d.getSelection() sel = d.getSelection()
selectionRoot = $.x 'ancestor::div[contains(@class,"postContainer")][1]', sel.anchorNode selectionRoot = $.x 'ancestor::div[contains(@class,"postContainer")][1]', sel.anchorNode
post = Get.postFromNode @ post = Get.postFromNode @
{OP} = Get.contextFromLink(@).thread {OP} = Get.contextFromLink(@).thread
text = ">>#{post}\n"
if (s = sel.toString().trim()) and post.nodes.root is selectionRoot if (s = sel.toString().trim()) and post.nodes.root is selectionRoot
# XXX Opera doesn't retain `\n`s? # XXX Opera doesn't retain `\n`s?
s = s.replace /\n/g, '\n>' s = s.replace /\n/g, '\n>'
text += ">#{s}\n" text += ">#{s}\n"
text = if !text and post is OP and (!QR.nodes or QR.nodes.el.hidden)
# Don't quote the OP unless the QR was already opened once.
""
else
">>#{post}\n#{text}"
QR.open() QR.open()
ta = QR.nodes.com ta = QR.nodes.com
QR.nodes.thread.value = OP.ID unless ta.value QR.nodes.thread.value = OP.ID unless ta.value