diff --git a/src/Posting/Captcha.cache.coffee b/src/Posting/Captcha.cache.coffee index b425dd91d..b4070b77c 100644 --- a/src/Posting/Captcha.cache.coffee +++ b/src/Posting/Captcha.cache.coffee @@ -14,7 +14,7 @@ Captcha.cache = not ( @haveCookie() or @captchas.length or QR.req or @submitCB ) and ( - QR.posts.length > 1 or Conf['Auto-load captcha'] or /^\s*[^\s>]/m.test(QR.posts[0].com or '') or QR.posts[0].file + QR.posts.length > 1 or Conf['Auto-load captcha'] or !QR.posts[0].isOnlyQuotes() or QR.posts[0].file ) needed: -> @@ -31,7 +31,7 @@ Captcha.cache = !QR.captcha.occupied() and QR.cooldown.seconds <= 60 and QR.selected is QR.posts[QR.posts.length - 1] and - /^\s*[^\s>]/m.test(QR.selected.com or '') + !QR.selected.isOnlyQuotes() ) isReply = (QR.selected.thread isnt 'new') if !$.event('RequestCaptcha', {isReply}) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index ba78eb764..af84016e7 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -329,6 +329,8 @@ QR = {com, thread} = QR.nodes thread.value = Get.threadFromNode @ unless com.value + wasOnlyQuotes = QR.selected.isOnlyQuotes() + caretPos = com.selectionStart # Replace selection for text. com.value = com.value[...caretPos] + text + com.value[com.selectionEnd..] @@ -337,6 +339,9 @@ QR = com.setSelectionRange range, range com.focus() + # This allows us to determine if any text other than quotes has been typed. + QR.selected.quotedText = com.value if wasOnlyQuotes + QR.selected.save com QR.selected.save thread @@ -654,6 +659,7 @@ QR = return post = QR.posts[0] + delete post.quotedText post.forceSave() threadID = post.thread thread = g.BOARD.threads.get(threadID) diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index d4cb4d8b4..8eab7d5e2 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -169,6 +169,9 @@ QR.post = class QR.captcha.moreNeeded() Captcha.cache.prerequest() + isOnlyQuotes: -> + (@com or '').trim() is (@quotedText or '').trim() + @rmErrored: (e) -> e.stopPropagation() for post in QR.posts by -1 when errors = post.errors