Automatically calculate cooldown
This commit is contained in:
parent
d36dcc5352
commit
714d302cf9
|
@ -2111,9 +2111,7 @@ Channel.prototype.tryUpdateOptions = function(user, data) {
|
||||||
var s = parseFloat(data[key].sustained);
|
var s = parseFloat(data[key].sustained);
|
||||||
if (isNaN(s) || s <= 0)
|
if (isNaN(s) || s <= 0)
|
||||||
s = 1;
|
s = 1;
|
||||||
var c = parseFloat(data[key].cooldown);
|
var c = b / s;
|
||||||
if (isNaN(c) || c < 0)
|
|
||||||
c = 0;
|
|
||||||
this.opts.chat_antiflood_params.burst = b;
|
this.opts.chat_antiflood_params.burst = b;
|
||||||
this.opts.chat_antiflood_params.sustained = s;
|
this.opts.chat_antiflood_params.sustained = s;
|
||||||
this.opts.chat_antiflood_params.cooldown = c;
|
this.opts.chat_antiflood_params.cooldown = c;
|
||||||
|
|
|
@ -81,8 +81,7 @@
|
||||||
chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
|
chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
|
||||||
chat_antiflood_params: {
|
chat_antiflood_params: {
|
||||||
burst: $("#opt_chat_antiflood_burst").val(),
|
burst: $("#opt_chat_antiflood_burst").val(),
|
||||||
sustained: $("#opt_chat_antiflood_sustained").val(),
|
sustained: $("#opt_chat_antiflood_sustained").val()
|
||||||
cooldown: $("#opt_chat_antiflood_cooldown").val()
|
|
||||||
},
|
},
|
||||||
show_public: $("#opt_show_public").prop("checked"),
|
show_public: $("#opt_show_public").prop("checked"),
|
||||||
enable_link_regex: $("#opt_enable_link_regex").prop("checked"),
|
enable_link_regex: $("#opt_enable_link_regex").prop("checked"),
|
||||||
|
|
|
@ -1012,7 +1012,6 @@ function handleModPermissions() {
|
||||||
$("#opt_chat_antiflood").prop("checked", CHANNEL.opts.chat_antiflood);
|
$("#opt_chat_antiflood").prop("checked", CHANNEL.opts.chat_antiflood);
|
||||||
$("#opt_chat_antiflood_burst").val(CHANNEL.opts.chat_antiflood_params.burst);
|
$("#opt_chat_antiflood_burst").val(CHANNEL.opts.chat_antiflood_params.burst);
|
||||||
$("#opt_chat_antiflood_sustained").val(CHANNEL.opts.chat_antiflood_params.sustained);
|
$("#opt_chat_antiflood_sustained").val(CHANNEL.opts.chat_antiflood_params.sustained);
|
||||||
$("#opt_chat_antiflood_cooldown").val(CHANNEL.opts.chat_antiflood_params.cooldown);
|
|
||||||
$("#opt_show_public").prop("checked", CHANNEL.opts.show_public);
|
$("#opt_show_public").prop("checked", CHANNEL.opts.show_public);
|
||||||
$("#opt_show_public").attr("disabled", CLIENT.rank < 3);
|
$("#opt_show_public").attr("disabled", CLIENT.rank < 3);
|
||||||
$("#opt_enable_link_regex").prop("checked", CHANNEL.opts.enable_link_regex);
|
$("#opt_enable_link_regex").prop("checked", CHANNEL.opts.enable_link_regex);
|
||||||
|
|
|
@ -43,13 +43,6 @@
|
||||||
<input type="text" id="opt_chat_antiflood_sustained">
|
<input type="text" id="opt_chat_antiflood_sustained">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- chat flood cooldown -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label" for="opt_chat_antiflood_cooldown" title="The number of seconds since the last message before someone can burst again">Cooldown time after being throttled (seconds)</label>
|
|
||||||
<div class="controls">
|
|
||||||
<input type="text" id="opt_chat_antiflood_cooldown">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- convert URLs to links -->
|
<!-- convert URLs to links -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="opt_enable_link_regex">Convert URLs in chat to links</label>
|
<label class="control-label" for="opt_enable_link_regex">Convert URLs in chat to links</label>
|
||||||
|
|
Loading…
Reference in a new issue