commit 85c8368: [Minor] WebUI: enable scan button on page load

moisseev moiseev at mezonplus.ru
Sat Aug 31 08:56:04 UTC 2019


Author: moisseev
Date: 2019-08-31 11:20:26 +0300
URL: https://github.com/rspamd/rspamd/commit/85c8368a2b41be577a2c626204c3238e8105d0b1 (refs/pull/3024/head)

[Minor] WebUI: enable scan button on page load
if the text area is non-empty

---
 interface/js/app/upload.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js
index 0a0640c51..39a86fd69 100644
--- a/interface/js/app/upload.js
+++ b/interface/js/app/upload.js
@@ -195,12 +195,15 @@ define(["jquery"],
                 rspamd.destroyTable("scan");
                 rspamd.symbols.scan.length = 0;
             });
-            $("#scan button").attr("disabled", true);
+
+            function enable_disable_scan_btn() {
+                $("#scan button").prop("disabled", ($.trim($("textarea").val()).length === 0));
+            }
+            enable_disable_scan_btn();
             $("textarea").on("input", function () {
-                var $this = $(this);
-                $("#scan button")
-                    .prop("disabled", ($.trim($this.val()).length === 0));
+                enable_disable_scan_btn();
             });
+
             $("#scanClean").on("click", function () {
                 $("#scan button").attr("disabled", true);
                 $("#scanMsgSource").val("");


More information about the Commits mailing list