board cooldown

This commit is contained in:
James Campos 2011-03-30 16:01:02 -07:00
parent 094ea7dcd7
commit bd770b1246
2 changed files with 28 additions and 2 deletions

View File

@ -990,6 +990,7 @@
$.remove(dialog);
}
}
g.seconds = g.sage ? 60 : 30;
qr.cooldownStart();
} else {
error = $.el('span', {
@ -1016,6 +1017,17 @@
if (span = this.nextSibling) {
$.remove(span);
}
if (g.seconds = GM_getValue('seconds')) {
e.preventDefault();
span = $.el('span', {
className: 'error',
textContent: 'Stop posting so often!'
});
$.append(this.parentNode, span);
alert('Stop posting so often!');
qr.cooldownStart();
return;
}
recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) {
qr.autohide.set();
@ -1070,6 +1082,7 @@
submit.value = 'Submit';
} else {
submit.value = g.seconds = g.seconds - 1;
GM_setValue('seconds', g.seconds);
}
}
if (g.seconds !== 0) {
@ -1078,7 +1091,7 @@
},
cooldownStart: function() {
var submit, submits, _i, _len;
g.seconds = g.sage ? 60 : 30;
GM_setValue('seconds', g.seconds);
submits = $$('#qr input[type=submit], form[name=post] input[type=submit]');
for (_i = 0, _len = submits.length; _i < _len; _i++) {
submit = submits[_i];

View File

@ -730,6 +730,7 @@ qr =
qr.refresh dialog
else
$.remove dialog
g.seconds = if g.sage then 60 else 30
qr.cooldownStart()
else
error = $.el 'span',
@ -748,6 +749,17 @@ qr =
submit: (e) ->
if span = @nextSibling
$.remove span
if g.seconds = GM_getValue 'seconds'
e.preventDefault()
span = $.el 'span',
className: 'error'
textContent: 'Stop posting so often!'
$.append @parentNode, span
alert 'Stop posting so often!'
qr.cooldownStart()
return
recaptcha = $('input[name=recaptcha_response_field]', this)
if recaptcha.value
qr.autohide.set()
@ -796,12 +808,13 @@ qr =
submit.value = 'Submit'
else
submit.value = g.seconds = g.seconds - 1
GM_setValue 'seconds', g.seconds
if g.seconds != 0
window.setTimeout qr.cooldown, 1000
cooldownStart: ->
g.seconds = if g.sage then 60 else 30
GM_setValue 'seconds', g.seconds
submits = $$ '#qr input[type=submit], form[name=post] input[type=submit]'
for submit in submits
submit.value = g.seconds