diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-08 14:33:48 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-08 14:33:48 +1300 |
commit | 38134454c55b4a36f7c82686e3a29a9610050e6e (patch) | |
tree | 9cc0cb41713c1d9b17f1df17c41953a938f010be /web | |
parent | 30f1a770f867de05a89ee6073dc002137d5e4512 (diff) | |
download | traccar-server-38134454c55b4a36f7c82686e3a29a9610050e6e.tar.gz traccar-server-38134454c55b4a36f7c82686e3a29a9610050e6e.tar.bz2 traccar-server-38134454c55b4a36f7c82686e3a29a9610050e6e.zip |
Fix JavaScript check style issues
Diffstat (limited to 'web')
-rw-r--r-- | web/.jscsrc | 3 | ||||
-rw-r--r-- | web/app/controller/Root.js | 9 | ||||
-rw-r--r-- | web/app/view/LoginController.js | 11 | ||||
-rw-r--r-- | web/app/view/Map.js | 2 | ||||
-rw-r--r-- | web/app/view/MapController.js | 5 | ||||
-rw-r--r-- | web/app/view/UsersController.js | 2 |
6 files changed, 17 insertions, 15 deletions
diff --git a/web/.jscsrc b/web/.jscsrc index 7d924ab96..dda6932e1 100644 --- a/web/.jscsrc +++ b/web/.jscsrc @@ -1,4 +1,5 @@ { "preset": "crockford", - "maxErrors": 100 + "maxErrors": 100, + "excludeFiles": ["arrowstyle.js"] } diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 94f3234d1..79827b8a6 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -96,16 +96,15 @@ Ext.define('Traccar.controller.Root', { first: first }, callback: Traccar.app.getErrorHandler(this, function (options, success, response) { - var i, store, deviceStore, data; + var i, store, data, position; if (success) { store = Ext.getStore('LatestPositions'); - deviceStore = Ext.getStore('Devices'); data = Ext.decode(response.responseText).data; for (i = 0; i < data.length; i++) { - var found = store.findRecord('deviceId', data[i].deviceId, 0, false, false, true); - if (found) { - found.set(data[i]); + position = store.findRecord('deviceId', data[i].deviceId, 0, false, false, true); + if (position) { + position.set(data[i]); } else { store.add(Ext.create('Traccar.model.Position', data[i])); } diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js index e0dbcce88..cd5a174d5 100644 --- a/web/app/view/LoginController.js +++ b/web/app/view/LoginController.js @@ -65,12 +65,13 @@ Ext.define('Traccar.view.LoginController', { }, onSelectLanguage: function (selected) { - var paramName = 'locale'; - var paramValue = selected.getValue(); - var url = window.location.href; + var paramName, paramValue, url, prefix, suffix; + paramName = 'locale'; + paramValue = selected.getValue(); + url = window.location.href; if (url.indexOf(paramName + '=') >= 0) { - var prefix = url.substring(0, url.indexOf(paramName)); - var suffix = url.substring(url.indexOf(paramName)); + prefix = url.substring(0, url.indexOf(paramName)); + suffix = url.substring(url.indexOf(paramName)); suffix = suffix.substring(suffix.indexOf('=') + 1); suffix = (suffix.indexOf('&') >= 0) ? suffix.substring(suffix.indexOf('&')) : ''; url = prefix + paramName + '=' + paramValue + suffix; diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 4358b64ac..8df5db1d9 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -96,7 +96,7 @@ Ext.define('Traccar.view.Map', { view: this.mapView }); - this.map.on('click', function(e) { + this.map.on('click', function (e) { this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { this.fireEvent('selectFeature', feature); }, this); diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index aa27aff74..9ccc3d57c 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -118,7 +118,8 @@ Ext.define('Traccar.view.MapController', { }, clearReport: function (store) { - var vectorSource = this.getView().getVectorSource(); + var vectorSource, key; + vectorSource = this.getView().getVectorSource(); if (this.reportRoute) { vectorSource.removeFeature(this.reportRoute); @@ -126,7 +127,7 @@ Ext.define('Traccar.view.MapController', { } if (this.reportMarkers) { - for (var key in this.reportMarkers) { + for (key in this.reportMarkers) { if (this.reportMarkers.hasOwnProperty(key)) { vectorSource.removeFeature(this.reportMarkers[key]); } diff --git a/web/app/view/UsersController.js b/web/app/view/UsersController.js index 30eb8b1a5..3d0e813e8 100644 --- a/web/app/view/UsersController.js +++ b/web/app/view/UsersController.js @@ -55,8 +55,8 @@ Ext.define('Traccar.view.UsersController', { no: Strings.sharedCancel }, fn: function (btn) { + var store = Ext.getStore('Users'); if (btn === 'yes') { - var store = Ext.getStore('Users'); store.remove(user); store.sync(); } |