]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] JS: Add space before parentheses
authorAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 5 Jul 2018 08:16:49 +0000 (11:16 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 5 Jul 2018 08:16:49 +0000 (11:16 +0300)
of anonymous functions

interface/js/app/config.js
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/stats.js
interface/js/app/symbols.js
interface/js/app/upload.js
interface/js/main.js

index 343545d7332f03777b6221de3381930d4dde05b7..02f54c7f06cb00b1c4134bf21f2c49a3597a4116 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 define(["jquery"],
-    function($) {
+    function ($) {
         var interface = {};
 
         function save_map_success(rspamd) {
@@ -51,7 +51,7 @@ define(["jquery"],
                 error: function (data) {
                     save_map_error(rspamd, "local", null, null, data.statusText);
                 },
-                success: function() { save_map_success(rspamd); },
+                success: function () { save_map_success(rspamd); },
             });
         }
 
@@ -222,10 +222,10 @@ define(["jquery"],
                         }
                     }
 
-                    $("#saveActionsBtn").on("click", function() {
+                    $("#saveActionsBtn").on("click", function () {
                         saveActions(rspamd.queryLocal);
                     });
-                    $("#saveActionsClusterBtn").on("click", function() {
+                    $("#saveActionsClusterBtn").on("click", function () {
                         saveActions(rspamd.queryNeighbours);
                     });
                 },
@@ -233,11 +233,11 @@ define(["jquery"],
         }
 
         // @upload edited actions
-        interface.setup = function(rspamd) {
+        interface.setup = function (rspamd) {
         // Modal form for maps
             $(document).on("click", "[data-toggle=\"modal\"]", function () {
                 var item = $(this).data("item");
-                getMapById(rspamd, item).done(function() {
+                getMapById(rspamd, item).done(function () {
                     $("#modalTitle").html(item.uri);
                     $("#" + item.map).first().show();
                     $("#modalDialog .progress").hide();
index 38c993059906d1cc6cfac398f7a02e58d9181d36..f5258c5ab73daa6d526a36570dd7c7b3c57ed59c 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 define(["jquery", "d3evolution", "footable"],
-    function($, D3Evolution, unused) {
+    function ($, D3Evolution, unused) {
         var rrd_pie_config = {
             header: {},
             size: {
@@ -95,7 +95,7 @@ define(["jquery", "d3evolution", "footable"],
                 interpolate: getSelector("selInterpolate"),
                 convert:     getSelector("selConvert"),
             }));
-            $("#selYScale").change(function() {
+            $("#selYScale").change(function () {
                 graph.yScale(this.value);
             });
             $("#selConvert").change(function () {
@@ -169,7 +169,7 @@ define(["jquery", "d3evolution", "footable"],
         var interface = {};
         var prevUnit = "msg/s";
 
-        interface.draw = function(rspamd, graphs, neighbours, checked_server, type) {
+        interface.draw = function (rspamd, graphs, neighbours, checked_server, type) {
 
             function updateWidgets(data) {
             // Autoranging
@@ -278,7 +278,7 @@ define(["jquery", "d3evolution", "footable"],
             });
         };
 
-        interface.setup = function() {
+        interface.setup = function () {
         // Handling mouse events on overlapping elements
             $("#rrd-pie").mouseover(function () {
                 $("#rrd-pie").css("z-index", "200");
index 2c4d87b03f259f50d9c7b05ce27d8868f1daaf1a..6df0335300502233bd3c2508cb38f7768e6495e4 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 define(["jquery", "footable", "humanize"],
-    function($, _, Humanize) {
+    function ($, _, Humanize) {
         var interface = {};
         var ft = {};
         var htmlEscapes = {
@@ -39,8 +39,8 @@ define(["jquery", "footable", "humanize"],
         var htmlEscaper = /[&<>"'/`=]/g;
         var symbolDescriptions = {};
 
-        EscapeHTML = function(string) {
-            return ("" + string).replace(htmlEscaper, function(match) {
+        EscapeHTML = function (string) {
+            return ("" + string).replace(htmlEscaper, function (match) {
                 return htmlEscapes[match];
             });
         };
@@ -62,7 +62,7 @@ define(["jquery", "footable", "humanize"],
                     escape_HTML_array(item[prop]);
                     break;
                 case "symbols":
-                    Object.keys(item.symbols).map(function(key) {
+                    Object.keys(item.symbols).map(function (key) {
                         var sym = item.symbols[key];
                         if (!sym.name) {
                             sym.name = key;
@@ -154,7 +154,7 @@ define(["jquery", "footable", "humanize"],
                     }
 
                     preprocess_item(item);
-                    Object.keys(item.symbols).map(function(key) {
+                    Object.keys(item.symbols).map(function (key) {
                         var sym = item.symbols[key];
 
                         if (sym.description) {
@@ -172,11 +172,11 @@ define(["jquery", "footable", "humanize"],
                         item.symbols[key].str = str;
                     });
                     item.symbols = Object.keys(item.symbols)
-                        .map(function(key) {
+                        .map(function (key) {
                             return item.symbols[key];
                         })
                         .sort(compare)
-                        .map(function(e) { return e.str; })
+                        .map(function (e) { return e.str; })
                         .join("<br>\n");
                     item.time = {
                         "value": unix_time_format(item.unix_time),
@@ -310,7 +310,7 @@ define(["jquery", "footable", "humanize"],
                     "font-size": "11px",
                     "maxWidth": 110
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "name": "symbols",
                 "title": "Symbols",
@@ -337,7 +337,7 @@ define(["jquery", "footable", "humanize"],
                     "font-size": "11px",
                     "maxWidth": 72
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "sorted": true,
                 "direction": "DESC",
@@ -346,7 +346,7 @@ define(["jquery", "footable", "humanize"],
                 "style": {
                     "font-size": "11px"
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "name": "user",
                 "title": "Authenticated user",
@@ -397,7 +397,7 @@ define(["jquery", "footable", "humanize"],
                     "font-size": "11px",
                     "maxWidth": 110
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "name": "symbols",
                 "title": "Symbols",
@@ -425,7 +425,7 @@ define(["jquery", "footable", "humanize"],
                     "font-size": "11px",
                     "maxWidth": 80
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "sorted": true,
                 "direction": "DESC",
@@ -434,7 +434,7 @@ define(["jquery", "footable", "humanize"],
                 "style": {
                     "font-size": "11px"
                 },
-                "sortValue": function(val) { return Number(val.options.sortValue); }
+                "sortValue": function (val) { return Number(val.options.sortValue); }
             }, {
                 "name": "user",
                 "title": "Authenticated user",
@@ -485,14 +485,14 @@ define(["jquery", "footable", "humanize"],
 
         interface.getHistory = function (rspamd, tables, neighbours, checked_server) {
             FooTable.actionFilter = FooTable.Filtering.extend({
-                construct : function(instance) {
+                construct : function (instance) {
                     this._super(instance);
                     this.actions = ["reject", "add header", "greylist",
                         "no action", "soft reject", "rewrite subject"];
                     this.def = "Any action";
                     this.$action = null;
                 },
-                $create : function() {
+                $create : function () {
                     this._super();
                     var self = this, $form_grp = $("<div/>", {
                         "class" : "form-group"
@@ -510,11 +510,11 @@ define(["jquery", "footable", "humanize"],
                             text : self.def
                         })).appendTo($form_grp);
 
-                    $.each(self.actions, function(i, action) {
+                    $.each(self.actions, function (i, action) {
                         self.$action.append($("<option/>").text(action));
                     });
                 },
-                _onStatusDropdownChanged : function(e) {
+                _onStatusDropdownChanged : function (e) {
                     var self = e.data.self, selected = $(this).val();
                     if (selected !== self.def) {
                         if (selected === "reject") {
@@ -527,7 +527,7 @@ define(["jquery", "footable", "humanize"],
                     }
                     self.filter();
                 },
-                draw : function() {
+                draw : function () {
                     this._super();
                     var action = this.find("action");
                     if (action instanceof FooTable.Filter) {
@@ -542,7 +542,7 @@ define(["jquery", "footable", "humanize"],
                 }
             });
 
-            var drawTooltips = function() {
+            var drawTooltips = function () {
             // Update symbol description tooltips
                 $.each(symbolDescriptions, function (key, description) {
                     $("abbr[data-sym-key=" + key + "]").tooltip({
@@ -663,7 +663,7 @@ define(["jquery", "footable", "humanize"],
                 e.preventDefault();
                 interface.getHistory(rspamd, tables, neighbours, checked_server);
             });
-            $("#selSymOrder").unbind().change(function() {
+            $("#selSymOrder").unbind().change(function () {
                 interface.getHistory(rspamd, tables, neighbours, checked_server);
             });
 
@@ -742,7 +742,7 @@ define(["jquery", "footable", "humanize"],
             });
         }
 
-        interface.getErrors = function(rspamd, tables, neighbours, checked_server) {
+        interface.getErrors = function (rspamd, tables, neighbours, checked_server) {
             if (rspamd.read_only) return;
 
             if (checked_server !== "All SERVERS") {
@@ -779,7 +779,7 @@ define(["jquery", "footable", "humanize"],
             });
         };
 
-        interface.setup = function(rspamd, tables) {
+        interface.setup = function (rspamd, tables) {
         };
         return interface;
     });
index 49d3bf11ba703360cedd4be29a388274add7315b..0a69fca9974045b80a45d86219afda72c41cf71e 100644 (file)
@@ -179,7 +179,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
 
     // Public functions
     interface.alertMessage = alertMessage;
-    interface.setup = function() {
+    interface.setup = function () {
         $("#selData").change(function () {
             selData = this.value;
             tabClick("#throughput_nav");
@@ -236,7 +236,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
         selData = tab_graph.setup();
     };
 
-    interface.connect = function() {
+    interface.connect = function () {
         if (isLogged()) {
             var data = JSON.parse(sessionStorage.getItem("Credentials"));
 
@@ -314,7 +314,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
         });
     };
 
-    interface.queryLocal = function(req_url, on_success, on_error, method, headers, params) {
+    interface.queryLocal = function (req_url, on_success, on_error, method, headers, params) {
         var req_params = {
             type: method,
             jsonp: false,
@@ -322,7 +322,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                 xhr.setRequestHeader("Password", getPassword());
 
                 if (headers) {
-                    $.each(headers, function(hname, hvalue) {
+                    $.each(headers, function (hname, hvalue) {
                         xhr.setRequestHeader(hname, hvalue);
                     });
                 }
@@ -336,7 +336,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                     alertMessage("alert-success", "Data saved");
                 }
             },
-            error: function(jqXHR, textStatus, errorThrown) {
+            error: function (jqXHR, textStatus, errorThrown) {
                 if (on_error) {
                     on_error("local", jqXHR, textStatus, errorThrown);
                 }
@@ -346,14 +346,14 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
             }
         };
         if (params) {
-            $.each(params, function(k, v) {
+            $.each(params, function (k, v) {
                 req_params[k] = v;
             });
         }
         $.ajax(req_params);
     };
 
-    interface.queryNeighbours = function(req_url, on_success, on_error, method, headers, params, req_data) {
+    interface.queryNeighbours = function (req_url, on_success, on_error, method, headers, params, req_data) {
         $.ajax({
             dataType: "json",
             type: "GET",
@@ -395,7 +395,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                             xhr.setRequestHeader("Password", getPassword());
 
                             if (headers) {
-                                $.each(headers, function(hname, hvalue) {
+                                $.each(headers, function (hname, hvalue) {
                                     xhr.setRequestHeader(hname, hvalue);
                                 });
                             }
@@ -419,7 +419,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                                 }
                             }
                         },
-                        error: function(jqXHR, textStatus, errorThrown) {
+                        error: function (jqXHR, textStatus, errorThrown) {
                             neighbours_status[ind].status = false;
                             neighbours_status[ind].checked = true;
                             if (on_error) {
@@ -443,7 +443,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                         // error display
                     };
                     if (params) {
-                        $.each(params, function(k, v) {
+                        $.each(params, function (k, v) {
                             req_params[k] = v;
                         });
                     }
@@ -456,7 +456,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
         });
     };
 
-    interface.drawPie = function(obj, id, data, conf) {
+    interface.drawPie = function (obj, id, data, conf) {
         if (obj) {
             obj.updateProp("data.content",
                 data.filter(function (elt) {
index fa26e536b70ab70e7de3f07da834b8c7e9c3dd15..c76f51945551e7666a7baf156adce4b27c0336ee 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 define(["jquery", "d3pie", "humanize"],
-    function($, d3pie, Humanize) {
+    function ($, d3pie, Humanize) {
     // @ ms to date
         function msToTime(seconds) {
             /* eslint-disable no-bitwise */
@@ -174,8 +174,8 @@ define(["jquery", "d3pie", "humanize"],
         }
         // Public API
         var interface = {
-            statWidgets: function(rspamd, graphs, checked_server) {
-                rspamd.queryNeighbours("/auth", function(neighbours_status) {
+            statWidgets: function (rspamd, graphs, checked_server) {
+                rspamd.queryNeighbours("/auth", function (neighbours_status) {
                     var neighbours_sum = {
                         version: neighbours_status[0].data.version,
                         auth: "ok",
index a2a1205d4d0448ed2f7bfeb3366b696f7aa92b04..f0bd71be9b9e6d412cc92bfee792ce41d928404b 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 define(["jquery", "footable"],
-    function($) {
+    function ($) {
         var interface = {};
         var ft = {};
 
@@ -126,9 +126,9 @@ define(["jquery", "footable"],
             });
 
             // For better mean calculations
-            var avg_freq = freqs.sort(function(a, b) {
+            var avg_freq = freqs.sort(function (a, b) {
                 return Number(a) < Number(b);
-            }).reduce(function(f1, acc) {
+            }).reduce(function (f1, acc) {
                 return f1 + acc;
             }) / (freqs.length != 0 ? freqs.length : 1.0);
             var mult = 1.0;
@@ -153,7 +153,7 @@ define(["jquery", "footable"],
             return [items, distinct_groups];
         }
         // @get symbols into modal form
-        interface.getSymbols = function(rspamd, tables, checked_server) {
+        interface.getSymbols = function (rspamd, tables, checked_server) {
 
             $.ajax({
                 dataType: "json",
@@ -166,13 +166,13 @@ define(["jquery", "footable"],
                 success: function (data) {
                     var items = process_symbols_data(data);
                     FooTable.groupFilter = FooTable.Filtering.extend({
-                        construct : function(instance) {
+                        construct : function (instance) {
                             this._super(instance);
                             this.groups = items[1];
                             this.def = "Any group";
                             this.$group = null;
                         },
-                        $create : function() {
+                        $create : function () {
                             this._super();
                             var self = this, $form_grp = $("<div/>", {
                                 "class" : "form-group"
@@ -190,11 +190,11 @@ define(["jquery", "footable"],
                                     text : self.def
                                 })).appendTo($form_grp);
 
-                            $.each(self.groups, function(i, group) {
+                            $.each(self.groups, function (i, group) {
                                 self.$group.append($("<option/>").text(group));
                             });
                         },
-                        _onStatusDropdownChanged : function(e) {
+                        _onStatusDropdownChanged : function (e) {
                             var self = e.data.self, selected = $(this).val();
                             if (selected !== self.def) {
                                 self.addFilter("group", selected, ["group"]);
@@ -203,7 +203,7 @@ define(["jquery", "footable"],
                             }
                             self.filter();
                         },
-                        draw : function() {
+                        draw : function () {
                             this._super();
                             var group = this.find("group");
                             if (group instanceof FooTable.Filter) {
@@ -219,7 +219,7 @@ define(["jquery", "footable"],
                             {"name":"symbol", "title":"Symbol", "style":{"font-size":"11px"}},
                             {"name":"description", "title":"Description", "breakpoints":"xs sm", "style":{"font-size":"11px"}},
                             {"name":"weight", "title":"Score", "style":{"font-size":"11px"}},
-                            {"name":"frequency", "title":"Frequency", "breakpoints":"xs sm", "style":{"font-size":"11px"}, "sortValue": function(value) { return Number(value).toFixed(2); }},
+                            {"name":"frequency", "title":"Frequency", "breakpoints":"xs sm", "style":{"font-size":"11px"}, "sortValue": function (value) { return Number(value).toFixed(2); }},
                             {"name":"time", "title":"Avg. time", "breakpoints":"xs sm", "style":{"font-size":"11px"}},
                             {"name":"save", "title":"Save", "style":{"font-size":"11px"}},
                         ],
@@ -253,14 +253,14 @@ define(["jquery", "footable"],
                     rspamd.alertMessage("alert-modal alert-error", data.statusText);
                 }
             });
-            $(document).on("click", "#symbolsTable :button", function(event) {
+            $(document).on("click", "#symbolsTable :button", function (event) {
                 var value = $(this).data("save");
                 if (!value) return;
                 saveSymbols(rspamd, "./savesymbols", "symbolsTable", value == "cluster");
             });
         };
 
-        interface.setup = function(rspamd, tables) {
+        interface.setup = function (rspamd, tables) {
             $("#updateSymbols").on("click", function (e) {
                 e.preventDefault();
                 $.ajax({
index 5a3185a0c31df33ba5c40c9a8e0456fc77aa6ea0..655a5dfb2856c5cfb773144bbe724af7c6e1bf91 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 define(["jquery"],
-    function($) {
+    function ($) {
         var interface = {};
 
         function cleanTextUpload(source) {
@@ -169,7 +169,7 @@ define(["jquery"],
             });
         }
 
-        interface.setup = function(rspamd) {
+        interface.setup = function (rspamd) {
             $("textarea").change(function () {
                 if ($(this).val().length !== "") {
                     $(this).closest("form").find("button").removeAttr("disabled").removeClass("disabled");
index d5bad2b25fae8ba3e1e501f53a25dcd32117737d..af7c63b8308f436f05f71e2cd2bf0fb05b4e01a9 100644 (file)
@@ -25,13 +25,13 @@ document.title = window.location.hostname +
     (window.location.pathname !== "/" ? window.location.pathname : "") +
     " - Rspamd Web Interface";
 
-define("d3.global", ["d3"], function(_) {
+define("d3.global", ["d3"], function (_) {
     d3 = _;
 });
 
 // Load main UI
 require(["domReady"],
-    function(domReady) {
+    function (domReady) {
         domReady(function () {
             require(["jquery", "d3", "app/rspamd"],
                 function ($, d3, rspamd) {