diff options
Diffstat (limited to 'interface/js/app/rspamd.js')
-rw-r--r-- | interface/js/app/rspamd.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index cb7fb8ace..4b154c2ae 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -198,6 +198,8 @@ define(["jquery", "app/common", "stickytabs", "visibility", $(".preset").hide(); $(".history").show(); $(".dynamic").hide(); + + module.updateHistoryControlsState(); }); break; case "#disconnect": @@ -348,6 +350,8 @@ define(["jquery", "app/common", "stickytabs", "visibility", let selected_locale = null; let custom_locale = null; const localeTextbox = ".popover #settings-popover #locale"; + const historyCountDef = 1000; + const historyCountSelector = ".popover #settings-popover #settings-history-count"; function validateLocale(saveToLocalStorage) { function toggle_form_group_class(remove, add) { @@ -406,6 +410,8 @@ define(["jquery", "app/common", "stickytabs", "visibility", $(localeTextbox).val(custom_locale); ajaxSetup(localStorage.getItem("ajax_timeout"), true); + + $(historyCountSelector).val(parseInt(localStorage.getItem("historyCount"), 10) || historyCountDef); }); $(document).on("change", '.popover #settings-popover input:radio[name="locale"]', function () { selected_locale = this.value; @@ -423,6 +429,21 @@ define(["jquery", "app/common", "stickytabs", "visibility", ajaxSetup(null, true, true); }); + $(document).on("input", historyCountSelector, (e) => { + const v = parseInt($(e.currentTarget).val(), 10); + if (v > 0) { + localStorage.setItem("historyCount", v); + $(e.currentTarget).removeClass("is-invalid"); + $("#history-count").val(v).trigger("change"); + } else { + $(e.currentTarget).addClass("is-invalid"); + } + }); + $(document).on("click", ".popover #settings-popover #settings-history-count-restore", () => { + localStorage.removeItem("historyCount"); + $(historyCountSelector).val(historyCountDef); + }); + // Dismiss Bootstrap popover by clicking outside $("body").on("click", (e) => { $(".popover").each(function () { |