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