make cooldown optional, disabled by default

This commit is contained in:
James Campos 2011-05-02 23:05:53 -07:00
parent a88553e4a2
commit 5ce349fee1
2 changed files with 36 additions and 25 deletions

View File

@ -72,6 +72,7 @@
'Anonymize': [false, 'Make everybody anonymous'], 'Anonymize': [false, 'Make everybody anonymous'],
'Auto Watch': [true, 'Automatically watch threads that you start'], 'Auto Watch': [true, 'Automatically watch threads that you start'],
'Comment Expansion': [true, 'Expand too long comments'], 'Comment Expansion': [true, 'Expand too long comments'],
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'],
'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'],
'Image Expansion': [true, 'Expand images'], 'Image Expansion': [true, 'Expand images'],
'Image Hover': [false, 'Show full image on mouseover'], 'Image Hover': [false, 'Show full image on mouseover'],
@ -1000,8 +1001,10 @@
$.remove(dialog); $.remove(dialog);
} }
} }
if ($.config('Cooldown')) {
qr.cooldown(true); qr.cooldown(true);
} }
}
Recaptcha.reload(); Recaptcha.reload();
return $('iframe[name=iframe]').src = 'about:blank'; return $('iframe[name=iframe]').src = 'about:blank';
}, },
@ -1024,6 +1027,7 @@
$.remove(span); $.remove(span);
} }
} }
if ($.config('Cooldown')) {
if (qr.cooldown()) { if (qr.cooldown()) {
e.preventDefault(); e.preventDefault();
alert('Stop posting so often!'); alert('Stop posting so often!');
@ -1036,6 +1040,7 @@
} }
return; return;
} }
}
recaptcha = $('input[name=recaptcha_response_field]', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) { if (recaptcha.value) {
qr.sage = $('input[name=email]', form).value === 'sage'; qr.sage = $('input[name=email]', form).value === 'sage';
@ -2125,7 +2130,9 @@
$.addStyle(main.css); $.addStyle(main.css);
Recaptcha.init(); Recaptcha.init();
$.bind($('form[name=post]'), 'submit', qr.cb.submit); $.bind($('form[name=post]'), 'submit', qr.cb.submit);
if ($.config('Cooldown')) {
qr.cooldown(); qr.cooldown();
}
if ($.config('Image Expansion')) { if ($.config('Image Expansion')) {
imgExpand.init(); imgExpand.init();
} }

View File

@ -16,6 +16,7 @@ config =
'Anonymize': [false, 'Make everybody anonymous'] 'Anonymize': [false, 'Make everybody anonymous']
'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch': [true, 'Automatically watch threads that you start']
'Comment Expansion': [true, 'Expand too long comments'] 'Comment Expansion': [true, 'Expand too long comments']
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)']
'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Auto-Gif': [false, 'Animate gif thumbnails']
'Image Expansion': [true, 'Expand images'] 'Image Expansion': [true, 'Expand images']
'Image Hover': [false, 'Show full image on mouseover'] 'Image Hover': [false, 'Show full image on mouseover']
@ -754,6 +755,7 @@ qr =
qr.refresh dialog qr.refresh dialog
else else
$.remove dialog $.remove dialog
if $.config 'Cooldown'
qr.cooldown true qr.cooldown true
Recaptcha.reload() Recaptcha.reload()
@ -772,6 +774,7 @@ qr =
if span = @nextSibling if span = @nextSibling
$.remove span $.remove span
if $.config 'Cooldown'
# check if we've posted on this board in another tab # check if we've posted on this board in another tab
if qr.cooldown() if qr.cooldown()
e.preventDefault() e.preventDefault()
@ -1639,9 +1642,10 @@ main =
$.bind $('form[name=post]'), 'submit', qr.cb.submit $.bind $('form[name=post]'), 'submit', qr.cb.submit
#major features
if $.config 'Cooldown'
qr.cooldown() qr.cooldown()
#major features
if $.config 'Image Expansion' if $.config 'Image Expansion'
imgExpand.init() imgExpand.init()