]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Fix upload buttons disabling 2519/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 22 Sep 2018 17:23:50 +0000 (20:23 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 22 Sep 2018 17:28:25 +0000 (20:28 +0300)
interface/index.html
interface/js/app/upload.js

index 0d6f950649bca015afe91de30c1dba6573813fac..6eebef1d4fcb8e22a52ef2bf47feb0af260c842d 100644 (file)
                                                        <form class="col-md-6">
                                                                <h5>Insert raw SPAM source:</h5>
                                                                <textarea class="col-md-5 upload-textarea" id="spamTextSource" value=""></textarea>
-                                                               <p><button class="btn btn-default pull-right" data-upload="spam"><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
+                                                               <p><button class="btn btn-default pull-right" data-upload="spam" disabled><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
                                                        </form>
                                                        <form class="col-md-6">
                                                                <h5>Insert raw HAM source:</h5>
                                                                <textarea class="col-md-5 upload-textarea" id="hamTextSource" value=""></textarea>
-                                                               <p><button class="btn btn-default pull-right" data-upload="ham"><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
+                                                               <p><button class="btn btn-default pull-right" data-upload="ham" disabled><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
                                                        </form>
                                                </div>
                                                <div class="row">
                                                                                <input id="fuzzyWeightText" class="slider" type="slider" value="1"/>
                                                                        </div>
                                                        </div>
-                                                               <p><button class="btn btn-default pull-right" data-upload="fuzzy"><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
+                                                               <p><button class="btn btn-default pull-right" data-upload="fuzzy" disabled><i class="glyphicon glyphicon-upload"></i> Upload text</button></p>
                                                        </form>
                                                </div>
                                        </div>
index 94659b7403d0e7e2042d844cc92abe0e1a03d0ef..f5a5cf73fbb5ba854e9da6d66d11c8595887374c 100644 (file)
@@ -149,12 +149,10 @@ define(["jquery"],
                 return e.options[e.selectedIndex].value;
             }
 
-            $("textarea").change(function () {
-                if ($(this).val().length !== "") {
-                    $(this).closest("form").find("button").removeAttr("disabled").removeClass("disabled");
-                } else {
-                    $(this).closest("form").find("button").attr("disabled").addClass("disabled");
-                }
+            $("textarea").keyup(function () {
+                var $this = $(this);
+                $this.closest("form").find("button")
+                    .prop("disabled", ($.trim($this.val()).length === 0));
             });
 
             $("#scanClean").on("click", function () {
@@ -174,7 +172,7 @@ define(["jquery"],
                         weight: $("#fuzzyWeightText").val()
                     }
                     : {};
-                if (data.length > 0) {
+                if ($.trim(data).length > 0) {
                     if (source === "scan") {
                         var checked_server = getSelector("selSrv");
                         var server = (checked_server === "All SERVERS") ? "local" : checked_server;