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
// ==/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/
*
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
@ -3000,7 +3000,7 @@
return key;
},
qr: function(thread, quote) {
if (!(Conf['Quick Reply'] && QR.postingIsEnable)) {
if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
return;
}
QR.open();
@ -5823,8 +5823,8 @@
},
initReady: function() {
var link;
QR.postingIsEnable = !!$.id('postForm');
if (!QR.postingIsEnable) {
QR.postingIsEnabled = !!$.id('postForm');
if (!QR.postingIsEnabled) {
return;
}
link = $.el('a', {
@ -6105,19 +6105,18 @@
if (e != null) {
e.preventDefault();
}
if (!QR.postingIsEnable) {
if (!QR.postingIsEnabled) {
return;
}
text = "";
sel = d.getSelection();
selectionRoot = $.x('ancestor::div[contains(@class,"postContainer")][1]', sel.anchorNode);
post = Get.postFromNode(this);
OP = Get.contextFromLink(this).thread.OP;
text = ">>" + post + "\n";
if ((s = sel.toString().trim()) && post.nodes.root === selectionRoot) {
s = s.replace(/\n/g, '\n>');
text += ">" + s + "\n";
}
text = !text && post === OP && (!QR.nodes || QR.nodes.el.hidden) ? "" : ">>" + post + "\n" + text;
QR.open();
ta = QR.nodes.com;
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.
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.
Quoting the OP will not insert the >>opnumber anymore unless the QR was already opened.
Added thumbnailing support for Opera.
Image Expansion changes:

View File

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

View File

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