From ae62bbf8a07f15b57e5874bf5da333800bc6cc39 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Fri, 27 May 2016 23:59:01 +0200 Subject: [PATCH] [TASK] Use strict --- Gruntfile.js | 2 ++ app.js | 2 ++ bower.json | 2 +- lib/about.js | 2 ++ lib/container.js | 2 ++ lib/datadistributor.js | 2 ++ lib/filters/filtergui.js | 4 +++- lib/filters/genericnode.js | 2 ++ lib/filters/nodefilter.js | 4 +++- lib/forcegraph.js | 2 ++ lib/gui.js | 2 ++ lib/infobox/link.js | 2 ++ lib/infobox/location.js | 2 ++ lib/infobox/main.js | 2 ++ lib/infobox/node.js | 2 ++ lib/legend.js | 2 ++ lib/linklist.js | 2 ++ lib/locationmarker.js | 2 ++ lib/main.js | 2 ++ lib/map.js | 2 ++ lib/map/clientlayer.js | 1 + lib/map/labelslayer.js | 2 ++ lib/meshstats.js | 2 ++ lib/nodelist.js | 2 ++ lib/proportions.js | 1 + lib/router.js | 2 ++ lib/sidebar.js | 4 +++- lib/simplenodelist.js | 2 ++ lib/sorttable.js | 2 ++ lib/tabs.js | 4 +++- lib/title.js | 2 ++ lib/utils/helper.js | 4 +++- tasks/build.js | 2 ++ tasks/clean.js | 2 ++ tasks/development.js | 2 ++ tasks/linting.js | 2 ++ 36 files changed, 74 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 99fcd04..c508723 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + "use strict"; + grunt.loadTasks("tasks"); grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "inline"]); diff --git a/app.js b/app.js index d6a1227..f2d4e3c 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,5 @@ +"use strict"; + require.config({ baseUrl: "lib", paths: { diff --git a/bower.json b/bower.json index 717ee9b..99a54d2 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "es6-shim": "~0.35.1", "almond": "~0.3.2", "d3": "~3.5.17", - "roboto-fontface": "~0.3.0", + "roboto-fontface": "~0.4.5", "virtual-dom": "~2.1.1", "leaflet-providers": "~1.1.10", "rbush": "https://github.com/mourner/rbush.git#~1.4.3" diff --git a/lib/about.js b/lib/about.js index 5c2af90..6187421 100644 --- a/lib/about.js +++ b/lib/about.js @@ -1,4 +1,6 @@ define(function () { + "use strict"; + return function () { this.render = function (d) { var el = document.createElement("div"); diff --git a/lib/container.js b/lib/container.js index 4f32a84..d799167 100644 --- a/lib/container.js +++ b/lib/container.js @@ -1,4 +1,6 @@ define([], function () { + "use strict"; + return function (tag) { if (!tag) { tag = "div"; diff --git a/lib/datadistributor.js b/lib/datadistributor.js index 3edeaf6..ea79341 100644 --- a/lib/datadistributor.js +++ b/lib/datadistributor.js @@ -1,4 +1,6 @@ define(["filters/nodefilter"], function (NodeFilter) { + "use strict"; + return function () { var targets = []; var filterObservers = []; diff --git a/lib/filters/filtergui.js b/lib/filters/filtergui.js index 10629d7..4db1b4b 100644 --- a/lib/filters/filtergui.js +++ b/lib/filters/filtergui.js @@ -1,4 +1,6 @@ -define([], function () { +define(function () { + "use strict"; + return function (distributor) { var container = document.createElement("ul"); container.classList.add("filters"); diff --git a/lib/filters/genericnode.js b/lib/filters/genericnode.js index c4fe7a9..253c38b 100644 --- a/lib/filters/genericnode.js +++ b/lib/filters/genericnode.js @@ -1,4 +1,6 @@ define(["helper"], function (helper) { + "use strict"; + return function (name, key, value, f) { var negate = false; var refresh; diff --git a/lib/filters/nodefilter.js b/lib/filters/nodefilter.js index 1d6bf5f..68da159 100644 --- a/lib/filters/nodefilter.js +++ b/lib/filters/nodefilter.js @@ -1,4 +1,6 @@ -define([], function () { +define(function () { + "use strict"; + return function (filter) { return function (data) { var n = Object.create(data); diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 84fb394..ff94495 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -1,4 +1,6 @@ define(["d3", "helper"], function (d3, helper) { + "use strict"; + var margin = 200; var NODE_RADIUS = 15; var LINE_RADIUS = 12; diff --git a/lib/gui.js b/lib/gui.js index 93ca0fd..43162bf 100644 --- a/lib/gui.js +++ b/lib/gui.js @@ -5,6 +5,8 @@ define(["chroma-js", "map", "sidebar", "tabs", "container", "meshstats", function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend, Linklist, Nodelist, SimpleNodelist, Infobox, Proportions, ForceGraph, Title, About, DataDistributor, FilterGUI) { + "use strict"; + return function (config, router) { var self = this; var content; diff --git a/lib/infobox/link.js b/lib/infobox/link.js index 1f6697e..990163e 100644 --- a/lib/infobox/link.js +++ b/lib/infobox/link.js @@ -1,4 +1,6 @@ define(["helper"], function (helper) { + "use strict"; + function showStatImg(o, source, target) { var subst = {}; subst["{SOURCE}"] = source; diff --git a/lib/infobox/location.js b/lib/infobox/location.js index 4695ac4..fe40011 100644 --- a/lib/infobox/location.js +++ b/lib/infobox/location.js @@ -1,4 +1,6 @@ define(["helper"], function (helper) { + "use strict"; + return function (config, el, router, d) { var sidebarTitle = document.createElement("h2"); sidebarTitle.textContent = "Location: " + d.toString(); diff --git a/lib/infobox/main.js b/lib/infobox/main.js index 8f1ef4a..9690a2a 100644 --- a/lib/infobox/main.js +++ b/lib/infobox/main.js @@ -1,4 +1,6 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Node, Location) { + "use strict"; + return function (config, sidebar, router) { var self = this; var el; diff --git a/lib/infobox/node.js b/lib/infobox/node.js index a906ff5..2e85400 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -1,5 +1,7 @@ define(["moment", "tablesort", "helper", "moment.de"], function (moment, Tablesort, helper) { + "use strict"; + function showGeoURI(d) { function showLatitude(d) { var suffix = Math.sign(d) > -1 ? "' N" : "' S"; diff --git a/lib/legend.js b/lib/legend.js index b01782f..20c0e97 100644 --- a/lib/legend.js +++ b/lib/legend.js @@ -1,4 +1,6 @@ define(function () { + "use strict"; + return function () { var self = this; diff --git a/lib/linklist.js b/lib/linklist.js index 597bc6d..c18c6d2 100644 --- a/lib/linklist.js +++ b/lib/linklist.js @@ -1,4 +1,6 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) { + "use strict"; + function linkName(d) { return (d.source.node ? d.source.node.nodeinfo.hostname : d.source.id) + " – " + d.target.node.nodeinfo.hostname; } diff --git a/lib/locationmarker.js b/lib/locationmarker.js index 0f8c35a..a4a596f 100644 --- a/lib/locationmarker.js +++ b/lib/locationmarker.js @@ -1,4 +1,6 @@ define(["leaflet"], function (L) { + "use strict"; + return L.CircleMarker.extend({ outerCircle: { stroke: false, diff --git a/lib/main.js b/lib/main.js index e5bb777..950dcc1 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,5 +1,7 @@ define(["moment", "router", "leaflet", "gui", "helper", "moment.de"], function (moment, Router, L, GUI, helper) { + "use strict"; + return function (config) { function handleData(data) { var dataNodes = {}; diff --git a/lib/map.js b/lib/map.js index 8456d1d..4e205d5 100644 --- a/lib/map.js +++ b/lib/map.js @@ -2,6 +2,8 @@ define(["map/clientlayer", "map/labelslayer", "leaflet", "moment", "locationmarker", "rbush", "helper", "leaflet.label", "leaflet.providers", "moment.de"], function (ClientLayer, LabelsLayer, L, moment, LocationMarker, rbush, helper) { + "use strict"; + var options = { worldCopyJump: true, zoomControl: false diff --git a/lib/map/clientlayer.js b/lib/map/clientlayer.js index 7579f4e..1dc8cb7 100644 --- a/lib/map/clientlayer.js +++ b/lib/map/clientlayer.js @@ -1,5 +1,6 @@ define(["leaflet"], function (L) { + "use strict"; return L.TileLayer.Canvas.extend({ setData: function (d) { diff --git a/lib/map/labelslayer.js b/lib/map/labelslayer.js index a6af979..d54c4af 100644 --- a/lib/map/labelslayer.js +++ b/lib/map/labelslayer.js @@ -1,5 +1,7 @@ define(["leaflet", "rbush"], function (L, rbush) { + "use strict"; + var labelLocations = [["left", "middle", 0 / 8], ["center", "top", 6 / 8], ["right", "middle", 4 / 8], diff --git a/lib/meshstats.js b/lib/meshstats.js index 0501870..1acaf43 100644 --- a/lib/meshstats.js +++ b/lib/meshstats.js @@ -1,4 +1,6 @@ define(["helper"], function (helper) { + "use strict"; + return function (config) { var self = this; var stats, timestamp; diff --git a/lib/nodelist.js b/lib/nodelist.js index c5d685a..8533986 100644 --- a/lib/nodelist.js +++ b/lib/nodelist.js @@ -1,4 +1,6 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) { + "use strict"; + function getUptime(now, d) { if (d.flags.online && "uptime" in d.statistics) { return Math.round(d.statistics.uptime); diff --git a/lib/proportions.js b/lib/proportions.js index 6756829..31d4539 100644 --- a/lib/proportions.js +++ b/lib/proportions.js @@ -1,5 +1,6 @@ define(["chroma-js", "virtual-dom", "filters/genericnode", "helper"], function (Chroma, V, Filter, helper) { + "use strict"; return function (config, filterManager) { var self = this; diff --git a/lib/router.js b/lib/router.js index d841d32..7c9fc4a 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1,4 +1,6 @@ define(["helper"], function (helper) { + "use strict"; + return function () { var self = this; var objects = {nodes: {}, links: {}}; diff --git a/lib/sidebar.js b/lib/sidebar.js index 4c839cc..f644c6e 100644 --- a/lib/sidebar.js +++ b/lib/sidebar.js @@ -1,4 +1,6 @@ -define([], function () { +define(function () { + "use strict"; + return function (el) { var self = this; diff --git a/lib/simplenodelist.js b/lib/simplenodelist.js index 8ed0666..30cd97d 100644 --- a/lib/simplenodelist.js +++ b/lib/simplenodelist.js @@ -1,4 +1,6 @@ define(["moment", "virtual-dom", "helper", "moment.de"], function (moment, V, helper) { + "use strict"; + return function (nodes, field, router, title) { var self = this; var el, tbody; diff --git a/lib/sorttable.js b/lib/sorttable.js index 881efba..2fc7353 100644 --- a/lib/sorttable.js +++ b/lib/sorttable.js @@ -1,4 +1,6 @@ define(["virtual-dom"], function (V) { + "use strict"; + return function (headings, sortIndex, renderRow) { var data; var sortReverse = false; diff --git a/lib/tabs.js b/lib/tabs.js index f4fed6d..701af29 100644 --- a/lib/tabs.js +++ b/lib/tabs.js @@ -1,4 +1,6 @@ -define([], function () { +define(function () { + "use strict"; + return function () { var self = this; diff --git a/lib/title.js b/lib/title.js index 4c99c2c..243c6bd 100644 --- a/lib/title.js +++ b/lib/title.js @@ -1,4 +1,6 @@ define(function () { + "use strict"; + return function (config) { function setTitle(d) { var title = [config.siteName]; diff --git a/lib/utils/helper.js b/lib/utils/helper.js index 703f86a..6a31932 100644 --- a/lib/utils/helper.js +++ b/lib/utils/helper.js @@ -1,3 +1,5 @@ +"use strict"; + define({ get: function (url) { return new Promise(function (resolve, reject) { @@ -77,7 +79,7 @@ define({ }, listReplace: function (s, subst) { - for (key in subst) { + for (var key in subst) { var re = new RegExp(key, "g"); s = s.replace(re, subst[key]); } diff --git a/tasks/build.js b/tasks/build.js index 3a70fe8..4701cfb 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + "use strict"; + grunt.config.merge({ bowerdir: "bower_components", copy: { diff --git a/tasks/clean.js b/tasks/clean.js index ed0e234..67181e0 100644 --- a/tasks/clean.js +++ b/tasks/clean.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + "use strict"; + grunt.config.merge({ clean: { build: ["build/**/*", "node_modules/grunt-newer/.cache"] diff --git a/tasks/development.js b/tasks/development.js index e9b312e..938cd87 100644 --- a/tasks/development.js +++ b/tasks/development.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + "use strict"; + grunt.config.merge({ connect: { server: { diff --git a/tasks/linting.js b/tasks/linting.js index 5409fd5..6667d68 100644 --- a/tasks/linting.js +++ b/tasks/linting.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + "use strict"; + grunt.config.merge({ checkDependencies: { options: {