diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-23 11:56:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-23 11:56:39 +0100 |
commit | 10e4685c095e247408eddbf7de3dcf0585422ca7 (patch) | |
tree | 25d4cd3c23d4a7c2a57fe8012887e0623cfb9deb | |
parent | deb48a8b7c86cc0311d83d01e4e129cdfceab492 (diff) | |
parent | 7515ed4a1692ca5d64985505781fd3e2b46c9294 (diff) | |
download | rspamd-10e4685c095e247408eddbf7de3dcf0585422ca7.tar.gz rspamd-10e4685c095e247408eddbf7de3dcf0585422ca7.zip |
Merge pull request #2519 from moisseev/eslint
[WebUI] Fix upload buttons disabling
-rw-r--r-- | .eslintrc.json | 3 | ||||
-rw-r--r-- | interface/index.html | 6 | ||||
-rw-r--r-- | interface/js/app/history.js | 2 | ||||
-rw-r--r-- | interface/js/app/symbols.js | 4 | ||||
-rw-r--r-- | interface/js/app/upload.js | 12 |
5 files changed, 14 insertions, 13 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index ccd26cc74..6af989a1f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -57,7 +57,6 @@ // Temporarily disabled rules "array-element-newline": "off", - "consistent-this": "off", "func-style": "off", "function-paren-newline": "off", "line-comment-position": "off", @@ -66,8 +65,6 @@ "max-lines-per-function": "off", "no-inline-comments": "off", "no-invalid-this": "off", - "no-underscore-dangle": "off", - "one-var-declaration-per-line": "off", "sort-keys": "off", "sort-vars": "off" } 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/history.js b/interface/js/app/history.js index 68e66924e..f82925b26 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -511,6 +511,7 @@ define(["jquery", "footable", "humanize"], } function initHistoryTable(rspamd, tables, data, items) { + /* eslint-disable consistent-this, no-underscore-dangle, one-var-declaration-per-line */ FooTable.actionFilter = FooTable.Filtering.extend({ construct: function (instance) { this._super(instance); @@ -568,6 +569,7 @@ define(["jquery", "footable", "humanize"], } } }); + /* eslint-enable consistent-this, no-underscore-dangle, one-var-declaration-per-line */ tables.history = FooTable.init("#historyTable", { columns: get_history_columns(data), diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index 327fb3bf2..866478b1b 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -148,6 +148,8 @@ define(["jquery", "footable"], success: function (json) { var data = json[0].data; var items = process_symbols_data(data); + + /* eslint-disable consistent-this, no-underscore-dangle, one-var-declaration-per-line */ FooTable.groupFilter = FooTable.Filtering.extend({ construct: function (instance) { this._super(instance); @@ -196,6 +198,8 @@ define(["jquery", "footable"], } } }); + /* eslint-enable consistent-this, no-underscore-dangle, one-var-declaration-per-line */ + tables.symbols = FooTable.init("#symbolsTable", { columns: [ {sorted:true, direction:"ASC", name:"group", title:"Group", style:{"font-size":"11px"}}, 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; |