commit d719f68: [WebUI] Update symbols score background on input

moisseev moiseev at mezonplus.ru
Mon Jul 29 17:49:34 UTC 2024


Author: moisseev
Date: 2023-12-03 19:59:17 +0300
URL: https://github.com/rspamd/rspamd/commit/d719f6821b4ce75f15bcd5bdd9921c86acbd1207 (refs/pull/4723/head)

[WebUI] Update symbols score background on input

---
 interface/js/app/symbols.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js
index fdc31f3e6..3db704562 100644
--- a/interface/js/app/symbols.js
+++ b/interface/js/app/symbols.js
@@ -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");
+                    }
                 });
         };
 


More information about the Commits mailing list