]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Use type-safe equality operators
authorAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 11 Jul 2018 07:36:59 +0000 (10:36 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 11 Jul 2018 07:36:59 +0000 (10:36 +0300)
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/stats.js
interface/js/app/symbols.js
interface/js/app/upload.js

index 6a63500fc1befce860ae4b1b1a49267c1f8f7648..cce3c028c55a8456e5e90894b0adefebd43ea605 100644 (file)
@@ -189,7 +189,7 @@ define(["jquery", "d3evolution", "footable"],
                 }
 
                 graphs.graph.data(data);
-                if (unit != prevUnit) {
+                if (unit !== prevUnit) {
                     graphs.graph.yAxisLabel("Message rate, " + unit);
                     prevUnit = unit;
                 }
index 8147c39a1890b2846e52b8075c1f5a74dc98d2d9..6ee62c0ac9909f149ae60549b45108051f4e4456 100644 (file)
@@ -80,7 +80,7 @@ define(["jquery", "footable", "humanize"],
                     });
                     break;
                 default:
-                    if (typeof (item[prop]) == "string") {
+                    if (typeof (item[prop]) === "string") {
                         item[prop] = EscapeHTML(item[prop]);
                     }
                 }
index a074d47f82c9df9f5e7323c0bb9f607b853d138f..25e061783651f9660cd6748713acb239c8adf892 100644 (file)
@@ -66,13 +66,13 @@ define(["jquery", "d3pie", "humanize"],
 
             $.each(data, function (i, item) {
                 var widget = "";
-                if (i == "auth") {}
-                else if (i == "error") {}
-                else if (i == "version") {
+                if (i === "auth") {}
+                else if (i === "error") {}
+                else if (i === "version") {
                     widget = "<div class=\"left\"><strong>" + item + "</strong>" +
                     i + "</div>";
                     $(widget).appendTo(widgets);
-                } else if (i == "uptime") {
+                } else if (i === "uptime") {
                     widget = "<div class=\"right\"><strong>" + msToTime(item) +
                     "</strong>" + i + "</div>";
                     $(widget).appendTo(widgets);
@@ -80,17 +80,17 @@ define(["jquery", "d3pie", "humanize"],
                     var titleAtt = Humanize.intComma(item) + " " + i;
                     widget = "<li class=\"stat-box\"><div class=\"widget\" title=\"" + titleAtt + "\"><strong>" +
                     Humanize.compactInteger(item) + "</strong>" + i + "</div></li>";
-                    if (i == "scanned") {
+                    if (i === "scanned") {
                         stat_w[0] = widget;
-                    } else if (i == "clean") {
+                    } else if (i === "clean") {
                         stat_w[1] = widget;
-                    } else if (i == "greylist") {
+                    } else if (i === "greylist") {
                         stat_w[2] = widget;
-                    } else if (i == "probable") {
+                    } else if (i === "probable") {
                         stat_w[3] = widget;
-                    } else if (i == "reject") {
+                    } else if (i === "reject") {
                         stat_w[4] = widget;
-                    } else if (i == "learned") {
+                    } else if (i === "learned") {
                         stat_w[5] = widget;
                     }
                 }
@@ -127,7 +127,7 @@ define(["jquery", "d3pie", "humanize"],
 
                 $("#selSrv").append($("<option value=\"" + key + "\">" + key + "</option>"));
 
-                if (checked_server == key) {
+                if (checked_server === key) {
                     $("#clusterTable tbody [value=\"" + key + "\"]").prop("checked", true);
                     $("#selSrv [value=\"" + key + "\"]").prop("selected", true);
                 }
index a639127f4783388e91d70b8f93f8e50aab463c47..039983534042a70abf6abf7a563126b00f672583 100644 (file)
@@ -132,7 +132,7 @@ define(["jquery", "footable"],
                 return Number(a) < Number(b);
             }).reduce(function (f1, acc) {
                 return f1 + acc;
-            }) / (freqs.length != 0 ? freqs.length : 1.0);
+            }) / (freqs.length !== 0 ? freqs.length : 1.0);
             var mult = 1.0;
             var exp = 0.0;
 
@@ -258,7 +258,7 @@ define(["jquery", "footable"],
             $(document).on("click", "#symbolsTable :button", function () {
                 var value = $(this).data("save");
                 if (!value) return;
-                saveSymbols(rspamd, "./savesymbols", "symbolsTable", value == "cluster");
+                saveSymbols(rspamd, "./savesymbols", "symbolsTable", value === "cluster");
             });
         };
 
index 648ee3620a2076be786ab1f46e067c1df6b4528e..2926e62e2a47a32516c34c5695b115b11dc0824e 100644 (file)
@@ -37,7 +37,7 @@ define(["jquery"],
                 url = "learnspam";
             } else if (source === "ham") {
                 url = "learnham";
-            } else if (source == "fuzzy") {
+            } else if (source === "fuzzy") {
                 url = "fuzzyadd";
             } else if (source === "scan") {
                 url = "scan";
@@ -120,7 +120,7 @@ define(["jquery"],
                         var nsym = 0;
 
                         $.each(data.symbols, function (i, item) {
-                            if (typeof item == "object") {
+                            if (typeof item === "object") {
                                 var sym_id = "sym_" + nsym;
                                 if (item.description) {
                                     sym_desc[sym_id] = item.description;
@@ -191,7 +191,7 @@ define(["jquery"],
                 var data;
                 var headers = {};
                 data = $("#" + source + "TextSource").val();
-                if (source == "fuzzy") {
+                if (source === "fuzzy") {
                 // To access the proper
                     headers.flag = $("#fuzzyFlagText").val();
                     headers.weight = $("#fuzzyWeightText").val();
@@ -199,7 +199,7 @@ define(["jquery"],
                     data = $("#" + source + "TextSource").val();
                 }
                 if (data.length > 0) {
-                    if (source == "scan") {
+                    if (source === "scan") {
                         scanText(rspamd, data);
                     } else {
                         uploadText(rspamd, data, source, headers);