From 76ad2a3bb36cb6e96120f00c6a4751d9d3d31f61 Mon Sep 17 00:00:00 2001 From: pentargency Date: Tue, 10 May 2022 17:50:32 -0700 Subject: [PATCH 1/3] QR: If configured, don't repeat quote backlink if selection-quoting too --- src/Posting/QR.coffee | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 1e2911b4c..a183374b7 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -293,7 +293,8 @@ QR = {root} = post.nodes postRange = new Range() postRange.selectNode root - text = if post.board.ID is g.BOARD.ID then ">>#{post}\n" else ">>>/#{post.board}/#{post}\n" + quoteBacklink = if post.board.ID is g.BOARD.ID then ">>#{post}\n" else ">>>/#{post.board}/#{post}\n" + quoteText = "" for i in [0...sel.rangeCount] range = sel.getRangeAt i # Trim range to be fully inside post @@ -323,12 +324,20 @@ QR = for node in $$ '.embedder', frag $.rm node.previousSibling if node.previousSibling?.nodeValue is ' ' $.rm node - text += ">#{frag.textContent.trim()}\n" + quoteText = ">#{frag.textContent.trim()}\n" QR.openPost() {com, thread} = QR.nodes thread.value = Get.threadFromNode @ unless com.value + text = quoteBacklink + if quoteText != "" + alreadyQuoted = com.value.includes quoteBacklink + if !Conf['Avoid Duplicated Quotes'] or !alreadyQuoted + text = quoteBacklink + quoteText + else + text = quoteText + wasOnlyQuotes = QR.selected.isOnlyQuotes() caretPos = com.selectionStart From 8ea3957baf945f9fbe1a517dacd834ac6fbe1a73 Mon Sep 17 00:00:00 2001 From: pentargency Date: Tue, 10 May 2022 17:51:08 -0700 Subject: [PATCH 2/3] Config: Add option to avoid re-backlinking to post if quoting --- src/config/Config.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config/Config.coffee b/src/config/Config.coffee index 6f89a2f2d..c2c099bdb 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -612,6 +612,10 @@ Config = true 'Add option in header menu to thread conversations.' ] + 'Avoid Duplicated Quotes': [ + false + 'Avoid adding a duplicate instances of a given post number when quoting with selected text' + ] imageExpansion: 'Fit width': [ From 3fbd9179cb52d786941e97247d6d2ad929064abd Mon Sep 17 00:00:00 2001 From: pentargency Date: Tue, 10 May 2022 17:59:57 -0700 Subject: [PATCH 3/3] Config: Fix: description typo (sorry) --- src/config/Config.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/Config.coffee b/src/config/Config.coffee index c2c099bdb..4fe5cc7b5 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -614,7 +614,7 @@ Config = ] 'Avoid Duplicated Quotes': [ false - 'Avoid adding a duplicate instances of a given post number when quoting with selected text' + 'Avoid adding duplicate instances of a given post number when quoting with selected text' ] imageExpansion: