From 48f981a2a9755fb0af6497020e499bb0883e0e1f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 3 Oct 2015 21:01:45 +1300 Subject: Enable JavaScript strict mode --- web/app/controller/Root.js | 114 +++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 55 deletions(-) (limited to 'web/app/controller') diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index aa2682708..3d2a82d48 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -13,64 +13,68 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +(function () { + 'use strict'; -Ext.define('Traccar.controller.Root', { - extend: 'Ext.app.Controller', - - requires: [ - 'Traccar.LoginManager', - 'Traccar.view.Login', - 'Traccar.view.Main', - 'Traccar.view.MainMobile' - ], + Ext.define('Traccar.controller.Root', { + extend: 'Ext.app.Controller', - init: function () { - var indicator = document.createElement('div'); - indicator.className = 'state-indicator'; - document.body.appendChild(indicator); - this.isPhone = parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10) !== 0; - }, - - onLaunch: function () { - Traccar.LoginManager.server({ - scope: this, - callback: 'onServer' - }); - }, + requires: [ + 'Traccar.LoginManager', + 'Traccar.view.Login', + 'Traccar.view.Main', + 'Traccar.view.MainMobile' + ], - onServer: function () { - Traccar.LoginManager.session({ - scope: this, - callback: 'onSession' - }); - }, - - onSession: function (success) { - if (success) { - this.loadApp(); - } else { - this.login = Ext.create('widget.login', { - listeners: { - scope: this, - login: 'onLogin' - } + init: function () { + var indicator = document.createElement('div'); + indicator.className = 'state-indicator'; + document.body.appendChild(indicator); + this.isPhone = parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10) !== 0; + }, + + onLaunch: function () { + Traccar.LoginManager.server({ + scope: this, + callback: 'onServer' }); - this.login.show(); - } - }, + }, + + onServer: function () { + Traccar.LoginManager.session({ + scope: this, + callback: 'onSession' + }); + }, - onLogin: function () { - this.login.close(); - this.loadApp(); - }, - - loadApp: function () { - Ext.getStore('Devices').load(); - Ext.getBody().empty(); - if (this.isPhone) { - Ext.create('widget.mainMobile'); - } else { - Ext.create('widget.main'); + onSession: function (success) { + if (success) { + this.loadApp(); + } else { + this.login = Ext.create('widget.login', { + listeners: { + scope: this, + login: 'onLogin' + } + }); + this.login.show(); + } + }, + + onLogin: function () { + this.login.close(); + this.loadApp(); + }, + + loadApp: function () { + Ext.getStore('Devices').load(); + Ext.getBody().empty(); + if (this.isPhone) { + Ext.create('widget.mainMobile'); + } else { + Ext.create('widget.main'); + } } - } -}); + }); + +})(); -- cgit v1.2.3