add ?cooldown on index, rm sage from cooldown
This commit is contained in:
parent
01592ae8d7
commit
b2c789a46c
@ -1158,9 +1158,9 @@
|
||||
};
|
||||
cooldown = {
|
||||
init: function() {
|
||||
var form, input, time, _, _ref;
|
||||
if (/cooldown/.test(location.search)) {
|
||||
_ref = location.search.match(/cooldown=(\d+)/), _ = _ref[0], time = _ref[1];
|
||||
var form, match, time, _;
|
||||
if (match = location.search.match(/cooldown=(\d+)/)) {
|
||||
_ = match[0], time = match[1];
|
||||
if ($.getValue(g.BOARD + '/cooldown', 0) < time) {
|
||||
$.setValue(g.BOARD + '/cooldown', time);
|
||||
}
|
||||
@ -1173,26 +1173,8 @@
|
||||
return cooldown.start();
|
||||
}
|
||||
});
|
||||
if (g.REPLY) {
|
||||
form = $('.postarea form');
|
||||
form.action += '?cooldown';
|
||||
input = $('.postarea input[name=email]');
|
||||
if (/sage/i.test(input.value)) {
|
||||
form.action += '?sage';
|
||||
}
|
||||
return $.bind(input, 'keyup', cooldown.sage);
|
||||
}
|
||||
},
|
||||
sage: function() {
|
||||
var form;
|
||||
form = $('.postarea form');
|
||||
if (/sage/i.test(this.value)) {
|
||||
if (!/sage/.test(form.action)) {
|
||||
return form.action += '?sage';
|
||||
}
|
||||
} else {
|
||||
return form.action = form.action.replace('?sage', '');
|
||||
}
|
||||
return form.action += '?cooldown';
|
||||
},
|
||||
start: function() {
|
||||
var submit, _i, _len, _ref;
|
||||
|
||||
@ -923,27 +923,14 @@ options =
|
||||
|
||||
cooldown =
|
||||
init: ->
|
||||
if /cooldown/.test location.search
|
||||
[_, time] = location.search.match /cooldown=(\d+)/
|
||||
if match = location.search.match /cooldown=(\d+)/
|
||||
[_, time] = match
|
||||
$.setValue g.BOARD+'/cooldown', time if $.getValue(g.BOARD+'/cooldown', 0) < time
|
||||
cooldown.start() if Date.now() < $.getValue g.BOARD+'/cooldown', 0
|
||||
$.bind window, 'storage', (e) -> cooldown.start() if e.key is "#{NAMESPACE}#{g.BOARD}/cooldown"
|
||||
|
||||
if g.REPLY
|
||||
form = $('.postarea form')
|
||||
form.action += '?cooldown'
|
||||
input = $('.postarea input[name=email]')
|
||||
if /sage/i.test input.value
|
||||
form.action += '?sage'
|
||||
$.bind input, 'keyup', cooldown.sage
|
||||
|
||||
sage: ->
|
||||
form = $('.postarea form')
|
||||
if /sage/i.test @value
|
||||
unless /sage/.test form.action
|
||||
form.action += '?sage'
|
||||
else
|
||||
form.action = form.action.replace '?sage', ''
|
||||
form.action += '?cooldown'
|
||||
|
||||
start: ->
|
||||
cooldown.duration = Math.ceil ($.getValue(g.BOARD+'/cooldown', 0) - Date.now()) / 1000
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user