From 8782eeec561e490b4262ba8983e69623daaf5845 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 3 Oct 2015 20:27:15 +1300 Subject: Add space after function keyword --- web/app/Application.js | 12 ++++++------ web/app/AttributeFormatter.js | 12 ++++++------ web/app/ErrorManager.js | 4 ++-- web/app/LoginManager.js | 8 ++++---- web/app/controller/Root.js | 10 +++++----- web/app/store/DistanceUnits.js | 2 +- web/app/store/Languages.js | 2 +- web/app/store/SpeedUnits.js | 2 +- web/app/view/BaseEditDialogController.js | 6 +++--- web/app/view/CommandDialogController.js | 6 +++--- web/app/view/DeviceController.js | 24 ++++++++++++------------ web/app/view/LoginController.js | 20 ++++++++++---------- web/app/view/Map.js | 4 ++-- web/app/view/MapController.js | 22 +++++++++++----------- web/app/view/RegisterController.js | 4 ++-- web/app/view/ReportController.js | 10 +++++----- web/app/view/StateController.js | 12 ++++++------ web/app/view/user/UserController.js | 14 +++++++------- web/app/view/user/UserDialogController.js | 8 ++++---- web/tests/010_sanity.t.js | 2 +- 20 files changed, 92 insertions(+), 92 deletions(-) diff --git a/web/app/Application.js b/web/app/Application.js index def000f04..a0e61338f 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function() { +(function () { "use strict"; Ext.define('Traccar.Application', { @@ -53,29 +53,29 @@ 'Root' ], - setUser: function(data) { + setUser: function (data) { var reader = Ext.create('Ext.data.reader.Json', { model: 'Traccar.model.User' }); this.user = reader.readRecords(data).getRecords()[0]; }, - getUser: function() { + getUser: function () { return this.user; }, - setServer: function(data) { + setServer: function (data) { var reader = Ext.create('Ext.data.reader.Json', { model: 'Traccar.model.Server' }); this.server = reader.readRecords(data).getRecords()[0]; }, - getServer: function() { + getServer: function () { return this.server; }, - getPreference: function(key, defaultValue) { + getPreference: function (key, defaultValue) { return this.getUser().get(key) || this.getServer().get(key) || defaultValue; } }); diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 2e61dd8c2..b4720be61 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -17,24 +17,24 @@ Ext.define('Traccar.AttributeFormatter', { singleton: true, - coordinateFormatter: function(value) { + coordinateFormatter: function (value) { return value.toFixed(6); }, - speedFormatter: function(value) { + speedFormatter: function (value) { return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit')); }, - courseFormatter: function(value) { + courseFormatter: function (value) { var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']; return courseValues[Math.floor(value / 45)]; }, - distanceFormatter: function(value) { + distanceFormatter: function (value) { return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); }, - defaultFormatter: function(value) { + defaultFormatter: function (value) { if (typeof value === 'number') { return value.toFixed(2); } else if (typeof value === 'boolean') { @@ -45,7 +45,7 @@ Ext.define('Traccar.AttributeFormatter', { return value; }, - getFormatter: function(key) { + getFormatter: function (key) { if (key === 'latitude' || key === 'longitude') { return this.coordinateFormatter; } else if (key === 'speed') { diff --git a/web/app/ErrorManager.js b/web/app/ErrorManager.js index 77e5ae373..e8b29a319 100644 --- a/web/app/ErrorManager.js +++ b/web/app/ErrorManager.js @@ -17,7 +17,7 @@ Ext.define('Traccar.ErrorManager', { singleton: true, - check: function(success, response) { + check: function (success, response) { if (success) { var result = Ext.decode(response.responseText); if (result.success || result.error === undefined) { @@ -36,7 +36,7 @@ Ext.define('Traccar.ErrorManager', { } }, - error: function(message) { + error: function (message) { Ext.Msg.alert(strings.errorTitle, message); } diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js index 867b4a7ab..5a9615183 100644 --- a/web/app/LoginManager.js +++ b/web/app/LoginManager.js @@ -17,7 +17,7 @@ Ext.define('Traccar.LoginManager', { singleton: true, - server: function(options) { + server: function (options) { Ext.Ajax.request({ scope: this, url: '/api/server/get', @@ -26,7 +26,7 @@ Ext.define('Traccar.LoginManager', { }); }, - onServerReturn: function(options, success, response) { + onServerReturn: function (options, success, response) { options = options.original; if (Traccar.ErrorManager.check(success, response)) { var result = Ext.decode(response.responseText); @@ -37,7 +37,7 @@ Ext.define('Traccar.LoginManager', { } }, - session: function(options) { + session: function (options) { Ext.Ajax.request({ scope: this, url: '/api/session', @@ -46,7 +46,7 @@ Ext.define('Traccar.LoginManager', { }); }, - onSessionReturn: function(options, success, response) { + onSessionReturn: function (options, success, response) { options = options.original; if (Traccar.ErrorManager.check(success, response)) { var result = Ext.decode(response.responseText); diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 490019b1a..aa2682708 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -24,7 +24,7 @@ Ext.define('Traccar.controller.Root', { 'Traccar.view.MainMobile' ], - init: function() { + init: function () { var indicator = document.createElement('div'); indicator.className = 'state-indicator'; document.body.appendChild(indicator); @@ -38,14 +38,14 @@ Ext.define('Traccar.controller.Root', { }); }, - onServer: function() { + onServer: function () { Traccar.LoginManager.session({ scope: this, callback: 'onSession' }); }, - onSession: function(success) { + onSession: function (success) { if (success) { this.loadApp(); } else { @@ -59,12 +59,12 @@ Ext.define('Traccar.controller.Root', { } }, - onLogin: function() { + onLogin: function () { this.login.close(); this.loadApp(); }, - loadApp: function() { + loadApp: function () { Ext.getStore('Devices').load(); Ext.getBody().empty(); if (this.isPhone) { diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js index 943a4327c..bcccc0703 100644 --- a/web/app/store/DistanceUnits.js +++ b/web/app/store/DistanceUnits.js @@ -28,7 +28,7 @@ Ext.define('Traccar.store.DistanceUnits', { factor: 0.00621371 }], - formatValue: function(value, unit) { + formatValue: function (value, unit) { var model; if (unit) { model = this.findRecord('key', unit); diff --git a/web/app/store/Languages.js b/web/app/store/Languages.js index 360508fd1..658b7bc21 100644 --- a/web/app/store/Languages.js +++ b/web/app/store/Languages.js @@ -18,7 +18,7 @@ Ext.define('Traccar.store.Languages', { extend: 'Ext.data.Store', fields: ['code', 'name'], - data: function() { + data: function () { var data = []; for (var code in availableLanguages) { if (availableLanguages.hasOwnProperty(code)) { diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js index c243e52b6..00d2e1aba 100644 --- a/web/app/store/SpeedUnits.js +++ b/web/app/store/SpeedUnits.js @@ -28,7 +28,7 @@ Ext.define('Traccar.store.SpeedUnits', { factor: 1.15078 }], - formatValue: function(value, unit) { + formatValue: function (value, unit) { var model; if (unit) { model = this.findRecord('key', unit); diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js index 0c45b3097..3b43cacf3 100644 --- a/web/app/view/BaseEditDialogController.js +++ b/web/app/view/BaseEditDialogController.js @@ -18,7 +18,7 @@ Ext.define('Traccar.view.BaseEditDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.baseEditDialog', - onSaveClick: function(button) { + onSaveClick: function (button) { var dialog, store, record; dialog = button.up('window').down('form'); dialog.updateRecord(); @@ -29,10 +29,10 @@ Ext.define('Traccar.view.BaseEditDialogController', { store.add(record); } store.sync({ - success: function() { + success: function () { store.reload(); // workaround for selection problem }, - failure: function(batch) { + failure: function (batch) { store.rejectChanges(); Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse()); } diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 6aba4a6f1..88e72d6e3 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -18,12 +18,12 @@ Ext.define('Traccar.view.CommandDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.commandDialog', - onSelect: function(selected) { + onSelect: function (selected) { this.lookupReference('paramPositionPeriodic').setHidden( selected.getValue() !== 'positionPeriodic'); }, - onSendClick: function(button) { + onSendClick: function (button) { var attributes, value, record, form; form = button.up('window').down('form'); @@ -48,7 +48,7 @@ Ext.define('Traccar.view.CommandDialogController', { }); }, - onSendResult: function(options, success, response) { + onSendResult: function (options, success, response) { if (Traccar.ErrorManager.check(success, response)) { Ext.toast(strings.commandSent); this.closeView(); diff --git a/web/app/view/DeviceController.js b/web/app/view/DeviceController.js index d714d89d4..64b3b8826 100644 --- a/web/app/view/DeviceController.js +++ b/web/app/view/DeviceController.js @@ -36,18 +36,18 @@ Ext.define('Traccar.view.DeviceController', { } }, - init: function() { + init: function () { if (Traccar.app.getUser().get('admin')) { this.lookupReference('settingsServerButton').setHidden(false); this.lookupReference('settingsUsersButton').setHidden(false); } }, - onLogoutClick: function() { + onLogoutClick: function () { Ext.create('Traccar.view.LoginController').logout(); }, - onAddClick: function() { + onAddClick: function () { var device, dialog; device = Ext.create('Traccar.model.Device'); device.store = this.getView().getStore(); @@ -56,7 +56,7 @@ Ext.define('Traccar.view.DeviceController', { dialog.show(); }, - onEditClick: function() { + onEditClick: function () { var device, dialog; device = this.getView().getSelectionModel().getSelection()[0]; dialog = Ext.create('Traccar.view.DeviceDialog'); @@ -64,7 +64,7 @@ Ext.define('Traccar.view.DeviceController', { dialog.show(); }, - onRemoveClick: function() { + onRemoveClick: function () { var device = this.getView().getSelectionModel().getSelection()[0]; Ext.Msg.show({ title: strings.deviceDialog, @@ -74,7 +74,7 @@ Ext.define('Traccar.view.DeviceController', { yes: strings.sharedRemove, no: strings.sharedCancel }, - fn: function(btn) { + fn: function (btn) { var store; if (btn === 'yes') { store = Ext.getStore('Devices'); @@ -85,7 +85,7 @@ Ext.define('Traccar.view.DeviceController', { }); }, - onCommandClick: function() { + onCommandClick: function () { var device, command, dialog; device = this.getView().getSelectionModel().getSelection()[0]; command = Ext.create('Traccar.model.Command'); @@ -95,7 +95,7 @@ Ext.define('Traccar.view.DeviceController', { dialog.show(); }, - onSelectionChange: function(selected) { + onSelectionChange: function (selected) { var empty = selected.getCount() === 0; this.lookupReference('deviceEditButton').setDisabled(empty); this.lookupReference('deviceRemoveButton').setDisabled(empty); @@ -105,19 +105,19 @@ Ext.define('Traccar.view.DeviceController', { } }, - onUserClick: function() { + onUserClick: function () { var dialog = Ext.create('Traccar.view.user.UserDialog'); dialog.down('form').loadRecord(Traccar.app.getUser()); dialog.show(); }, - onServerClick: function() { + onServerClick: function () { var dialog = Ext.create('Traccar.view.ServerDialog'); dialog.down('form').loadRecord(Traccar.app.getServer()); dialog.show(); }, - onUsersClick: function() { + onUsersClick: function () { Ext.create('Ext.window.Window', { title: strings.settingsUsers, width: styles.windowWidth, @@ -130,7 +130,7 @@ Ext.define('Traccar.view.DeviceController', { }).show(); }, - selectReport: function(position) { + selectReport: function (position) { if (position !== undefined) { this.getView().getSelectionModel().deselectAll(); } diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js index f6b2fe228..bc73661ed 100644 --- a/web/app/view/LoginController.js +++ b/web/app/view/LoginController.js @@ -22,13 +22,13 @@ Ext.define('Traccar.view.LoginController', { 'Traccar.view.Register' ], - init: function() { + init: function () { this.lookupReference('registerButton').setDisabled( !Traccar.app.getServer().get('registration')); this.lookupReference('languageField').setValue(language); }, - login: function() { + login: function () { var form = this.lookupReference('form'); if (form.isValid()) { Ext.getBody().mask(strings.sharedLoading); @@ -36,7 +36,7 @@ Ext.define('Traccar.view.LoginController', { scope: this, url: '/api/login', params: form.getValues(), - callback: function(options, success, response) { + callback: function (options, success, response) { Ext.getBody().unmask(); if (Traccar.ErrorManager.check(success, response)) { var result = Ext.decode(response.responseText); @@ -53,17 +53,17 @@ Ext.define('Traccar.view.LoginController', { } }, - logout: function() { + logout: function () { Ext.Ajax.request({ scope: this, url: '/api/logout', - callback: function() { + callback: function () { window.location.reload(); } }); }, - onSelectLanguage: function(selected) { + onSelectLanguage: function (selected) { var paramName = 'locale'; var paramValue = selected.getValue(); var url = window.location.href; @@ -83,22 +83,22 @@ Ext.define('Traccar.view.LoginController', { window.location.href = url; }, - onAfterRender: function(field) { + onAfterRender: function (field) { field.focus(); }, - onSpecialKey: function(field, e) { + onSpecialKey: function (field, e) { if (e.getKey() === e.ENTER) { this.login(); } }, - onLoginClick: function() { + onLoginClick: function () { Ext.getElementById('submitButton').click(); this.login(); }, - onRegisterClick: function() { + onRegisterClick: function () { Ext.create('Traccar.view.login.Register').show(); } }); diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 5d2fd579c..63be7f666 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -28,7 +28,7 @@ Ext.define('Traccar.view.Map', { layout: 'fit', listeners: { - afterrender: function() { + afterrender: function () { var user = Traccar.app.getUser(); var server = Traccar.app.getServer(); @@ -79,7 +79,7 @@ Ext.define('Traccar.view.Map', { }); }, - resize: function() { + resize: function () { this.map.updateSize(); } } diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index 4979cd920..66cbe6b31 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -31,19 +31,19 @@ Ext.define('Traccar.view.MapController', { } }, - init: function() { + init: function () { this.liveData = {}; this.update(true); }, - update: function(first) { + update: function (first) { Ext.Ajax.request({ scope: this, url: '/api/async', params: { first: first }, - success: function(response) { + success: function (response) { var data = Ext.decode(response.responseText).data; var i; @@ -79,13 +79,13 @@ Ext.define('Traccar.view.MapController', { this.update(false); }, - failure: function() { + failure: function () { // TODO: error } }); }, - getLineStyle: function() { + getLineStyle: function () { return new ol.style.Style({ stroke: new ol.style.Stroke({ color: styles.mapStrokeColor, @@ -94,7 +94,7 @@ Ext.define('Traccar.view.MapController', { }); }, - getMarkerStyle: function(radius, color) { + getMarkerStyle: function (radius, color) { /*return new ol.style.Style({ text: new ol.style.Text({ text: '\uf041', @@ -123,7 +123,7 @@ Ext.define('Traccar.view.MapController', { }); }, - reportShow: function() { + reportShow: function () { this.reportClear(); var vectorSource = this.getView().vectorSource; @@ -163,7 +163,7 @@ Ext.define('Traccar.view.MapController', { } }, - reportClear: function() { + reportClear: function () { var index; var vectorSource = this.getView().vectorSource; @@ -182,7 +182,7 @@ Ext.define('Traccar.view.MapController', { } }, - selectPosition: function(feature) { + selectPosition: function (feature) { if (this.currentFeature !== undefined) { this.currentFeature.setStyle(this.currentFeature.get('originalStyle')); } @@ -201,11 +201,11 @@ Ext.define('Traccar.view.MapController', { this.currentFeature = feature; }, - selectDevice: function(device) { + selectDevice: function (device) { this.selectPosition(this.liveData[device.get('id')]); }, - selectReport: function(position) { + selectReport: function (position) { if (this.reportRoutePoints[position.get('id')] !== undefined) { this.selectPosition(this.reportRoutePoints[position.get('id')]); } diff --git a/web/app/view/RegisterController.js b/web/app/view/RegisterController.js index b470aa343..2547d631c 100644 --- a/web/app/view/RegisterController.js +++ b/web/app/view/RegisterController.js @@ -18,7 +18,7 @@ Ext.define('Traccar.view.RegisterController', { extend: 'Ext.app.ViewController', alias: 'controller.register', - onCreateClick: function() { + onCreateClick: function () { var form = this.lookupReference('form'); if (form.isValid()) { Ext.Ajax.request({ @@ -30,7 +30,7 @@ Ext.define('Traccar.view.RegisterController', { } }, - onCreateReturn: function(options, success, response) { + onCreateReturn: function (options, success, response) { if (Traccar.ErrorManager.check(success, response)) { this.closeView(); Ext.toast(strings.loginCreated); diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 0b3e30f17..99c1a9b07 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -28,7 +28,7 @@ Ext.define('Traccar.view.ReportController', { } }, - onShowClick: function() { + onShowClick: function () { var deviceId, fromDate, fromTime, from, toDate, toTime, to, store; deviceId = this.lookupReference('deviceField').getValue(); @@ -55,24 +55,24 @@ Ext.define('Traccar.view.ReportController', { to: to.toISOString() }, scope: this, - callback: function() { + callback: function () { this.fireEvent("reportShow"); } }); }, - onClearClick: function() { + onClearClick: function () { Ext.getStore('Positions').removeAll(); this.fireEvent("reportClear"); }, - onSelectionChange: function(selected) { + onSelectionChange: function (selected) { if (selected.getCount() > 0) { this.fireEvent("selectReport", selected.getLastSelected()); } }, - selectDevice: function(device) { + selectDevice: function (device) { if (device !== undefined) { this.getView().getSelectionModel().deselectAll(); } diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index dc2ddfb2b..ce9a21af4 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -28,7 +28,7 @@ Ext.define('Traccar.view.StateController', { } }, - init: function() { + init: function () { var store = Ext.getStore('LatestPositions'); store.on('add', this.add, this); store.on('update', this.update, this); @@ -73,7 +73,7 @@ Ext.define('Traccar.view.StateController', { } }, - formatValue: function(value) { + formatValue: function (value) { if (typeof(id) === 'number') { return value.toFixed(2); } else { @@ -81,7 +81,7 @@ Ext.define('Traccar.view.StateController', { } }, - updatePosition: function(position) { + updatePosition: function (position) { var attributes, value, unit, store, key; store = Ext.getStore('Attributes'); store.removeAll(); @@ -112,7 +112,7 @@ Ext.define('Traccar.view.StateController', { } }, - selectDevice: function(device) { + selectDevice: function (device) { var found; this.deviceId = device.get('id'); found = Ext.getStore('LatestPositions').query('deviceId', this.deviceId); @@ -123,13 +123,13 @@ Ext.define('Traccar.view.StateController', { } }, - add: function(store, data) { + add: function (store, data) { if (this.deviceId === data[0].get('deviceId')) { this.updatePosition(data[0]); } }, - update: function(store, data) { + update: function (store, data) { if (this.deviceId === data.get('deviceId')) { this.updatePosition(data); } diff --git a/web/app/view/user/UserController.js b/web/app/view/user/UserController.js index 156d33a86..507fd5a5c 100644 --- a/web/app/view/user/UserController.js +++ b/web/app/view/user/UserController.js @@ -22,25 +22,25 @@ Ext.define('Traccar.view.user.UserController', { 'Traccar.view.user.UserDialog' ], - init: function() { + init: function () { Ext.getStore('Users').load(); }, - onAddClick: function() { + onAddClick: function () { var user = Ext.create('Traccar.model.User'); var dialog = Ext.create('Traccar.view.user.UserDialog'); dialog.down('form').loadRecord(user); dialog.show(); }, - onEditClick: function() { + onEditClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; var dialog = Ext.create('Traccar.view.user.UserDialog'); dialog.down('form').loadRecord(user); dialog.show(); }, - onRemoveClick: function() { + onRemoveClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; Ext.Msg.show({ title: strings.settingsUser, @@ -50,7 +50,7 @@ Ext.define('Traccar.view.user.UserController', { yes: strings.sharedRemove, no: strings.sharedCancel }, - fn: function(btn) { + fn: function (btn) { if (btn === 'yes') { var store = Ext.getStore('Users'); store.remove(user); @@ -60,7 +60,7 @@ Ext.define('Traccar.view.user.UserController', { }); }, - onDevicesClick: function() { + onDevicesClick: function () { // TODO show devices /*Ext.create('Ext.window.Window', { title: strings.settingsUsers, @@ -74,7 +74,7 @@ Ext.define('Traccar.view.user.UserController', { }).show();*/ }, - onSelectionChange: function(selected) { + onSelectionChange: function (selected) { var disabled = selected.length > 0; this.lookupReference('userEditButton').setDisabled(disabled); this.lookupReference('userRemoveButton').setDisabled(disabled); diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/user/UserDialogController.js index dd3109d37..40f938b5c 100644 --- a/web/app/view/user/UserDialogController.js +++ b/web/app/view/user/UserDialogController.js @@ -18,13 +18,13 @@ Ext.define('Traccar.view.user.UserDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.userDialog', - init: function() { + init: function () { if (Traccar.app.getUser().get('admin')) { this.lookupReference('adminField').setDisabled(false); } }, - onSaveClick: function(button) { + onSaveClick: function (button) { var dialog = button.up('window').down('form'); dialog.updateRecord(); var record = dialog.getRecord(); @@ -36,7 +36,7 @@ Ext.define('Traccar.view.user.UserDialogController', { store.add(record); } store.sync({ - failure: function(batch) { + failure: function (batch) { store.rejectChanges(); // TODO Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse()); } @@ -45,7 +45,7 @@ Ext.define('Traccar.view.user.UserDialogController', { button.up('window').close(); }, - onCancelClick: function(button) { + onCancelClick: function (button) { button.up('window').close(); } diff --git a/web/tests/010_sanity.t.js b/web/tests/010_sanity.t.js index a51decd9b..fa334814f 100644 --- a/web/tests/010_sanity.t.js +++ b/web/tests/010_sanity.t.js @@ -1,4 +1,4 @@ -StartTest(function(t) { +StartTest(function (t) { t.diag("Sanity"); t.ok(Ext, 'Ext is defined'); -- cgit v1.2.3