aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-09-22 20:23:50 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-09-22 20:28:25 +0300
commit7515ed4a1692ca5d64985505781fd3e2b46c9294 (patch)
tree8f5617be0d7bea39bb27c55797d4d9c7a942eed9 /interface
parenta9ef733f69c24eba8599c85a5486637d3bda4317 (diff)
downloadrspamd-7515ed4a1692ca5d64985505781fd3e2b46c9294.tar.gz
rspamd-7515ed4a1692ca5d64985505781fd3e2b46c9294.zip
[WebUI] Fix upload buttons disabling
Diffstat (limited to 'interface')
-rw-r--r--interface/index.html6
-rw-r--r--interface/js/app/upload.js12
2 files changed, 8 insertions, 10 deletions
diff --git a/interface/index.html b/interface/index.html
index 0d6f95064..6eebef1d4 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -212,12 +212,12 @@
<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">
@@ -240,7 +240,7 @@
<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>
diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js
index 94659b740..f5a5cf73f 100644
--- a/interface/js/app/upload.js
+++ b/interface/js/app/upload.js
@@ -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;