From 8f3879c9bd5d1cfc57fd5283fc961097c20c8a32 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 28 Mar 2016 02:16:23 -0700 Subject: [PATCH] ASCII-compatible upvotes. --- src/Quotelinks/Upvotes.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Quotelinks/Upvotes.coffee b/src/Quotelinks/Upvotes.coffee index 5f0d2307c..433c8454b 100644 --- a/src/Quotelinks/Upvotes.coffee +++ b/src/Quotelinks/Upvotes.coffee @@ -1,10 +1,11 @@ Upvotes = - text: '\u305D\u3046\u3060\u306D' count: {} + text: '\u305D\u3046\u3060\u306D' + regexp: /(?:^>.*\n)+\s*(?:\u305D\u3046\u3060\u306D|this)/gmi init: -> return unless g.VIEW is 'thread' and Conf['Upvotes'] - @regexp = new RegExp "(?:^>.*\\n)+\\s*#{@text}", 'gm' + @textPosted = if g.BOARD.ID is 'r9k' then 'This.' else @text Post.callbacks.push name: 'Upvotes' cb: @node @@ -46,7 +47,7 @@ Upvotes = return unless QR.postingIsEnabled QR.quote.call @ {com} = QR.nodes - text = "#{Upvotes.text}\n" + text = "#{Upvotes.textPosted}\n" pos = com.selectionStart com.value = com.value[..pos] + text + com.value[pos...] pos += text.length