From 5ce349fee1d84b1db3b7de27f2993b7f7bc6b2e2 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 2 May 2011 23:05:53 -0700 Subject: [PATCH] make cooldown optional, disabled by default --- 4chan_x.js | 31 +++++++++++++++++++------------ script.coffee | 30 +++++++++++++++++------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 7c31493d5..7044f887a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -72,6 +72,7 @@ 'Anonymize': [false, 'Make everybody anonymous'], 'Auto Watch': [true, 'Automatically watch threads that you start'], 'Comment Expansion': [true, 'Expand too long comments'], + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Expansion': [true, 'Expand images'], 'Image Hover': [false, 'Show full image on mouseover'], @@ -1000,7 +1001,9 @@ $.remove(dialog); } } - qr.cooldown(true); + if ($.config('Cooldown')) { + qr.cooldown(true); + } } Recaptcha.reload(); return $('iframe[name=iframe]').src = 'about:blank'; @@ -1024,17 +1027,19 @@ $.remove(span); } } - if (qr.cooldown()) { - e.preventDefault(); - alert('Stop posting so often!'); - if (isQR) { - span = $.el('span', { - className: 'error', - textContent: 'Stop posting so often!' - }); - $.append(this.parentNode, span); + if ($.config('Cooldown')) { + if (qr.cooldown()) { + e.preventDefault(); + alert('Stop posting so often!'); + if (isQR) { + span = $.el('span', { + className: 'error', + textContent: 'Stop posting so often!' + }); + $.append(this.parentNode, span); + } + return; } - return; } recaptcha = $('input[name=recaptcha_response_field]', this); if (recaptcha.value) { @@ -2125,7 +2130,9 @@ $.addStyle(main.css); Recaptcha.init(); $.bind($('form[name=post]'), 'submit', qr.cb.submit); - qr.cooldown(); + if ($.config('Cooldown')) { + qr.cooldown(); + } if ($.config('Image Expansion')) { imgExpand.init(); } diff --git a/script.coffee b/script.coffee index 7184e4709..02e591a7b 100644 --- a/script.coffee +++ b/script.coffee @@ -16,6 +16,7 @@ config = 'Anonymize': [false, 'Make everybody anonymous'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Comment Expansion': [true, 'Expand too long comments'] + 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Expansion': [true, 'Expand images'] 'Image Hover': [false, 'Show full image on mouseover'] @@ -754,7 +755,8 @@ qr = qr.refresh dialog else $.remove dialog - qr.cooldown true + if $.config 'Cooldown' + qr.cooldown true Recaptcha.reload() $('iframe[name=iframe]').src = 'about:blank' @@ -772,18 +774,19 @@ qr = if span = @nextSibling $.remove span - # check if we've posted on this board in another tab - if qr.cooldown() - e.preventDefault() - alert 'Stop posting so often!' + if $.config 'Cooldown' + # check if we've posted on this board in another tab + if qr.cooldown() + e.preventDefault() + alert 'Stop posting so often!' - if isQR - span = $.el 'span', - className: 'error' - textContent: 'Stop posting so often!' - $.append @parentNode, span + if isQR + span = $.el 'span', + className: 'error' + textContent: 'Stop posting so often!' + $.append @parentNode, span - return + return recaptcha = $('input[name=recaptcha_response_field]', this) if recaptcha.value @@ -1639,9 +1642,10 @@ main = $.bind $('form[name=post]'), 'submit', qr.cb.submit - qr.cooldown() - #major features + if $.config 'Cooldown' + qr.cooldown() + if $.config 'Image Expansion' imgExpand.init()