From 97087af42f2ba16370eb4f2cc6c4593929b850a7 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 2 Jul 2013 15:19:15 +0200 Subject: [PATCH] Simpler QR quoting code. --- src/Posting/QR.coffee | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 7362be864..a7d917a64 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -326,13 +326,10 @@ QR = e?.preventDefault() 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 + sel = d.getSelection() + post = Get.postFromNode @ + text = ">>#{post}\n" + if (s = sel.toString().trim()) and post is Get.postFromNode sel.anchorNode # XXX Opera doesn't retain `\n`s? s = s.replace /\n/g, '\n>' text += ">#{s}\n" @@ -344,7 +341,7 @@ QR = $.addClass QR.nodes.el, 'dump' QR.cooldown.auto = true {com, thread} = QR.nodes - thread.value = OP.ID unless com.value + thread.value = Get.contextFromLink(@).thread unless com.value caretPos = com.selectionStart # Replace selection for text.