]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Update symbols score background on input 4723/head
authormoisseev <moiseev@mezonplus.ru>
Sun, 3 Dec 2023 16:59:17 +0000 (19:59 +0300)
committermoisseev <moiseev@mezonplus.ru>
Sun, 3 Dec 2023 16:59:17 +0000 (19:59 +0300)
interface/js/app/symbols.js

index fdc31f3e60008f313124bd5c7a78c7b75b923178..3db70456293683d0f4e36c42925f90022ea33219 100644 (file)
@@ -75,7 +75,7 @@ define(["jquery", "app/rspamd", "footable"],
                     } else if (item.weight > 0) {
                         label_class = "scorebar-spam";
                     }
-                    item.weight = '<input class="form-control input-sm mb-disabled ' + label_class +
+                    item.weight = '<input class="form-control input-sm mb-disabled scorebar ' + label_class +
                         '" data-role="numerictextbox" autocomplete="off" type="number" step="0.01" tabindex="1" ' +
                         'value="' + formatter.format(item.weight) + '" id="_sym_' + item.symbol + '"></input>';
                     if (!item.time) {
@@ -232,6 +232,15 @@ define(["jquery", "app/rspamd", "footable"],
                     const value = $(this).data("save");
                     if (!value) return;
                     saveSymbols("./savesymbols", "symbolsTable", value);
+                })
+                .on("input", ".scorebar", ({target}) => {
+                    const t = $(target);
+                    t.removeClass("scorebar-ham scorebar-spam");
+                    if (target.value < 0) {
+                        t.addClass("scorebar-ham");
+                    } else if (target.value > 0) {
+                        t.addClass("scorebar-spam");
+                    }
                 });
         };