diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-15 18:09:47 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-15 18:09:47 +0300 |
commit | 458642949a14fdabe5c85696f1ee23d50695d07f (patch) | |
tree | 2e3120d0bfbfb53dc4e88980d51774c6244b0af2 /interface | |
parent | e5a73f26fd6cc2c98c53d06cc5998a913da03cc1 (diff) | |
download | rspamd-458642949a14fdabe5c85696f1ee23d50695d07f.tar.gz rspamd-458642949a14fdabe5c85696f1ee23d50695d07f.zip |
[Minor] Initialize variables at declaration
Diffstat (limited to 'interface')
-rw-r--r-- | interface/js/app/config.js | 11 | ||||
-rw-r--r-- | interface/js/app/history.js | 13 | ||||
-rw-r--r-- | interface/js/app/rspamd.js | 2 | ||||
-rw-r--r-- | interface/js/app/stats.js | 2 | ||||
-rw-r--r-- | interface/js/app/upload.js | 2 |
5 files changed, 12 insertions, 18 deletions
diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 2f87525fa..ee950f023 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -47,7 +47,7 @@ define(["jquery"], var items = []; $.each(data[0].data, function (i, item) { var idx = -1; - var label; + var label = null; if (item.action === "greylist") { label = "Greylist"; idx = 0; @@ -145,12 +145,9 @@ define(["jquery"], var $tbody = $("<tbody>"); $.each(data, function (i, item) { - var label; - if ((item.editable === false || rspamd.read_only)) { - label = "<span class=\"label label-default\">Read</span>"; - } else { - label = "<span class=\"label label-default\">Read</span> <span class=\"label label-success\">Write</span>"; - } + var label = ((item.editable === false || rspamd.read_only)) + ? "<span class=\"label label-default\">Read</span>" + : "<span class=\"label label-default\">Read</span> <span class=\"label label-success\">Write</span>"; var $tr = $("<tr>"); $("<td class=\"col-md-2 maps-cell\">" + label + "</td>").appendTo($tr); var $span = $("<span class=\"map-link\" data-toggle=\"modal\" data-target=\"#modalDialog\">" + item.uri + "</span>").data("item", item); diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 48f2220fe..16d4b49d2 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -30,7 +30,7 @@ define(["jquery", "footable", "humanize"], var rows_per_page = 25; var ui = {}; - var prevVersion; + var prevVersion = null; var htmlEscapes = { "&": "&", "<": "<", @@ -99,12 +99,9 @@ define(["jquery", "footable", "humanize"], item.action = "<div style='font-size:11px' class='label label-info'>" + item.action + "</div>"; } - var score_content; - if (item.score < item.required_score) { - score_content = "<span class='text-success'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>"; - } else { - score_content = "<span class='text-danger'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>"; - } + var score_content = (item.score < item.required_score) + ? "<span class='text-success'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>" + : "<span class='text-danger'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>"; item.score = { options: { @@ -159,7 +156,7 @@ define(["jquery", "footable", "humanize"], preprocess_item(item); Object.keys(item.symbols).map(function (key) { - var str; + var str = null; var sym = item.symbols[key]; if (sym.description) { diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 5ade66ce4..1e41afaaf 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -38,7 +38,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config, var checked_server = "All SERVERS"; var ui = {}; var timer_id = []; - var selData; // Graph's dataset selector state + var selData = null; // Graph's dataset selector state NProgress.configure({ minimum: 0.01, diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index ea8edfd8a..51e41d788 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -34,7 +34,7 @@ define(["jquery", "d3pie", "humanize"], var hours = seconds % 31536000 % 2628000 % 86400 / 3600 >> 0; var minutes = seconds % 31536000 % 2628000 % 86400 % 3600 / 60 >> 0; /* eslint-enable no-bitwise */ - var out; + var out = null; if (years > 0) { if (months > 0) { out = years + "yr " + months + "mth"; diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index e542667a6..927501248 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -33,7 +33,7 @@ define(["jquery"], // @upload text function uploadText(rspamd, data, source, headers) { - var url; + var url = null; if (source === "spam") { url = "learnspam"; } else if (source === "ham") { |