diff --git a/.eslintrc b/.eslintrc index 488864b8..40ad0568 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,7 @@ "no-cond-assign": 2, // TODO: conflicts with no-extra-parens for while use case "no-extra-parens": 0, // For now going with 0 since 1 does more harm than good "no-unexpected-multiline": 2, - "valid-jsdoc": 2, + "valid-jsdoc": 1, "valid-typeof": 2, // Best practices @@ -90,7 +90,7 @@ "comma-spacing": [2, {"before": false, "after": true}], "comma-style": [1, "first"], // optionally set `[2, "first", {"exceptions": {"ArrayExpression": true, "ObjectExpression": true}}]` "computed-property-spacing": [2, "never"], - "consistent-this": [2, "self"], + "consistent-this": [2, "that"], "eol-last": 2, "func-names": 0, "func-style": 0, // optionally set `[2, "expression"]` @@ -128,7 +128,7 @@ "operator-assignment": [2, "always"], // optionally set `[2, "always"]` "operator-linebreak": [2, "after"], // optionally set `[2, "before", {"overrides": {"?": "after"}}]` // TODO: check for conditionals "padded-blocks": [2, "never"], - "quote-props": [2, "consistent-as-needed"], + "quote-props": [2, "as-needed", { "numbers": true }], "quotes": [2, "single", "avoid-escape"], "require-jsdoc": 0, "semi-spacing": [2, {"before": false, "after": true}], diff --git a/res/.eslintrc b/res/.eslintrc index 4a035f65..8aaccabe 100644 --- a/res/.eslintrc +++ b/res/.eslintrc @@ -1,9 +1,29 @@ +// TODO: Some day use eslint-plugin-angular +// https://github.com/Gillespie59/eslint-plugin-angular { "env": { "commonjs": true, - "mocha": true, - "browser": true + "browser": true, + "node": false, + "jasmine": true, + "protractor": true }, "rules": { + // TODO: for now lets just mute them + "comma-style": 0, + "padded-blocks": 0, + "no-unused-vars": 0, + "lines-around-comment": 0, + "no-use-before-define": 0, + "brace-style": 0, + "new-cap": 0, + "spaced-comment": 0, + "quote-props": 0, + "operator-linebreak": 0 + }, + "globals": { + "angular": 1, + "inject": 1, + "waitUrl": 1 } } diff --git a/res/.jshintrc b/res/.jshintrc deleted file mode 100644 index 982c60cc..00000000 --- a/res/.jshintrc +++ /dev/null @@ -1,44 +0,0 @@ -{ - "camelcase": true, - "curly": true, - "freeze": true, - "immed": true, - "latedef": "nofunc", - "newcap": false, - "noarg": true, - "noempty": true, - "nonbsp": true, - "nonew": true, - "undef": true, - "unused": true, - "trailing": true, - "maxlen": 100, - "asi": true, - "esnext": true, - "laxcomma": true, - "laxbreak": true, - "browser": true, - "devel": true, - "globals": { - "describe": false, - "it": false, - "before": false, - "beforeEach": false, - "after": false, - "afterEach": false, - "expect": true, - "inject": false, - "angular": false, - "define": false, - "require": false, - "module": false, - "browser": false, - "element": false, - "by": false, - "Promise": true, - "$": false, - "$$": false, - "protractor": false, - "jasmine": false - } -} diff --git a/res/app/app.js b/res/app/app.js index 088d16bd..5a3a4b77 100644 --- a/res/app/app.js +++ b/res/app/app.js @@ -1,5 +1,4 @@ -require.ensure([], function (require) { - +require.ensure([], function(require) { require('angular') require('angular-route') require('angular-touch') @@ -19,7 +18,7 @@ require.ensure([], function (require) { require('./../common/lang').name, require('stf/standalone').name ]) - .config(function ($routeProvider, $locationProvider) { + .config(function($routeProvider, $locationProvider) { $locationProvider.hashPrefix('!') $routeProvider .otherwise({ @@ -27,7 +26,7 @@ require.ensure([], function (require) { }) }) - .config(function (hotkeysProvider) { + .config(function(hotkeysProvider) { hotkeysProvider.templateTitle = 'Keyboard Shortcuts:' }) }) diff --git a/res/app/components/stf/admin-mode/admin-mode-directive.js b/res/app/components/stf/admin-mode/admin-mode-directive.js index 0958dff6..3c47abf0 100644 --- a/res/app/components/stf/admin-mode/admin-mode-directive.js +++ b/res/app/components/stf/admin-mode/admin-mode-directive.js @@ -1,7 +1,7 @@ module.exports = function adminModeDirective($rootScope, SettingsService) { return { restrict: 'AE', - link: function () { + link: function() { SettingsService.bind($rootScope, { target: 'adminMode', defaultValue: false diff --git a/res/app/components/stf/admin-mode/admin-mode-spec.js b/res/app/components/stf/admin-mode/admin-mode-spec.js index 848da367..0bee139b 100644 --- a/res/app/components/stf/admin-mode/admin-mode-spec.js +++ b/res/app/components/stf/admin-mode/admin-mode-spec.js @@ -1,5 +1,3 @@ describe('AdminModeService', function() { - - beforeEach(angular.mock.module(require('./').name)); - + beforeEach(angular.mock.module(require('./').name)) }) diff --git a/res/app/components/stf/angular-draggabilly/angular-draggabilly-directive.js b/res/app/components/stf/angular-draggabilly/angular-draggabilly-directive.js index 93ad80d0..20536941 100644 --- a/res/app/components/stf/angular-draggabilly/angular-draggabilly-directive.js +++ b/res/app/components/stf/angular-draggabilly/angular-draggabilly-directive.js @@ -2,7 +2,7 @@ module.exports = function angularDraggabillyDirective(DraggabillyService, $parse) { return { restrict: 'AE', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var parsedAttrs = $parse(attrs.angularDraggabilly)() if (typeof parsedAttrs !== 'object') { parsedAttrs = {} @@ -11,7 +11,7 @@ module.exports = var options = angular.extend({ }, parsedAttrs) - /* jshint unused: false */ + /* eslint no-unused-vars: 0 */ var draggie = new DraggabillyService(element[0], options) } } diff --git a/res/app/components/stf/angular-draggabilly/angular-draggabilly-spec.js b/res/app/components/stf/angular-draggabilly/angular-draggabilly-spec.js index 8083dfc4..3c32e5a7 100644 --- a/res/app/components/stf/angular-draggabilly/angular-draggabilly-spec.js +++ b/res/app/components/stf/angular-draggabilly/angular-draggabilly-spec.js @@ -1,23 +1,21 @@ -describe('angularDraggabilly', function () { +describe('angularDraggabilly', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); - - it('should ...', function () { + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, send that through compile() then compare the results. - var element = compile('
hi
')(scope); - expect(element.text()).toBe('hello, world'); + var element = compile('
hi
')(scope) + expect(element.text()).toBe('hello, world') */ - - }); -}); + }) +}) diff --git a/res/app/components/stf/angular-draggabilly/index.js b/res/app/components/stf/angular-draggabilly/index.js index 2d734194..3d64ef52 100644 --- a/res/app/components/stf/angular-draggabilly/index.js +++ b/res/app/components/stf/angular-draggabilly/index.js @@ -3,7 +3,7 @@ var draggabilly = require('draggabilly') module.exports = angular.module('stf.angular-draggabilly', [ ]) - .factory('DraggabillyService', function () { + .factory('DraggabillyService', function() { return draggabilly }) .directive('angularDraggabilly', require('./angular-draggabilly-directive')) diff --git a/res/app/components/stf/angular-packery/angular-packery-directive.js b/res/app/components/stf/angular-packery/angular-packery-directive.js index c760ae3b..10b240d2 100644 --- a/res/app/components/stf/angular-packery/angular-packery-directive.js +++ b/res/app/components/stf/angular-packery/angular-packery-directive.js @@ -5,7 +5,7 @@ module.exports = function angularPackeryDirective(PackeryService, return { restrict: 'AE', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var container = element[0] var parsedAttrs = $parse(attrs.angularPackery)() if (typeof parsedAttrs !== 'object') { @@ -24,10 +24,10 @@ module.exports = function angularPackeryDirective(PackeryService, pckry.bindResize() bindDraggable() - $timeout(function () { + $timeout(function() { pckry.layout() }, 0) - $timeout(function () { + $timeout(function() { pckry.layout() }, 100) @@ -56,7 +56,7 @@ module.exports = function angularPackeryDirective(PackeryService, scope.$on('panelsResized', _.throttle(onPanelsResized, 300)) - scope.$on('$destroy', function () { + scope.$on('$destroy', function() { pckry.unbindResize() pckry.off('layoutComplete', onLayoutComplete) pckry.destroy() diff --git a/res/app/components/stf/angular-packery/angular-packery-spec.js b/res/app/components/stf/angular-packery/angular-packery-spec.js index 01134c9f..0ca65ccd 100644 --- a/res/app/components/stf/angular-packery/angular-packery-spec.js +++ b/res/app/components/stf/angular-packery/angular-packery-spec.js @@ -1,15 +1,15 @@ -describe('angularPackery', function () { +describe('angularPackery', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('angularPackery', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/angular-packery/index.js b/res/app/components/stf/angular-packery/index.js index 6fcea4ab..40cf575a 100644 --- a/res/app/components/stf/angular-packery/index.js +++ b/res/app/components/stf/angular-packery/index.js @@ -8,7 +8,7 @@ var packery = require('packery/js/packery.js') module.exports = angular.module('stf.angular-packery', [ require('stf/angular-draggabilly').name ]) - .factory('PackeryService', function () { + .factory('PackeryService', function() { return packery }) .directive('angularPackery', require('./angular-packery-directive')) diff --git a/res/app/components/stf/app-state/app-state-provider.js b/res/app/components/stf/app-state/app-state-provider.js index 909e6aac..66538177 100644 --- a/res/app/components/stf/app-state/app-state-provider.js +++ b/res/app/components/stf/app-state/app-state-provider.js @@ -8,16 +8,16 @@ module.exports = function AppStateProvider() { } } - /*globals GLOBAL_APPSTATE:false*/ + /* global GLOBAL_APPSTATE:false */ if (typeof GLOBAL_APPSTATE !== 'undefined') { values = angular.extend(values, GLOBAL_APPSTATE) } return { - set: function (constants) { + set: function(constants) { angular.extend(values, constants) }, - $get: function () { + $get: function() { return values } } diff --git a/res/app/components/stf/basic-mode/basic-mode-directive.js b/res/app/components/stf/basic-mode/basic-mode-directive.js index 192dd0af..8fa74c3d 100644 --- a/res/app/components/stf/basic-mode/basic-mode-directive.js +++ b/res/app/components/stf/basic-mode/basic-mode-directive.js @@ -1,7 +1,7 @@ module.exports = function basicModeDirective($rootScope, BrowserInfo) { return { restrict: 'AE', - link: function (scope, element) { + link: function(scope, element) { $rootScope.basicMode = !!BrowserInfo.mobile if ($rootScope.basicMode) { element.addClass('basic-mode') diff --git a/res/app/components/stf/basic-mode/basic-mode-spec.js b/res/app/components/stf/basic-mode/basic-mode-spec.js index acc9f0d8..a2bc5613 100644 --- a/res/app/components/stf/basic-mode/basic-mode-spec.js +++ b/res/app/components/stf/basic-mode/basic-mode-spec.js @@ -1,15 +1,15 @@ -describe('basicMode', function () { +describe('basicMode', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('basicMode', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/browser-info/browser-info-service.js b/res/app/components/stf/browser-info/browser-info-service.js index cb85b6f4..f166772d 100644 --- a/res/app/components/stf/browser-info/browser-info-service.js +++ b/res/app/components/stf/browser-info/browser-info-service.js @@ -10,12 +10,12 @@ module.exports = function BrowserInfoServiceFactory() { service[key] = (typeof test == 'function') ? test() : test } - addTest('touch', function () { + addTest('touch', function() { return ('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch }) - addTest('retina', function () { + addTest('retina', function() { var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), ' + '(min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), ' + '(min-resolution: 1.5dppx)' @@ -25,28 +25,30 @@ module.exports = function BrowserInfoServiceFactory() { return !!(window.matchMedia && window.matchMedia(mediaQuery).matches) }) - addTest('small', function () { + addTest('small', function() { var windowWidth = window.screen.width < window.outerWidth ? window.screen.width : window.outerWidth return windowWidth < 800 }) - addTest('mobile', function () { + addTest('mobile', function() { return !!(service.small && service.touch) }) - addTest('os', function () { + addTest('os', function() { var ua = navigator.userAgent if (ua.match(/Android/i)) { return 'android' - } else if (ua.match(/iPhone|iPad|iPod/i)) { + } + else if (ua.match(/iPhone|iPad|iPod/i)) { return 'ios' - } else { + } + else { return 'pc' } }) - addTest('webgl', function () { + addTest('webgl', function() { var canvas = createElement('canvas') if ('supportsContext' in canvas) { return canvas.supportsContext('webgl') || diff --git a/res/app/components/stf/browser-info/browser-info-spec.js b/res/app/components/stf/browser-info/browser-info-spec.js index 101d5bf2..de93ba82 100644 --- a/res/app/components/stf/browser-info/browser-info-spec.js +++ b/res/app/components/stf/browser-info/browser-info-spec.js @@ -4,7 +4,7 @@ describe('BrowserInfo', function() { it('should ...', inject(function() { - //expect(BrowserInfo.doSomething()).toEqual('something'); + // expect(BrowserInfo.doSomething()).toEqual('something') })) diff --git a/res/app/components/stf/common-ui/badge-icon/badge-icon-directive.js b/res/app/components/stf/common-ui/badge-icon/badge-icon-directive.js index 8d041d8a..58ba96ce 100644 --- a/res/app/components/stf/common-ui/badge-icon/badge-icon-directive.js +++ b/res/app/components/stf/common-ui/badge-icon/badge-icon-directive.js @@ -5,7 +5,7 @@ module.exports = function badgeIconDirective() { scope: { }, template: require('./badge-icon.jade'), - link: function () { + link: function() { } } } diff --git a/res/app/components/stf/common-ui/badge-icon/badge-icon-spec.js b/res/app/components/stf/common-ui/badge-icon/badge-icon-spec.js index 2ceae045..b1b74859 100644 --- a/res/app/components/stf/common-ui/badge-icon/badge-icon-spec.js +++ b/res/app/components/stf/common-ui/badge-icon/badge-icon-spec.js @@ -1,15 +1,15 @@ -describe('badgeIcon', function () { +describe('badgeIcon', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('badgeIcon', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/blur-element/blur-element-directive.js b/res/app/components/stf/common-ui/blur-element/blur-element-directive.js index fdf99d98..fc4572e4 100644 --- a/res/app/components/stf/common-ui/blur-element/blur-element-directive.js +++ b/res/app/components/stf/common-ui/blur-element/blur-element-directive.js @@ -1,18 +1,18 @@ module.exports = function blurElementDirective($parse, $timeout) { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var model = $parse(attrs.blurElement) - scope.$watch(model, function (value) { + scope.$watch(model, function(value) { if (value === true) { - $timeout(function () { + $timeout(function() { element[0].blur() }) } }) - element.bind('blur', function () { + element.bind('blur', function() { scope.$apply(model.assign(scope, false)) }) } diff --git a/res/app/components/stf/common-ui/blur-element/blur-element-spec.js b/res/app/components/stf/common-ui/blur-element/blur-element-spec.js index 221b9b85..96ddef5f 100644 --- a/res/app/components/stf/common-ui/blur-element/blur-element-spec.js +++ b/res/app/components/stf/common-ui/blur-element/blur-element-spec.js @@ -1,15 +1,15 @@ -describe('blurElement', function () { +describe('blurElement', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('blurElement', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/clear-button/clear-button-spec.js b/res/app/components/stf/common-ui/clear-button/clear-button-spec.js index 6fc6c6f7..a636179b 100644 --- a/res/app/components/stf/common-ui/clear-button/clear-button-spec.js +++ b/res/app/components/stf/common-ui/clear-button/clear-button-spec.js @@ -1,20 +1,20 @@ -describe('clearButton', function () { +describe('clearButton', function() { beforeEach(angular.mock.module(require('./').name)) var scope, compile - beforeEach(inject(function ($rootScope, $compile) { + beforeEach(inject(function($rootScope, $compile) { scope = $rootScope.$new() compile = $compile })) - it('should display a text label', function () { + it('should display a text label', function() { var element = compile('')(scope) expect(element.find('span').text()).toBe('Clear') }) - it('should display a trash icon', function () { + it('should display a trash icon', function() { var element = compile('')(scope) expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o') }) diff --git a/res/app/components/stf/common-ui/counter/counter-directive.js b/res/app/components/stf/common-ui/counter/counter-directive.js index 0183a026..153dd2e6 100644 --- a/res/app/components/stf/common-ui/counter/counter-directive.js +++ b/res/app/components/stf/common-ui/counter/counter-directive.js @@ -2,15 +2,15 @@ module.exports = function counterDirective($timeout) { return { replace: false, scope: true, - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var el = element[0] var num, refreshInterval, duration, steps, step, countTo, increment - var calculate = function () { + var calculate = function() { refreshInterval = 32 step = 0 scope.timoutId = null - countTo = parseInt(attrs.countTo) || 0 + countTo = parseInt(attrs.countTo, 10) || 0 scope.value = parseInt(attrs.countFrom, 10) || 0 duration = parseFloat(attrs.duration) || 0 @@ -20,15 +20,16 @@ module.exports = function counterDirective($timeout) { num = scope.value } - var tick = function () { - scope.timoutId = $timeout(function () { + var tick = function() { + scope.timoutId = $timeout(function() { num += increment step++ if (step >= steps) { $timeout.cancel(scope.timoutId) num = countTo el.innerText = countTo - } else { + } + else { el.innerText = Math.round(num) tick() } @@ -36,7 +37,7 @@ module.exports = function counterDirective($timeout) { } - var start = function () { + var start = function() { if (scope.timoutId) { $timeout.cancel(scope.timoutId) } @@ -44,13 +45,13 @@ module.exports = function counterDirective($timeout) { tick() } - attrs.$observe('countTo', function (val) { + attrs.$observe('countTo', function(val) { if (val) { start() } }) - attrs.$observe('countFrom', function (/*val*/) { + attrs.$observe('countFrom', function() { start() }) diff --git a/res/app/components/stf/common-ui/counter/counter-spec.js b/res/app/components/stf/common-ui/counter/counter-spec.js index 61ef1dce..d914ff03 100644 --- a/res/app/components/stf/common-ui/counter/counter-spec.js +++ b/res/app/components/stf/common-ui/counter/counter-spec.js @@ -1,15 +1,15 @@ -describe('counter', function () { +describe('counter', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('counter', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/enable-autofill/enable-autofill-directive.js b/res/app/components/stf/common-ui/enable-autofill/enable-autofill-directive.js index c4bec556..6b58f10a 100644 --- a/res/app/components/stf/common-ui/enable-autofill/enable-autofill-directive.js +++ b/res/app/components/stf/common-ui/enable-autofill/enable-autofill-directive.js @@ -15,7 +15,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) { tElement.attr('method', 'post') } else { if (!tAttrs.method.match(/post/i)) { - console.error('Auto-fill only works with form POST method') + throw new Error('Auto-fill only works with form POST method') } } @@ -43,7 +43,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) { } return { - pre: function (scope, element, attrs) { + pre: function(scope, element, attrs) { // Angular needs this so the form action doesn't get removed // Also, trying to set a url at this time doesn't work neither attrs.action = '' diff --git a/res/app/components/stf/common-ui/enable-autofill/enable-autofill-spec.js b/res/app/components/stf/common-ui/enable-autofill/enable-autofill-spec.js index 3978807a..6f7cad3b 100644 --- a/res/app/components/stf/common-ui/enable-autofill/enable-autofill-spec.js +++ b/res/app/components/stf/common-ui/enable-autofill/enable-autofill-spec.js @@ -1,15 +1,15 @@ -describe('enableAutofill', function () { +describe('enableAutofill', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('enableAutofill', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/error-message/error-message-directive.js b/res/app/components/stf/common-ui/error-message/error-message-directive.js index 115c4dea..f7ccaac9 100644 --- a/res/app/components/stf/common-ui/error-message/error-message-directive.js +++ b/res/app/components/stf/common-ui/error-message/error-message-directive.js @@ -6,8 +6,8 @@ module.exports = function errorMessageDirective() { message: '@' }, template: require('./error-message.jade'), - link: function (scope) { - scope.closeMessage = function () { + link: function(scope) { + scope.closeMessage = function() { scope.message = '' } } diff --git a/res/app/components/stf/common-ui/error-message/error-message-spec.js b/res/app/components/stf/common-ui/error-message/error-message-spec.js index 5c11de7d..3c711f15 100644 --- a/res/app/components/stf/common-ui/error-message/error-message-spec.js +++ b/res/app/components/stf/common-ui/error-message/error-message-spec.js @@ -1,15 +1,15 @@ -describe('errorMessage', function () { +describe('errorMessage', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, compile - beforeEach(inject(function ($rootScope, $compile) { + beforeEach(inject(function($rootScope, $compile) { scope = $rootScope.$new() compile = $compile })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, diff --git a/res/app/components/stf/common-ui/fallback-image/fallback-image-spec.js b/res/app/components/stf/common-ui/fallback-image/fallback-image-spec.js index c6df4389..082c8c27 100644 --- a/res/app/components/stf/common-ui/fallback-image/fallback-image-spec.js +++ b/res/app/components/stf/common-ui/fallback-image/fallback-image-spec.js @@ -1,15 +1,15 @@ -describe('fallbackImage', function () { +describe('fallbackImage', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('fallbackImage', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/filter-button/filter-button-spec.js b/res/app/components/stf/common-ui/filter-button/filter-button-spec.js index e848992b..a414d835 100644 --- a/res/app/components/stf/common-ui/filter-button/filter-button-spec.js +++ b/res/app/components/stf/common-ui/filter-button/filter-button-spec.js @@ -1,15 +1,15 @@ -describe('filterButton', function () { +describe('filterButton', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your @@ -19,5 +19,5 @@ describe('filterButton', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/focus-element/focus-element-directive.js b/res/app/components/stf/common-ui/focus-element/focus-element-directive.js index eb4fb890..8c3b503b 100644 --- a/res/app/components/stf/common-ui/focus-element/focus-element-directive.js +++ b/res/app/components/stf/common-ui/focus-element/focus-element-directive.js @@ -1,18 +1,18 @@ module.exports = function focusElementDirective($parse, $timeout) { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var model = $parse(attrs.focusElement) - scope.$watch(model, function (value) { + scope.$watch(model, function(value) { if (value === true) { - $timeout(function () { + $timeout(function() { element[0].focus() }) } }) - element.bind('blur', function () { + element.bind('blur', function() { if (model && model.assign) { scope.$apply(model.assign(scope, false)) } diff --git a/res/app/components/stf/common-ui/focus-element/focus-element-spec.js b/res/app/components/stf/common-ui/focus-element/focus-element-spec.js index de6b713b..52773642 100644 --- a/res/app/components/stf/common-ui/focus-element/focus-element-spec.js +++ b/res/app/components/stf/common-ui/focus-element/focus-element-spec.js @@ -1,15 +1,15 @@ -describe('focusElement', function () { +describe('focusElement', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('focusElement', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-directive.js b/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-directive.js index da30ad20..ea52778d 100644 --- a/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-directive.js +++ b/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-directive.js @@ -1,7 +1,7 @@ module.exports = function iconInsideInputDirective() { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { // NOTE: this doesn't work on Chrome with auto-fill, known Chrome bug element.css({ 'background-repeat': 'no-repeat', @@ -11,7 +11,7 @@ module.exports = function iconInsideInputDirective() { attrs.$observe('iconInsideInput', function(value) { element.css({ - 'background-image': 'url(' + value +')' + 'background-image': 'url(' + value + ')' }) }) } diff --git a/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-spec.js b/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-spec.js index cc5192c5..e62c209f 100644 --- a/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-spec.js +++ b/res/app/components/stf/common-ui/icon-inside-input/icon-inside-input-spec.js @@ -1,15 +1,15 @@ -describe('iconInsideInput', function () { +describe('iconInsideInput', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('iconInsideInput', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/include-cached/compile-cache-service.js b/res/app/components/stf/common-ui/include-cached/compile-cache-service.js index 4ca2d9a5..a1bdc050 100644 --- a/res/app/components/stf/common-ui/include-cached/compile-cache-service.js +++ b/res/app/components/stf/common-ui/include-cached/compile-cache-service.js @@ -1,12 +1,12 @@ -module.exports = function ($http, $templateCache, $compile) { +module.exports = function($http, $templateCache, $compile) { var cache = {} - return function (src, scope, cloneAttachFn) { + return function(src, scope, cloneAttachFn) { var compileFn = cache[src] if (compileFn) { compileFn(scope, cloneAttachFn) } else { - $http.get(src, { cache: $templateCache }).success(function (response) { + $http.get(src, {cache: $templateCache}).success(function(response) { var responseContents = angular.element('
').html(response).contents() compileFn = cache[src] = $compile(responseContents) compileFn(scope, cloneAttachFn) diff --git a/res/app/components/stf/common-ui/include-cached/include-cached-directive.js b/res/app/components/stf/common-ui/include-cached/include-cached-directive.js index 563ed103..b176907c 100644 --- a/res/app/components/stf/common-ui/include-cached/include-cached-directive.js +++ b/res/app/components/stf/common-ui/include-cached/include-cached-directive.js @@ -2,13 +2,13 @@ module.exports = function includeCachedDirective(CompileCacheService) { return { restrict: 'ECA', terminal: true, - compile: function (element, attrs) { + compile: function(element, attrs) { var srcExp = attrs.ngIncludeCached || attrs.src - return function (scope, element) { + return function(scope, element) { var src = scope.$eval(srcExp) var newScope = scope.$new() - CompileCacheService(src, newScope, function (compiledElm) { + CompileCacheService(src, newScope, function(compiledElm) { element.append(compiledElm) }) } diff --git a/res/app/components/stf/common-ui/include-cached/include-cached-spec.js b/res/app/components/stf/common-ui/include-cached/include-cached-spec.js index 5bf37e99..cdded23b 100644 --- a/res/app/components/stf/common-ui/include-cached/include-cached-spec.js +++ b/res/app/components/stf/common-ui/include-cached/include-cached-spec.js @@ -1,15 +1,15 @@ -describe('includeCached', function () { +describe('includeCached', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('includeCached', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js index 342b73cc..9e4d3ac3 100644 --- a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-service.js @@ -2,33 +2,33 @@ module.exports = function AddAdbKeyModalServiceFactory($uibModal) { var service = {} - var ModalInstanceCtrl = function ($scope, $uibModalInstance, data) { + var ModalInstanceCtrl = function($scope, $uibModalInstance, data) { $scope.modal = {} $scope.modal.showAdd = true $scope.modal.fingerprint = data.fingerprint $scope.modal.title = data.title - $scope.ok = function () { + $scope.ok = function() { $uibModalInstance.close(true) } - $scope.$watch('modal.showAdd', function (newValue) { + $scope.$watch('modal.showAdd', function(newValue) { if (newValue === false) { $scope.ok() } }) - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } } - service.open = function (data) { + service.open = function(data) { var modalInstance = $uibModal.open({ template: require('./add-adb-key-modal.jade'), controller: ModalInstanceCtrl, resolve: { - data: function () { + data: function() { return data } } diff --git a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js index 1639a7be..83340163 100644 --- a/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js +++ b/res/app/components/stf/common-ui/modals/add-adb-key-modal/add-adb-key-modal-spec.js @@ -1,11 +1,11 @@ describe('FatalMessageService', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(FatalMessageService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-service.js b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-service.js index 54798b24..50b97e2e 100644 --- a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-service.js +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-service.js @@ -1,8 +1,8 @@ module.exports = function ServiceFactory($uibModal, $sce) { var service = {} - var ModalInstanceCtrl = function ($scope, $uibModalInstance, url, title, icon) { - $scope.ok = function () { + var ModalInstanceCtrl = function($scope, $uibModalInstance, url, title, icon) { + $scope.ok = function() { $uibModalInstance.close(true) } @@ -10,12 +10,12 @@ module.exports = function ServiceFactory($uibModal, $sce) { $scope.title = title $scope.icon = icon - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } } - service.open = function (url, title, icon) { + service.open = function(url, title, icon) { var modalInstance = $uibModal.open({ template: require('./external-url-modal.jade'), controller: ModalInstanceCtrl, @@ -24,17 +24,17 @@ module.exports = function ServiceFactory($uibModal, $sce) { title: function() { return title }, - url: function () { + url: function() { return url }, - icon: function () { + icon: function() { return icon } } }) - modalInstance.result.then(function () { - }, function () { + modalInstance.result.then(function() { + }, function() { }) } diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js index 863a675c..819bfe70 100644 --- a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js @@ -1,11 +1,11 @@ describe('ExternalUrlModalService', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(FatalMessageService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js b/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js index 395d38b5..e888d574 100644 --- a/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js +++ b/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js @@ -1,8 +1,8 @@ // TODO: Test this -module.exports = function () { - return function (scope, element, attrs) { - scope.$watch(attrs.pageVisible, function () { - element.bind('load', function () { +module.exports = function() { + return function(scope, element, attrs) { + scope.$watch(attrs.pageVisible, function() { + element.bind('load', function() { scope.$apply(attrs.pageLoad) }) }) diff --git a/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-service.js b/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-service.js index d6519e33..aa552397 100644 --- a/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-service.js +++ b/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-service.js @@ -5,9 +5,9 @@ module.exports = var intervalDeviceInfo - var ModalInstanceCtrl = function ($scope, $uibModalInstance, device, + var ModalInstanceCtrl = function($scope, $uibModalInstance, device, tryToReconnect) { - $scope.ok = function () { + $scope.ok = function() { $uibModalInstance.close(true) $route.reload() } @@ -24,7 +24,7 @@ module.exports = if (tryToReconnect) { // TODO: this is ugly, find why its not updated correctly (also on the device list) - intervalDeviceInfo = $interval(function () { + intervalDeviceInfo = $interval(function() { update() if (device.usable) { @@ -34,43 +34,43 @@ module.exports = }, 1000, 500) } - $scope.second = function () { + $scope.second = function() { $uibModalInstance.dismiss() $location.path('/devices/') } - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } - var destroyInterval = function () { + var destroyInterval = function() { if (angular.isDefined(intervalDeviceInfo)) { $interval.cancel(intervalDeviceInfo) intervalDeviceInfo = undefined } } - $scope.$on('$destroy', function () { + $scope.$on('$destroy', function() { destroyInterval() }) } - FatalMessageService.open = function (device, tryToReconnect) { + FatalMessageService.open = function(device, tryToReconnect) { var modalInstance = $uibModal.open({ template: require('./fatal-message.jade'), controller: ModalInstanceCtrl, resolve: { - device: function () { + device: function() { return device }, - tryToReconnect: function () { + tryToReconnect: function() { return tryToReconnect } } }) - modalInstance.result.then(function () { - }, function () { + modalInstance.result.then(function() { + }, function() { }) } diff --git a/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-spec.js b/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-spec.js index 1639a7be..83340163 100644 --- a/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-spec.js +++ b/res/app/components/stf/common-ui/modals/fatal-message/fatal-message-spec.js @@ -1,11 +1,11 @@ describe('FatalMessageService', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(FatalMessageService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-service.js b/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-service.js index 727b23cd..dc81fdc2 100644 --- a/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-service.js +++ b/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-service.js @@ -1,20 +1,20 @@ module.exports = function ServiceFactory($uibModal) { var service = {} - var ModalInstanceCtrl = function ($scope, $uibModalInstance, title, imageUrl) { - $scope.ok = function () { + var ModalInstanceCtrl = function($scope, $uibModalInstance, title, imageUrl) { + $scope.ok = function() { $uibModalInstance.close(true) } $scope.title = title $scope.imageUrl = imageUrl - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } } - service.open = function (title, imageUrl) { + service.open = function(title, imageUrl) { var modalInstance = $uibModal.open({ template: require('./lightbox-image.jade'), controller: ModalInstanceCtrl, @@ -23,14 +23,14 @@ module.exports = function ServiceFactory($uibModal) { title: function() { return title }, - imageUrl: function () { + imageUrl: function() { return imageUrl } } }) - modalInstance.result.then(function () { - }, function () { + modalInstance.result.then(function() { + }, function() { }) } diff --git a/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-spec.js b/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-spec.js index 7a2b9a72..0d5a2454 100644 --- a/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-spec.js +++ b/res/app/components/stf/common-ui/modals/lightbox-image/lightbox-image-spec.js @@ -1,11 +1,11 @@ describe('LightboxImageService', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(XLightboxImageService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/common-ui/modals/socket-disconnected/socket-disconnected-service.js b/res/app/components/stf/common-ui/modals/socket-disconnected/socket-disconnected-service.js index f1ff24b7..3f6ee617 100644 --- a/res/app/components/stf/common-ui/modals/socket-disconnected/socket-disconnected-service.js +++ b/res/app/components/stf/common-ui/modals/socket-disconnected/socket-disconnected-service.js @@ -2,33 +2,33 @@ module.exports = function SocketDisconnectedServiceFactory($uibModal, $location, $window) { var service = {} - var ModalInstanceCtrl = function ($scope, $uibModalInstance, message) { - $scope.ok = function () { + var ModalInstanceCtrl = function($scope, $uibModalInstance, message) { + $scope.ok = function() { $uibModalInstance.close(true) $window.location.reload() } $scope.message = message - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } } - service.open = function (message) { + service.open = function(message) { var modalInstance = $uibModal.open({ template: require('./socket-disconnected.jade'), controller: ModalInstanceCtrl, resolve: { - message: function () { + message: function() { return message } } }) - modalInstance.result.then(function () { - }, function () { + modalInstance.result.then(function() { + }, function() { }) } diff --git a/res/app/components/stf/common-ui/modals/version-update/version-update-service.js b/res/app/components/stf/common-ui/modals/version-update/version-update-service.js index bcfdfd2c..ae3a9a9d 100644 --- a/res/app/components/stf/common-ui/modals/version-update/version-update-service.js +++ b/res/app/components/stf/common-ui/modals/version-update/version-update-service.js @@ -1,25 +1,25 @@ module.exports = function ServiceFactory($uibModal, $location) { var service = {} - var ModalInstanceCtrl = function ($scope, $uibModalInstance) { - $scope.ok = function () { + var ModalInstanceCtrl = function($scope, $uibModalInstance) { + $scope.ok = function() { $uibModalInstance.close(true) $location.path('/') } - $scope.cancel = function () { + $scope.cancel = function() { $uibModalInstance.dismiss('cancel') } } - service.open = function () { + service.open = function() { var modalInstance = $uibModal.open({ template: require('./version-update.jade'), controller: ModalInstanceCtrl }) - modalInstance.result.then(function (/*selectedItem*/) { - }, function () { + modalInstance.result.then(function(/*selectedItem*/) { + }, function() { }) } diff --git a/res/app/components/stf/common-ui/modals/version-update/version-update-spec.js b/res/app/components/stf/common-ui/modals/version-update/version-update-spec.js index 1fb2587c..d2bd8758 100644 --- a/res/app/components/stf/common-ui/modals/version-update/version-update-spec.js +++ b/res/app/components/stf/common-ui/modals/version-update/version-update-spec.js @@ -1,12 +1,12 @@ describe('VersionUpdateService', function() { - beforeEach(angular.mock.module(require('ui-bootstrap').name)); - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('ui-bootstrap').name)) + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(VersionUpdateService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/common-ui/ng-enter/ng-enter-directive.js b/res/app/components/stf/common-ui/ng-enter/ng-enter-directive.js index 276a31a2..1f8b9771 100644 --- a/res/app/components/stf/common-ui/ng-enter/ng-enter-directive.js +++ b/res/app/components/stf/common-ui/ng-enter/ng-enter-directive.js @@ -1,12 +1,12 @@ module.exports = function ngEnterDirective() { - return function (scope, element, attrs) { - element.bind("keydown keypress", function (event) { + return function(scope, element, attrs) { + element.bind('keydown keypress', function(event) { if (event.which === 13) { - scope.$apply(function () { - scope.$eval(attrs.ngEnter, {'event': event}) + scope.$apply(function() { + scope.$eval(attrs.ngEnter, {event: event}) }) event.preventDefault() } }) } -} \ No newline at end of file +} diff --git a/res/app/components/stf/common-ui/ng-enter/ng-enter-spec.js b/res/app/components/stf/common-ui/ng-enter/ng-enter-spec.js index 0edb93d9..e9546324 100644 --- a/res/app/components/stf/common-ui/ng-enter/ng-enter-spec.js +++ b/res/app/components/stf/common-ui/ng-enter/ng-enter-spec.js @@ -1,15 +1,15 @@ -describe('ngEnter', function () { +describe('ngEnter', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('ngEnter', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/nice-tabs/nice-tab-directive.js b/res/app/components/stf/common-ui/nice-tabs/nice-tab-directive.js index 0be36bb8..3406c29f 100644 --- a/res/app/components/stf/common-ui/nice-tabs/nice-tab-directive.js +++ b/res/app/components/stf/common-ui/nice-tabs/nice-tab-directive.js @@ -6,7 +6,7 @@ module.exports = function niceTabDirective() { scope: { }, template: require('./nice-tab.jade'), - link: function () { + link: function() { } } } diff --git a/res/app/components/stf/common-ui/nice-tabs/nice-tabs-directive.js b/res/app/components/stf/common-ui/nice-tabs/nice-tabs-directive.js index ec2bcc99..a666080e 100644 --- a/res/app/components/stf/common-ui/nice-tabs/nice-tabs-directive.js +++ b/res/app/components/stf/common-ui/nice-tabs/nice-tabs-directive.js @@ -3,25 +3,25 @@ module.exports = function niceTabsDirective() { restrict: 'EA', replace: true, template: require('./nice-tabs.jade'), - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { // TODO: add support for 'key' for saving in Settings // TODO: add support for 'direction=below' for below tabs - scope.$watch(attrs.tabs, function (newValue) { + scope.$watch(attrs.tabs, function(newValue) { scope.tabs = newValue }) - scope.$watch(attrs.filter, function (newValue) { + scope.$watch(attrs.filter, function(newValue) { scope.filter = newValue }) - scope.tabFound = function (tab) { + scope.tabFound = function(tab) { if (!tab.filters) { return true } var found = false - angular.forEach(tab.filters, function (value) { + angular.forEach(tab.filters, function(value) { if (value === scope.filter) { found = true } diff --git a/res/app/components/stf/common-ui/nice-tabs/nice-tabs-spec.js b/res/app/components/stf/common-ui/nice-tabs/nice-tabs-spec.js index 38040a3c..f7bee4f8 100644 --- a/res/app/components/stf/common-ui/nice-tabs/nice-tabs-spec.js +++ b/res/app/components/stf/common-ui/nice-tabs/nice-tabs-spec.js @@ -1,15 +1,15 @@ -describe('niceTabs', function () { +describe('niceTabs', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('niceTabs', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/nothing-to-show/nothing-to-show-directive.js b/res/app/components/stf/common-ui/nothing-to-show/nothing-to-show-directive.js index 6418c2c9..e02533cb 100644 --- a/res/app/components/stf/common-ui/nothing-to-show/nothing-to-show-directive.js +++ b/res/app/components/stf/common-ui/nothing-to-show/nothing-to-show-directive.js @@ -1,4 +1,4 @@ -module.exports = function () { +module.exports = function() { return { restrict: 'EA', transclude: true, @@ -7,7 +7,7 @@ module.exports = function () { message: '@' }, template: require('./nothing-to-show.html'), - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { scope.icon = attrs.icon scope.message = attrs.message } diff --git a/res/app/components/stf/common-ui/refresh-page/refresh-page-directive.js b/res/app/components/stf/common-ui/refresh-page/refresh-page-directive.js index 34cf8a42..8a8f05e2 100644 --- a/res/app/components/stf/common-ui/refresh-page/refresh-page-directive.js +++ b/res/app/components/stf/common-ui/refresh-page/refresh-page-directive.js @@ -5,8 +5,8 @@ module.exports = function refreshPageDirective($window) { scope: { }, template: require('./refresh-page.jade'), - link: function (scope) { - scope.reloadWindow = function () { + link: function(scope) { + scope.reloadWindow = function() { $window.location.reload() } } diff --git a/res/app/components/stf/common-ui/refresh-page/refresh-page-spec.js b/res/app/components/stf/common-ui/refresh-page/refresh-page-spec.js index 33c5fd23..9f4431d5 100644 --- a/res/app/components/stf/common-ui/refresh-page/refresh-page-spec.js +++ b/res/app/components/stf/common-ui/refresh-page/refresh-page-spec.js @@ -1,15 +1,15 @@ -describe('refreshPage', function () { +describe('refreshPage', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your @@ -19,5 +19,5 @@ describe('refreshPage', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/safe-apply/index.js b/res/app/components/stf/common-ui/safe-apply/index.js index ff4bf5c3..2a3473b7 100644 --- a/res/app/components/stf/common-ui/safe-apply/index.js +++ b/res/app/components/stf/common-ui/safe-apply/index.js @@ -1,11 +1,11 @@ module.exports = angular.module('stf.safe-apply', []) .config([ - '$provide', function ($provide) { + '$provide', function($provide) { return $provide.decorator('$rootScope', [ - '$delegate', function ($delegate) { - $delegate.safeApply = function (fn) { + '$delegate', function($delegate) { + $delegate.safeApply = function(fn) { var phase = $delegate.$$phase - if (phase === "$apply" || phase === "$digest") { + if (phase === '$apply' || phase === '$digest') { if (fn && typeof fn === 'function') { fn() } diff --git a/res/app/components/stf/common-ui/text-focus-select/text-focus-select-directive.js b/res/app/components/stf/common-ui/text-focus-select/text-focus-select-directive.js index 98a2040f..62a0cd4b 100644 --- a/res/app/components/stf/common-ui/text-focus-select/text-focus-select-directive.js +++ b/res/app/components/stf/common-ui/text-focus-select/text-focus-select-directive.js @@ -1,9 +1,9 @@ module.exports = function textFocusSelectDirective() { return { restrict: 'AC', - link: function (scope, element) { + link: function(scope, element) { // TODO: try with focus event - element.bind('click', function () { + element.bind('click', function() { this.select() }) } diff --git a/res/app/components/stf/common-ui/text-focus-select/text-focus-select-spec.js b/res/app/components/stf/common-ui/text-focus-select/text-focus-select-spec.js index dc6498a1..ebb54e7e 100644 --- a/res/app/components/stf/common-ui/text-focus-select/text-focus-select-spec.js +++ b/res/app/components/stf/common-ui/text-focus-select/text-focus-select-spec.js @@ -1,15 +1,15 @@ -describe('textFocusSelect', function () { +describe('textFocusSelect', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('textFocusSelect', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/common-ui/tooltips/tooltips-directive.js b/res/app/components/stf/common-ui/tooltips/tooltips-directive.js index 5e3f16d2..d0056822 100644 --- a/res/app/components/stf/common-ui/tooltips/tooltips-directive.js +++ b/res/app/components/stf/common-ui/tooltips/tooltips-directive.js @@ -1,7 +1,7 @@ module.exports = function tooltipsDirective() { return { restrict: 'A', - link: function () { + link: function() { } } } diff --git a/res/app/components/stf/common-ui/tooltips/tooltips-spec.js b/res/app/components/stf/common-ui/tooltips/tooltips-spec.js index cbb6bcac..fb05dece 100644 --- a/res/app/components/stf/common-ui/tooltips/tooltips-spec.js +++ b/res/app/components/stf/common-ui/tooltips/tooltips-spec.js @@ -1,15 +1,15 @@ -describe('tooltips', function () { +describe('tooltips', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('tooltips', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/control/control-service.js b/res/app/components/stf/control/control-service.js index d3b23fdf..5246860e 100644 --- a/res/app/components/stf/control/control-service.js +++ b/res/app/components/stf/control/control-service.js @@ -71,28 +71,28 @@ module.exports = function ControlServiceFactory( }) } - this.touchUp = function(seq, contact) { + this.touchUp = function(seq, contact) { sendOneWay('input.touchUp', { seq: seq , contact: contact }) } - this.touchCommit = function(seq) { + this.touchCommit = function(seq) { sendOneWay('input.touchCommit', { seq: seq }) } - this.touchReset = function(seq) { + this.touchReset = function(seq) { sendOneWay('input.touchReset', { seq: seq }) } - this.keyDown = keySender('input.keyDown') - this.keyUp = keySender('input.keyUp') - this.keyPress = keySender('input.keyPress') + this.keyDown = keySender('input.keyDown') + this.keyUp = keySender('input.keyUp') + this.keyPress = keySender('input.keyPress') this.home = keySender('input.keyPress', 'home') this.menu = keySender('input.keyPress', 'menu') @@ -116,9 +116,9 @@ module.exports = function ControlServiceFactory( //@TODO: Refactor this please var that = this - this.getClipboardContent = function () { - that.copy().then(function (result) { - $rootScope.$apply(function () { + this.getClipboardContent = function() { + that.copy().then(function(result) { + $rootScope.$apply(function() { if (result.success) { if (result.lastData) { that.clipboardContent = result.lastData @@ -167,16 +167,16 @@ module.exports = function ControlServiceFactory( this.testForward = function(forward) { return sendTwoWay('forward.test', { targetHost: forward.targetHost - , targetPort: +forward.targetPort + , targetPort: Number(forward.targetPort) }) } this.createForward = function(forward) { return sendTwoWay('forward.create', { id: forward.id - , devicePort: +forward.devicePort + , devicePort: Number(forward.devicePort) , targetHost: forward.targetHost - , targetPort: +forward.targetPort + , targetPort: Number(forward.targetPort) }) } @@ -225,15 +225,15 @@ module.exports = function ControlServiceFactory( return sendTwoWay('screen.capture') } - this.fsretrieve = function(file){ + this.fsretrieve = function(file) { return sendTwoWay('fs.retrieve', { - file: file, + file: file }) } - this.fslist = function(dir){ + this.fslist = function(dir) { return sendTwoWay('fs.list', { - dir: dir, + dir: dir }) } diff --git a/res/app/components/stf/device-context-menu/device-context-menu-directive.js b/res/app/components/stf/device-context-menu/device-context-menu-directive.js index e5fe5baa..33839df6 100644 --- a/res/app/components/stf/device-context-menu/device-context-menu-directive.js +++ b/res/app/components/stf/device-context-menu/device-context-menu-directive.js @@ -8,15 +8,15 @@ module.exports = function deviceContextMenuDirective($window) { //}, transclude: true, template: require('./device-context-menu.jade'), - link: function (scope) { + link: function(scope) { //var device = scope.device() //var control = scope.control() - scope.windowClose = function () { + scope.windowClose = function() { $window.close() } - scope.saveScreenShot = function () { - scope.control.screenshot().then(function (result) { + scope.saveScreenShot = function() { + scope.control.screenshot().then(function(result) { location.href = result.body.href + '?download' }) } diff --git a/res/app/components/stf/device-context-menu/device-context-menu-spec.js b/res/app/components/stf/device-context-menu/device-context-menu-spec.js index a9f4b1e6..0c59b734 100644 --- a/res/app/components/stf/device-context-menu/device-context-menu-spec.js +++ b/res/app/components/stf/device-context-menu/device-context-menu-spec.js @@ -1,15 +1,15 @@ -describe('deviceContextMenu', function () { +describe('deviceContextMenu', function() { beforeEach(angular.mock.module(require('./').name)) var scope, compile - beforeEach(inject(function ($rootScope, $compile) { + beforeEach(inject(function($rootScope, $compile) { scope = $rootScope.$new() compile = $compile })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, diff --git a/res/app/components/stf/device/device-info-filter/index.js b/res/app/components/stf/device/device-info-filter/index.js index 7600df42..198ee0cf 100644 --- a/res/app/components/stf/device/device-info-filter/index.js +++ b/res/app/components/stf/device/device-info-filter/index.js @@ -1,78 +1,78 @@ module.exports = angular.module('stf.device-status', []) - .filter('statusNameAction', function (gettext) { - return function (text) { + .filter('statusNameAction', function(gettext) { + return function(text) { return { - 'absent': gettext('Disconnected'), - 'present': gettext('Connected'), - 'offline': gettext('Offline'), - 'unauthorized': gettext('Unauthorized'), - 'preparing': gettext('Preparing'), - 'ready': gettext('Ready'), - 'using': gettext('Stop Using'), - 'busy': gettext('Busy'), - 'available': gettext('Use') + absent: gettext('Disconnected'), + present: gettext('Connected'), + offline: gettext('Offline'), + unauthorized: gettext('Unauthorized'), + preparing: gettext('Preparing'), + ready: gettext('Ready'), + using: gettext('Stop Using'), + busy: gettext('Busy'), + available: gettext('Use') }[text] || gettext('Unknown') } }) - .filter('statusNamePassive', function (gettext) { - return function (text) { + .filter('statusNamePassive', function(gettext) { + return function(text) { return { - 'absent': gettext('Disconnected'), - 'present': gettext('Connected'), - 'offline': gettext('Offline'), - 'unauthorized': gettext('Unauthorized'), - 'preparing': gettext('Preparing'), - 'ready': gettext('Ready'), - 'using': gettext('Using'), - 'busy': gettext('Busy'), - 'available': gettext('Available') + absent: gettext('Disconnected'), + present: gettext('Connected'), + offline: gettext('Offline'), + unauthorized: gettext('Unauthorized'), + preparing: gettext('Preparing'), + ready: gettext('Ready'), + using: gettext('Using'), + busy: gettext('Busy'), + available: gettext('Available') }[text] || gettext('Unknown') } }) - .filter('likelyLeaveReason', function (gettext) { - return function (text) { + .filter('likelyLeaveReason', function(gettext) { + return function(text) { return { - 'ungroup_request': gettext('You (or someone else) kicked the device.'), - 'owner_change': gettext('Someone stole your device.'), - 'automatic_timeout': gettext('Device was kicked by automatic timeout. '), - 'device_absent': gettext('Device is not present anymore for some reason.'), - 'status_change': gettext('Device is present but offline.') + ungroup_request: gettext('You (or someone else) kicked the device.'), + owner_change: gettext('Someone stole your device.'), + automatic_timeout: gettext('Device was kicked by automatic timeout. '), + device_absent: gettext('Device is not present anymore for some reason.'), + status_change: gettext('Device is present but offline.') }[text] || gettext('Unknown reason.') } }) - .filter('batteryHealth', function (gettext) { - return function (text) { + .filter('batteryHealth', function(gettext) { + return function(text) { return { - 'cold': gettext('Cold'), - 'good': gettext('Good'), - 'dead': gettext('Dead'), - 'over_voltage': gettext('Over Voltage'), - 'overheat': gettext('Overheat'), - 'unspecified_failure': gettext('Unspecified Failure') + cold: gettext('Cold'), + good: gettext('Good'), + dead: gettext('Dead'), + over_voltage: gettext('Over Voltage'), + overheat: gettext('Overheat'), + unspecified_failure: gettext('Unspecified Failure') }[text] || gettext('-') } }) - .filter('batterySource', function (gettext) { - return function (text) { + .filter('batterySource', function(gettext) { + return function(text) { return { - 'ac': gettext('AC'), - 'usb': gettext('USB'), - 'wireless': gettext('Wireless') + ac: gettext('AC'), + usb: gettext('USB'), + wireless: gettext('Wireless') }[text] || gettext('-') } }) - .filter('batteryStatus', function (gettext) { - return function (text) { + .filter('batteryStatus', function(gettext) { + return function(text) { return { - 'charging': gettext('Charging'), - 'discharging': gettext('Discharging'), - 'full': gettext('Full'), - 'not_charging': gettext('Not Charging') + charging: gettext('Charging'), + discharging: gettext('Discharging'), + full: gettext('Full'), + not_charging: gettext('Not Charging') }[text] || gettext('-') } }) - .filter('displayDensity', function () { - return function (text) { + .filter('displayDensity', function() { + return function(text) { return { '0.5': 'LDPI', // (120 dpi) '1': 'MDPI', // (160 dpi) @@ -83,38 +83,36 @@ module.exports = angular.module('stf.device-status', []) }[text] || text } }) - .filter('networkType', function (gettext) { - return function (text) { + .filter('networkType', function(gettext) { + return function(text) { return { - 'bluetooth': gettext('Bluetooth'), - 'dummy': gettext('Dummy'), - 'ethernet': gettext('Ethernet'), - 'mobile': gettext('Mobile'), - 'mobile_dun': gettext('Mobile DUN'), - 'mobile_hipri': gettext('Mobile High Priority'), - 'mobile_mms': gettext('Mobile MMS'), - 'mobile_supl': gettext('Mobile SUPL'), - 'mobile_wifi': gettext('WiFi'), - 'wimax': gettext('WiMAX') + bluetooth: gettext('Bluetooth'), + dummy: gettext('Dummy'), + ethernet: gettext('Ethernet'), + mobile: gettext('Mobile'), + mobile_dun: gettext('Mobile DUN'), + mobile_hipri: gettext('Mobile High Priority'), + mobile_mms: gettext('Mobile MMS'), + mobile_supl: gettext('Mobile SUPL'), + mobile_wifi: gettext('WiFi'), + wimax: gettext('WiMAX') }[text] || text } }) - .filter('networkSubType', function (gettext) { - return function (text) { + .filter('networkSubType', function(gettext) { + return function(text) { return { - 'mobile_wifi': gettext('WiFi') + mobile_wifi: gettext('WiFi') }[text] || text } }) - .filter('humanizedBool', function (gettext) { - return function (text) { + .filter('humanizedBool', function(gettext) { + return function(text) { switch (text) { case true: return gettext('Yes') - break; case false: return gettext('No') - break; default: return gettext('-') } diff --git a/res/app/components/stf/device/device-service.js b/res/app/components/stf/device/device-service.js index 53b5246c..95aeb632 100644 --- a/res/app/components/stf/device/device-service.js +++ b/res/app/components/stf/device/device-service.js @@ -7,10 +7,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi function Tracker($scope, options) { var devices = [] - , devicesBySerial = Object.create(null) - , scopedSocket = socket.scoped($scope) - , digestTimer - , lastDigest + var devicesBySerial = Object.create(null) + var scopedSocket = socket.scoped($scope) + var digestTimer, lastDigest $scope.$on('$destroy', function() { clearTimeout(digestTimer) @@ -81,7 +80,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi var modify = function modify(data, newData) { _.merge(data, newData, function(a, b) { // New Arrays overwrite old Arrays - return _.isArray(b) ? b : undefined + if (_.isArray(b)) { + return b + } }) sync(data) this.emit('change', data) @@ -156,7 +157,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi Tracker.prototype = new EventEmitter() - deviceService.trackAll = function ($scope) { + deviceService.trackAll = function($scope) { var tracker = new Tracker($scope, { filter: function() { return true @@ -165,14 +166,14 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi }) oboe('/app/api/v1/devices') - .node('devices[*]', function (device) { + .node('devices[*]', function(device) { tracker.add(device) }) return tracker } - deviceService.trackGroup = function ($scope) { + deviceService.trackGroup = function($scope) { var tracker = new Tracker($scope, { filter: function(device) { return device.using @@ -181,7 +182,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi }) oboe('/app/api/v1/group') - .node('devices[*]', function (device) { + .node('devices[*]', function(device) { tracker.add(device) }) @@ -190,12 +191,12 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi deviceService.load = function(serial) { return $http.get('/app/api/v1/devices/' + serial) - .then(function (response) { + .then(function(response) { return response.data.device }) } - deviceService.get = function (serial, $scope) { + deviceService.get = function(serial, $scope) { var tracker = new Tracker($scope, { filter: function(device) { return device.serial === serial @@ -210,7 +211,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi }) } - deviceService.updateNote = function (serial, note) { + deviceService.updateNote = function(serial, note) { socket.emit('device.note', { serial: serial, note: note diff --git a/res/app/components/stf/device/enhance-device/enhance-device-service.js b/res/app/components/stf/device/enhance-device/enhance-device-service.js index 7f79fb3d..39afae92 100644 --- a/res/app/components/stf/device/enhance-device/enhance-device-service.js +++ b/res/app/components/stf/device/enhance-device/enhance-device-service.js @@ -55,13 +55,13 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) { if (device.owner) { device.enhancedUserProfileUrl = enhanceUserProfileUrl(device.owner.email) - device.enhancedUserName = device.owner.name || "No name" + device.enhancedUserName = device.owner.name || 'No name' } } function enhanceUserProfileUrl(email) { var url - var userProfileUrl = (function () { + var userProfileUrl = (function() { if (AppState && AppState.config && AppState.config.userProfileUrl) { return AppState.config.userProfileUrl } @@ -73,7 +73,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) { if (userProfileUrl && email) { url = userProfileUrl.indexOf('{user}') !== -1 ? userProfileUrl.replace('{user}', email) : - userProfileUrl + email; + userProfileUrl + email } } else if (email.indexOf('@') !== -1) { url = 'mailto:' + email @@ -83,7 +83,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) { return url } - service.enhance = function (device) { + service.enhance = function(device) { setState(device) enhanceDevice(device) enhanceDeviceDetails(device) diff --git a/res/app/components/stf/device/state-classes-service.js b/res/app/components/stf/device/state-classes-service.js index e96e9b24..dadf0725 100644 --- a/res/app/components/stf/device/state-classes-service.js +++ b/res/app/components/stf/device/state-classes-service.js @@ -1,7 +1,7 @@ module.exports = function StateClassesService() { var service = {} - service.stateButton = function (state) { + service.stateButton = function(state) { var stateClasses = { using: 'state-using btn-primary', busy: 'state-busy btn-warning', @@ -18,7 +18,7 @@ module.exports = function StateClassesService() { return stateClasses } - service.stateColor = function (state) { + service.stateColor = function(state) { var stateClasses = { using: 'state-using', busy: 'state-busy', diff --git a/res/app/components/stf/filter-string/filter-string-service.js b/res/app/components/stf/filter-string/filter-string-service.js index 694f7160..0b4875c5 100644 --- a/res/app/components/stf/filter-string/filter-string-service.js +++ b/res/app/components/stf/filter-string/filter-string-service.js @@ -6,11 +6,11 @@ module.exports = function FilterStringServiceFactory() { /** * Filters integer * - * @param searchValue - * @param str + * @param {string} searchValue Value to search + * @param {string} str Value to compare * @returns {boolean} true if matched */ - service.filterInteger = function (searchValue, str) { + service.filterInteger = function(searchValue, str) { var matched = true matched = service.filterString(searchValue + '', str + '') return matched @@ -19,11 +19,11 @@ module.exports = function FilterStringServiceFactory() { /** * Filters string * - * @param searchValue - * @param str + * @param {string} searchValue Value to search + * @param {string} str Value to compare * @returns {boolean} true if matched */ - service.filterString = function (searchValue, str) { + service.filterString = function(searchValue, str) { var matched = true var searchLowerCase = searchValue.toLowerCase() var searchContent = searchValue.slice(1) diff --git a/res/app/components/stf/image-onload/image-onload-animate-directive.js b/res/app/components/stf/image-onload/image-onload-animate-directive.js index a34bb72b..3a36549a 100644 --- a/res/app/components/stf/image-onload/image-onload-animate-directive.js +++ b/res/app/components/stf/image-onload/image-onload-animate-directive.js @@ -1,9 +1,9 @@ module.exports = function imageOnloadAnimateDirective($parse, $animate) { return { restrict: 'A', - link: function (scope, element) { + link: function(scope, element) { $animate.addClass(element, 'ng-image-not-loaded') - element.bind('load', function () { + element.bind('load', function() { $animate.removeClass(element, 'ng-image-not-loaded') //if(!scope.$$phase) { diff --git a/res/app/components/stf/image-onload/image-onload-directive.js b/res/app/components/stf/image-onload/image-onload-directive.js index 6df2d953..5744a951 100644 --- a/res/app/components/stf/image-onload/image-onload-directive.js +++ b/res/app/components/stf/image-onload/image-onload-directive.js @@ -1,7 +1,7 @@ module.exports = function imageOnloadDirective() { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { element.bind('load', function() { scope.$eval(attrs.imageOnload) // console.log('image is loaded') diff --git a/res/app/components/stf/image-onload/image-onload-spec.js b/res/app/components/stf/image-onload/image-onload-spec.js index 4f9b02a9..f644938e 100644 --- a/res/app/components/stf/image-onload/image-onload-spec.js +++ b/res/app/components/stf/image-onload/image-onload-spec.js @@ -1,15 +1,15 @@ -describe('imageOnload', function () { +describe('imageOnload', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('imageOnload', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/install/install-error-filter.js b/res/app/components/stf/install/install-error-filter.js index afea697d..63955fce 100644 --- a/res/app/components/stf/install/install-error-filter.js +++ b/res/app/components/stf/install/install-error-filter.js @@ -1,10 +1,10 @@ module.exports = function installErrorFilter(gettext) { - /*jshint maxlen:200*/ - return function (text) { + /* eslint max-len:0 */ + return function(text) { switch (text) { // Our error codes. - case "INSTALL_SUCCEEDED": - return gettext("Installation succeeded.") + case 'INSTALL_SUCCEEDED': + return gettext('Installation succeeded.') case 'INSTALL_ERROR_UNKNOWN': return gettext('Installation failed due to an unknown error.') case 'INSTALL_ERROR_TIMEOUT': @@ -14,80 +14,80 @@ module.exports = function installErrorFilter(gettext) { // Android PackageManager error codes from [1]. // [1] https://github.com/android/platform_frameworks_base/blob/ // master/core/java/android/content/pm/PackageManager.java - case "INSTALL_FAILED_ALREADY_EXISTS": - return gettext("The package is already installed.") - case "INSTALL_FAILED_INVALID_APK": - return gettext("The package archive file is invalid.") - case "INSTALL_FAILED_INVALID_URI": - return gettext("The URI passed in is invalid.") - case "INSTALL_FAILED_INSUFFICIENT_STORAGE": + case 'INSTALL_FAILED_ALREADY_EXISTS': + return gettext('The package is already installed.') + case 'INSTALL_FAILED_INVALID_APK': + return gettext('The package archive file is invalid.') + case 'INSTALL_FAILED_INVALID_URI': + return gettext('The URI passed in is invalid.') + case 'INSTALL_FAILED_INSUFFICIENT_STORAGE': return gettext("The package manager service found that the device didn't have enough storage space to install the app.") - case "INSTALL_FAILED_DUPLICATE_PACKAGE": - return gettext("A package is already installed with the same name.") - case "INSTALL_FAILED_NO_SHARED_USER": - return gettext("The requested shared user does not exist.") - case "INSTALL_FAILED_UPDATE_INCOMPATIBLE": + case 'INSTALL_FAILED_DUPLICATE_PACKAGE': + return gettext('A package is already installed with the same name.') + case 'INSTALL_FAILED_NO_SHARED_USER': + return gettext('The requested shared user does not exist.') + case 'INSTALL_FAILED_UPDATE_INCOMPATIBLE': return gettext("A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed).") - case "INSTALL_FAILED_MISSING_SHARED_LIBRARY": - return gettext("The new package uses a shared library that is not available.") - case "INSTALL_FAILED_REPLACE_COULDNT_DELETE": - return gettext("The existing package could not be deleted.") - case "INSTALL_FAILED_DEXOPT": - return gettext("The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.") - case "INSTALL_FAILED_OLDER_SDK": - return gettext("The new package failed because the current SDK version is older than that required by the package.") - case "INSTALL_FAILED_CONFLICTING_PROVIDER": - return gettext("The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.") - case "INSTALL_FAILED_NEWER_SDK": - return gettext("The new package failed because the current SDK version is newer than that required by the package.") - case "INSTALL_FAILED_TEST_ONLY": - return gettext("The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.") - case "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE": + case 'INSTALL_FAILED_MISSING_SHARED_LIBRARY': + return gettext('The new package uses a shared library that is not available.') + case 'INSTALL_FAILED_REPLACE_COULDNT_DELETE': + return gettext('The existing package could not be deleted.') + case 'INSTALL_FAILED_DEXOPT': + return gettext('The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.') + case 'INSTALL_FAILED_OLDER_SDK': + return gettext('The new package failed because the current SDK version is older than that required by the package.') + case 'INSTALL_FAILED_CONFLICTING_PROVIDER': + return gettext('The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.') + case 'INSTALL_FAILED_NEWER_SDK': + return gettext('The new package failed because the current SDK version is newer than that required by the package.') + case 'INSTALL_FAILED_TEST_ONLY': + return gettext('The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.') + case 'INSTALL_FAILED_CPU_ABI_INCOMPATIBLE': return gettext("The package being installed contains native code, but none that is compatible with the device's CPU_ABI.") - case "INSTALL_FAILED_MISSING_FEATURE": - return gettext("The new package uses a feature that is not available.") - case "INSTALL_FAILED_CONTAINER_ERROR": + case 'INSTALL_FAILED_MISSING_FEATURE': + return gettext('The new package uses a feature that is not available.') + case 'INSTALL_FAILED_CONTAINER_ERROR': return gettext("A secure container mount point couldn't be accessed on external media.") - case "INSTALL_FAILED_INVALID_INSTALL_LOCATION": + case 'INSTALL_FAILED_INVALID_INSTALL_LOCATION': return gettext("The new package couldn't be installed in the specified install location.") - case "INSTALL_FAILED_MEDIA_UNAVAILABLE": + case 'INSTALL_FAILED_MEDIA_UNAVAILABLE': return gettext("The new package couldn't be installed in the specified install location because the media is not available.") - case "INSTALL_FAILED_VERIFICATION_TIMEOUT": + case 'INSTALL_FAILED_VERIFICATION_TIMEOUT': return gettext("The new package couldn't be installed because the verification timed out.") - case "INSTALL_FAILED_VERIFICATION_FAILURE": + case 'INSTALL_FAILED_VERIFICATION_FAILURE': return gettext("The new package couldn't be installed because the verification did not succeed.") - case "INSTALL_FAILED_PACKAGE_CHANGED": - return gettext("The package changed from what the calling program expected.") - case "INSTALL_FAILED_UID_CHANGED": - return gettext("The new package is assigned a different UID than it previously held.") - case "INSTALL_FAILED_VERSION_DOWNGRADE": - return gettext("The new package has an older version code than the currently installed package.") - case "INSTALL_PARSE_FAILED_NOT_APK": + case 'INSTALL_FAILED_PACKAGE_CHANGED': + return gettext('The package changed from what the calling program expected.') + case 'INSTALL_FAILED_UID_CHANGED': + return gettext('The new package is assigned a different UID than it previously held.') + case 'INSTALL_FAILED_VERSION_DOWNGRADE': + return gettext('The new package has an older version code than the currently installed package.') + case 'INSTALL_PARSE_FAILED_NOT_APK': return gettext("The parser was given a path that is not a file, or does not end with the expected '.apk' extension.") - case "INSTALL_PARSE_FAILED_BAD_MANIFEST": - return gettext("The parser was unable to retrieve the AndroidManifest.xml file.") - case "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION": - return gettext("The parser encountered an unexpected exception.") - case "INSTALL_PARSE_FAILED_NO_CERTIFICATES": - return gettext("The parser did not find any certificates in the .apk.") - case "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES": - return gettext("The parser found inconsistent certificates on the files in the .apk.") - case "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING": - return gettext("The parser encountered a CertificateEncodingException in one of the files in the .apk.") - case "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME": - return gettext("The parser encountered a bad or missing package name in the manifest.") - case "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID": - return gettext("The parser encountered a bad shared user id name in the manifest.") - case "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED": - return gettext("The parser encountered some structural problem in the manifest.") - case "INSTALL_PARSE_FAILED_MANIFEST_EMPTY": - return gettext("The parser did not find any actionable tags (instrumentation or application) in the manifest.") - case "INSTALL_FAILED_INTERNAL_ERROR": - return gettext("The system failed to install the package because of system issues.") - case "INSTALL_FAILED_USER_RESTRICTED": - return gettext("The system failed to install the package because the user is restricted from installing apps.") - case "INSTALL_FAILED_NO_MATCHING_ABIS": - return gettext("The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.") + case 'INSTALL_PARSE_FAILED_BAD_MANIFEST': + return gettext('The parser was unable to retrieve the AndroidManifest.xml file.') + case 'INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION': + return gettext('The parser encountered an unexpected exception.') + case 'INSTALL_PARSE_FAILED_NO_CERTIFICATES': + return gettext('The parser did not find any certificates in the .apk.') + case 'INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES': + return gettext('The parser found inconsistent certificates on the files in the .apk.') + case 'INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING': + return gettext('The parser encountered a CertificateEncodingException in one of the files in the .apk.') + case 'INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME': + return gettext('The parser encountered a bad or missing package name in the manifest.') + case 'INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID': + return gettext('The parser encountered a bad shared user id name in the manifest.') + case 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED': + return gettext('The parser encountered some structural problem in the manifest.') + case 'INSTALL_PARSE_FAILED_MANIFEST_EMPTY': + return gettext('The parser did not find any actionable tags (instrumentation or application) in the manifest.') + case 'INSTALL_FAILED_INTERNAL_ERROR': + return gettext('The system failed to install the package because of system issues.') + case 'INSTALL_FAILED_USER_RESTRICTED': + return gettext('The system failed to install the package because the user is restricted from installing apps.') + case 'INSTALL_FAILED_NO_MATCHING_ABIS': + return gettext('The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.') default: return gettext(text) } diff --git a/res/app/components/stf/install/install-service.js b/res/app/components/stf/install/install-service.js index 58aee780..cd9902f2 100644 --- a/res/app/components/stf/install/install-service.js +++ b/res/app/components/stf/install/install-service.js @@ -60,14 +60,14 @@ module.exports = function InstallService( this.emit('change') } - installService.installUrl = function (control, url) { + installService.installUrl = function(control, url) { var installation = new Installation('downloading') $rootScope.$broadcast('installation', installation) return control.uploadUrl(url) - .progressed(function (uploadResult) { + .progressed(function(uploadResult) { installation.update(uploadResult.progress / 2, uploadResult.lastData) }) - .then(function (uploadResult) { + .then(function(uploadResult) { installation.update(uploadResult.progress / 2, uploadResult.lastData) installation.manifest = uploadResult.body return control.install({ @@ -75,7 +75,7 @@ module.exports = function InstallService( , manifest: installation.manifest , launch: installation.launch }) - .progressed(function (result) { + .progressed(function(result) { installation.update(50 + result.progress / 2, result.lastData) }) }) @@ -87,7 +87,7 @@ module.exports = function InstallService( }) } - installService.installFile = function (control, $files) { + installService.installFile = function(control, $files) { var installation = new Installation('uploading') $rootScope.$broadcast('installation', installation) return StorageService.storeFile('apk', $files, { @@ -112,7 +112,7 @@ module.exports = function InstallService( , manifest: installation.manifest , launch: installation.launch }) - .progressed(function (result) { + .progressed(function(result) { installation.update(50 + result.progress / 2, result.lastData) }) } diff --git a/res/app/components/stf/keycodes/index.js b/res/app/components/stf/keycodes/index.js index 0c2faad1..44c2c23e 100644 --- a/res/app/components/stf/keycodes/index.js +++ b/res/app/components/stf/keycodes/index.js @@ -1,7 +1,7 @@ module.exports = angular.module('stf.keycodes', [ ]) - .factory('KeycodesMapped', function () { + .factory('KeycodesMapped', function() { return require('./mapped/index.json') }) diff --git a/res/app/components/stf/keycodes/keycodes-service.js b/res/app/components/stf/keycodes/keycodes-service.js index 895bb043..e8af7184 100644 --- a/res/app/components/stf/keycodes/keycodes-service.js +++ b/res/app/components/stf/keycodes/keycodes-service.js @@ -57,11 +57,11 @@ module.exports = function KeycodesServiceFactory(KeycodesAndroid, KeycodesJS) { [j.SINGLE_QUOTE, a.KEYCODE_APOSTROPHE] ] - service.mapToDevice = function (keyCode) { + service.mapToDevice = function(keyCode) { return service.mapToAndroid(keyCode) } - service.mapToAndroid = function (key) { + service.mapToAndroid = function(key) { // All special keys for (var i = 0; i < androidMap.length; ++i) { if (androidMap[i][0] === key) { diff --git a/res/app/components/stf/keys/add-adb-key/adb-keys-service.js b/res/app/components/stf/keys/add-adb-key/adb-keys-service.js index d8ef06dc..8d93b69a 100644 --- a/res/app/components/stf/keys/add-adb-key/adb-keys-service.js +++ b/res/app/components/stf/keys/add-adb-key/adb-keys-service.js @@ -1,7 +1,7 @@ module.exports = function AdbKeysServiceFactory() { var service = {} - service.commentFromKey = function (key) { + service.commentFromKey = function(key) { if (key.match(/.+= (.+)/)) { return key.replace(/.+= (.+)/g, '$1') } diff --git a/res/app/components/stf/keys/add-adb-key/add-adb-key-directive.js b/res/app/components/stf/keys/add-adb-key/add-adb-key-directive.js index 7b0ac3ce..8f968790 100644 --- a/res/app/components/stf/keys/add-adb-key/add-adb-key-directive.js +++ b/res/app/components/stf/keys/add-adb-key/add-adb-key-directive.js @@ -13,7 +13,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) { , key: '' } - $scope.addKey = function () { + $scope.addKey = function() { UserService.addAdbKey({ title: $scope.addForm.title , key: $scope.addForm.key @@ -21,7 +21,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) { $scope.closeAddKey() } - $scope.closeAddKey = function () { + $scope.closeAddKey = function() { $scope.addForm.title = '' $scope.addForm.key = '' // TODO: cannot access to the form by name inside a directive? @@ -29,8 +29,8 @@ module.exports = function addAdbKeyDirective(AdbKeysService) { $scope.showAdd = false } }, - link: function (scope) { - scope.$watch('addForm.key', function (newValue) { + link: function(scope) { + scope.$watch('addForm.key', function(newValue) { if (newValue && !scope.addForm.title) { // By default sets the title to the ADB key comment because // usually it happens to be username@hostname. diff --git a/res/app/components/stf/keys/add-adb-key/add-adb-key-spec.js b/res/app/components/stf/keys/add-adb-key/add-adb-key-spec.js index cbd9fd90..03957f85 100644 --- a/res/app/components/stf/keys/add-adb-key/add-adb-key-spec.js +++ b/res/app/components/stf/keys/add-adb-key/add-adb-key-spec.js @@ -1,15 +1,15 @@ -describe('addAdbKey', function () { +describe('addAdbKey', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, compile - beforeEach(inject(function ($rootScope, $compile) { + beforeEach(inject(function($rootScope, $compile) { scope = $rootScope.$new() compile = $compile })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, diff --git a/res/app/components/stf/landscape/landscape-directive.js b/res/app/components/stf/landscape/landscape-directive.js index 7b199083..2ecf9deb 100644 --- a/res/app/components/stf/landscape/landscape-directive.js +++ b/res/app/components/stf/landscape/landscape-directive.js @@ -2,7 +2,7 @@ module.exports = function landscapeDirective(BrowserInfo, $document, $window) { return { restrict: 'A', - link: function (scope) { + link: function(scope) { var body = angular.element($document[0].body) if (typeof $window.orientation !== 'undefined') { diff --git a/res/app/components/stf/landscape/landscape-spec.js b/res/app/components/stf/landscape/landscape-spec.js index f70b92d7..cf98bfe7 100644 --- a/res/app/components/stf/landscape/landscape-spec.js +++ b/res/app/components/stf/landscape/landscape-spec.js @@ -1,15 +1,15 @@ -describe('landscape', function () { +describe('landscape', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('landscape', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/language/language-provider.js b/res/app/components/stf/language/language-provider.js index 763289c6..543ac1b7 100644 --- a/res/app/components/stf/language/language-provider.js +++ b/res/app/components/stf/language/language-provider.js @@ -12,7 +12,7 @@ module.exports = function LanguageProvider(AppStateProvider) { } return { - $get: function () { + $get: function() { return provider } } diff --git a/res/app/components/stf/logcat-table/logcat-table-directive.js b/res/app/components/stf/logcat-table/logcat-table-directive.js index 4047c9e4..16751975 100644 --- a/res/app/components/stf/logcat-table/logcat-table-directive.js +++ b/res/app/components/stf/logcat-table/logcat-table-directive.js @@ -6,7 +6,7 @@ module.exports = restrict: 'E', replace: true, template: require('./logcat-table.jade'), - link: function (scope, element) { + link: function(scope, element) { var autoScroll = true var autoScrollDependingOnScrollPosition = true var scrollPosition = 0 @@ -23,15 +23,15 @@ module.exports = } } - LogcatService.addEntryListener = function (entry) { + LogcatService.addEntryListener = function(entry) { incrementNumberEntry() addRow(body, entry) } - LogcatService.addFilteredEntriesListener = function (entries) { + LogcatService.addFilteredEntriesListener = function(entries) { clearTable() //var fragment = document.createDocumentFragment() - _.each(entries, function (entry) { + _.each(entries, function(entry) { // TODO: This is not adding all the entries after first scope creation incrementNumberEntry() addRow(body, entry, true) @@ -56,7 +56,7 @@ module.exports = function scrollToBottom() { parent.scrollTop = parent.scrollHeight + 20 - $timeout(function () { + $timeout(function() { parent.scrollTop = parent.scrollHeight }, 10) } @@ -99,13 +99,13 @@ module.exports = body = newBody } - scope.clearTable = function () { + scope.clearTable = function() { LogcatService.clear() numberOfEntries = 0 clearTable() } - scope.$on('$destroy', function () { + scope.$on('$destroy', function() { parent.removeEventListener('scroll', throttledScrollListener) }) } diff --git a/res/app/components/stf/logcat-table/logcat-table-spec.js b/res/app/components/stf/logcat-table/logcat-table-spec.js index 80c629ea..8a12dd66 100644 --- a/res/app/components/stf/logcat-table/logcat-table-spec.js +++ b/res/app/components/stf/logcat-table/logcat-table-spec.js @@ -1,15 +1,15 @@ -describe('logcatTable', function () { +describe('logcatTable', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('logcatTable', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/logcat/logcat-service.js b/res/app/components/stf/logcat/logcat-service.js index 414ebd86..ff36ae6b 100644 --- a/res/app/components/stf/logcat/logcat-service.js +++ b/res/app/components/stf/logcat/logcat-service.js @@ -23,14 +23,14 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) { var _filters = {} function defineFilterProperties(properties) { - _.forEach(properties, function (prop) { + _.forEach(properties, function(prop) { Object.defineProperty(service.filters, prop, { - get: function () { + get: function() { return _filters[prop] }, - set: function (value) { - _filters[prop] = value ? value : null - service.serverFilters[0][prop] = value ? value : undefined + set: function(value) { + _filters[prop] = value || null + service.serverFilters[0][prop] = value || undefined service.filters.filterLines() } }) @@ -63,11 +63,11 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) { 'SILENT' ] - var logLevelsLowerCase = _.map(service.logLevels, function (level) { + var logLevelsLowerCase = _.map(service.logLevels, function(level) { return level.toLowerCase() }) - var logLevelsCapitalized = _.map(logLevelsLowerCase, function (level) { + var logLevelsCapitalized = _.map(logLevelsLowerCase, function(level) { return _s.capitalize(level) }) @@ -90,26 +90,26 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) { return data } - socket.on('logcat.entry', function (rawData) { + socket.on('logcat.entry', function(rawData) { service.numberOfEntries++ service.entries.push(enhanceEntry(rawData)) - if (typeof(service.addEntryListener) === 'function') { + if (typeof (service.addEntryListener) === 'function') { if (filterLine(rawData)) { service.addEntryListener(rawData) } } }) - service.clear = function () { + service.clear = function() { service.numberOfEntries = 0 service.entries = [] } - service.filters.filterLines = function () { + service.filters.filterLines = function() { service.filters.entries = _.filter(service.entries, filterLine) - if (typeof(service.addFilteredEntriesListener) === 'function') { + if (typeof (service.addFilteredEntriesListener) === 'function') { service.addFilteredEntriesListener(service.filters.entries) } } diff --git a/res/app/components/stf/native-url/native-url-service.js b/res/app/components/stf/native-url/native-url-service.js index 68fe2785..28424194 100644 --- a/res/app/components/stf/native-url/native-url-service.js +++ b/res/app/components/stf/native-url/native-url-service.js @@ -25,31 +25,31 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) { // TODO: use a central on-blur event var cachedWindowOnBlur = $window.onblur - service.open = function (options) { + service.open = function(options) { switch (fallbackMethod) { case 'USE_NEW_WINDOW': // Doesn't work well on Chrome windowOpened = $window.open(options.nativeUrl) - $timeout(function () { + $timeout(function() { if (windowOpened) { windowOpened.close() } }, 500) $window.location.href = options.webUrl - break; + break case 'USE_ON_BLUR': // Doesn't work on Safari - $window.onblur = function () { + $window.onblur = function() { wasBlured = true } $window.location.href = options.nativeUrl - $timeout(function () { + $timeout(function() { if (wasBlured) { wasBlured = false } else { @@ -59,14 +59,14 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) { $window.onblur = cachedWindowOnBlur }, 250) - break; + break case 'USE_TIME_ELAPSED': // Doesn't work on Chrome var start, end, elapsed start = new Date().getTime() - console.log(' window.performance.webkitNow()', window.performance.now()) + // console.log(' window.performance.webkitNow()', window.performance.now()) // This depends on the fact that JS is single-thread document.location = options.nativeUrl @@ -79,7 +79,7 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) { document.location = options.webUrl } - break; + break default: } diff --git a/res/app/components/stf/nav-menu/nav-menu-directive.js b/res/app/components/stf/nav-menu/nav-menu-directive.js index 2f84f2ed..f4884369 100644 --- a/res/app/components/stf/nav-menu/nav-menu-directive.js +++ b/res/app/components/stf/nav-menu/nav-menu-directive.js @@ -1,17 +1,15 @@ /* Based on https://ryankaskel.com/blog/2013/05/27/ a-different-approach-to-angularjs-navigation-menus */ -module.exports = function ($location) { +module.exports = function($location) { return { restrict: 'EA', scope: {}, - link: function (scope, element, attrs) { + link: function(scope, element, attrs) { var links = element.find('a') var onClass = attrs.navMenu || 'current' - var routePattern - var link - var url var urlMap = [] + var routePattern, link, url if (!$location.$$html5) { routePattern = /\/#[^/]*/ diff --git a/res/app/components/stf/nav-menu/nav-menu-spec.js b/res/app/components/stf/nav-menu/nav-menu-spec.js index 18f10fee..0450c095 100644 --- a/res/app/components/stf/nav-menu/nav-menu-spec.js +++ b/res/app/components/stf/nav-menu/nav-menu-spec.js @@ -1,15 +1,15 @@ -describe('navMenu', function () { +describe('navMenu', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your @@ -19,5 +19,5 @@ describe('navMenu', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/port-forwarding/port-forwarding-service.js b/res/app/components/stf/port-forwarding/port-forwarding-service.js index 732ae619..b7c70d11 100644 --- a/res/app/components/stf/port-forwarding/port-forwarding-service.js +++ b/res/app/components/stf/port-forwarding/port-forwarding-service.js @@ -1,4 +1,4 @@ -module.exports = function () { +module.exports = function() { var service = {} diff --git a/res/app/components/stf/scoped-hotkeys/scoped-hotkeys-service.js b/res/app/components/stf/scoped-hotkeys/scoped-hotkeys-service.js index 01e47cab..54de85c5 100644 --- a/res/app/components/stf/scoped-hotkeys/scoped-hotkeys-service.js +++ b/res/app/components/stf/scoped-hotkeys/scoped-hotkeys-service.js @@ -1,12 +1,12 @@ module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) { - return function (scope, hotkeySet) { + return function(scope, hotkeySet) { function hotkeyAdd(combo, desc, callback, preventDefault) { hotkeys.add({ combo: combo, description: $filter('translate')(desc), allowIn: ['textarea', 'input'], - callback: function (event) { + callback: function(event) { if (preventDefault || typeof preventDefault === 'undefined') { event.preventDefault() } @@ -15,12 +15,12 @@ module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) { }) } - angular.forEach(hotkeySet, function (value) { + angular.forEach(hotkeySet, function(value) { hotkeyAdd(value[0], value[1], value[2], value[3]) }) - scope.$on('$destroy', function () { - angular.forEach(hotkeySet, function (value) { + scope.$on('$destroy', function() { + angular.forEach(hotkeySet, function(value) { hotkeys.del(value[0]) }) }) diff --git a/res/app/components/stf/screen/fast-image-render/canvas-render.js b/res/app/components/stf/screen/fast-image-render/canvas-render.js index 2715bf6b..e32960b9 100644 --- a/res/app/components/stf/screen/fast-image-render/canvas-render.js +++ b/res/app/components/stf/screen/fast-image-render/canvas-render.js @@ -26,11 +26,11 @@ function CanvasRender(canvasElement, options) { } } -CanvasRender.prototype.draw = function (image) { +CanvasRender.prototype.draw = function(image) { this.context.drawImage(image, 0, 0) } -CanvasRender.prototype.clear = function () { +CanvasRender.prototype.clear = function() { this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height) } diff --git a/res/app/components/stf/screen/fast-image-render/index.js b/res/app/components/stf/screen/fast-image-render/index.js index 3df44ff0..263c2c50 100644 --- a/res/app/components/stf/screen/fast-image-render/index.js +++ b/res/app/components/stf/screen/fast-image-render/index.js @@ -9,7 +9,7 @@ function FastImageRender(canvasElement, options) { this.timeoutId = null if (that.options.raf) { - that.animLoop = function () { + that.animLoop = function() { that.raf = window.requireAnimationFrame(that.animLoop) // separate render from drawing @@ -19,19 +19,19 @@ function FastImageRender(canvasElement, options) { // Loader this.loader = new Image() - this.loader.onload = function () { + this.loader.onload = function() { if (that.options.timeout) { clearTimeout(that.timeoutId) } - if (typeof(that.onLoad) === 'function') { + if (typeof (that.onLoad) === 'function') { that.onLoad(this) } } - this.loader.onerror = function () { + this.loader.onerror = function() { if (that.options.timeout) { clearTimeout(that.timeoutId) } - if (typeof(that.onError) === 'function') { + if (typeof (that.onError) === 'function') { that.onError(this) } } @@ -47,19 +47,19 @@ function FastImageRender(canvasElement, options) { } -FastImageRender.prototype.destroy = function () { +FastImageRender.prototype.destroy = function() { window.cancelAnimationFrame(this.raf) // delete onLoad & onError } -FastImageRender.prototype.load = function (url, type) { +FastImageRender.prototype.load = function(url, type) { var that = this if (that.options.timeout) { - that.timeoutId = setTimeout(function () { - if (typeof(that.onError) === 'function') { + that.timeoutId = setTimeout(function() { + if (typeof (that.onError) === 'function') { that.onError('timeout') } }, that.options.timeout) @@ -72,14 +72,14 @@ FastImageRender.prototype.load = function (url, type) { var texture = null if (type) { texture = this.render.ctx.createTexture() - this.textureLoader.loadEx(url, texture, true, function () { - if (typeof(that.onLoad) === 'function') { + this.textureLoader.loadEx(url, texture, true, function() { + if (typeof (that.onLoad) === 'function') { that.onLoad(texture) } }, type) } else { - this.textureLoader.load(url, function (texture) { - if (typeof(that.onLoad) === 'function') { + this.textureLoader.load(url, function(texture) { + if (typeof (that.onLoad) === 'function') { that.onLoad(texture) } }) @@ -91,19 +91,19 @@ FastImageRender.prototype.load = function (url, type) { } } -FastImageRender.prototype.draw = function (image) { +FastImageRender.prototype.draw = function(image) { this.render.draw(image) } -FastImageRender.prototype.clear = function () { +FastImageRender.prototype.clear = function() { this.render.clear() } Object.defineProperty(FastImageRender.prototype, 'canvasWidth', { - get: function () { + get: function() { return this.canvasElement.width }, - set: function (width) { + set: function(width) { if (width) { if (width !== this.canvasElement.width) { this.canvasElement.width = width @@ -113,10 +113,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasWidth', { }) Object.defineProperty(FastImageRender.prototype, 'canvasHeight', { - get: function () { + get: function() { return this.canvasElement.height }, - set: function (height) { + set: function(height) { if (height) { if (height !== this.canvasElement.height) { this.canvasElement.height = height @@ -126,10 +126,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasHeight', { }) Object.defineProperty(FastImageRender.prototype, 'displayWidth', { - get: function () { + get: function() { return this.canvasElement.width }, - set: function (width) { + set: function(width) { if (width) { if (width !== this.canvasElement.width) { this.canvasElement.width = width @@ -139,10 +139,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayWidth', { }) Object.defineProperty(FastImageRender.prototype, 'displayHeight', { - get: function () { + get: function() { return this.canvasElement.height }, - set: function (height) { + set: function(height) { if (height) { if (height !== this.canvasElement.height) { this.canvasElement.height = height @@ -152,10 +152,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayHeight', { }) Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', { - get: function () { + get: function() { return parseInt(this.canvasElement.style.width, 10) }, - set: function (width) { + set: function(width) { if (width) { var styleWidth = width + 'px' if (styleWidth !== this.canvasElement.style.width) { @@ -166,10 +166,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', { }) Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', { - get: function () { + get: function() { return parseInt(this.canvasElement.style.height, 10) }, - set: function (height) { + set: function(height) { if (height) { var styleHeight = height + 'px' if (styleHeight !== this.canvasElement.style.height) { diff --git a/res/app/components/stf/screen/fast-image-render/test/performance_test.js b/res/app/components/stf/screen/fast-image-render/test/performance_test.js index f9f3afa6..dd45755d 100644 --- a/res/app/components/stf/screen/fast-image-render/test/performance_test.js +++ b/res/app/components/stf/screen/fast-image-render/test/performance_test.js @@ -1,3 +1,5 @@ +/* eslint no-console: 0 */ + var canvasElement = document.querySelector('canvas') var frameNumberElement = document.querySelector('#frame-number') var totalTimeElement = document.querySelector('#total-time') @@ -7,7 +9,7 @@ var frame = { current: 0 } -function FastImageRender () { +function FastImageRender() { } @@ -35,7 +37,7 @@ var startTime = new Date().getTime() loadNext() -imageRender.onLoad = function (image) { +imageRender.onLoad = function(image) { console.timeEnd('load') console.time('draw') imageRender.draw(image) diff --git a/res/app/components/stf/screen/fast-image-render/webgl-render.js b/res/app/components/stf/screen/fast-image-render/webgl-render.js index a4747880..edc5e521 100644 --- a/res/app/components/stf/screen/fast-image-render/webgl-render.js +++ b/res/app/components/stf/screen/fast-image-render/webgl-render.js @@ -7,7 +7,7 @@ * @param {WebGLRenderingContext} gl The GL context. * @constructor */ -var Renderer = function (gl) { +var Renderer = function(gl) { /** * The GL context. * @type {WebGLRenderingContext} @@ -92,13 +92,13 @@ var Renderer = function (gl) { } -Renderer.prototype.finishInit = function () { +Renderer.prototype.finishInit = function() { this.draw() } Renderer.prototype.createDxtTexture = - function (dxtData, width, height, format) { + function(dxtData, width, height, format) { var gl = this.gl_ var tex = gl.createTexture() gl.bindTexture(gl.TEXTURE_2D, tex) @@ -120,7 +120,7 @@ Renderer.prototype.createDxtTexture = } -Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) { +Renderer.prototype.createRgb565Texture = function(rgb565Data, width, height) { var gl = this.gl_ var tex = gl.createTexture() gl.bindTexture(gl.TEXTURE_2D, tex) @@ -144,7 +144,7 @@ Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) { } -Renderer.prototype.drawTexture = function (texture, width, height) { +Renderer.prototype.drawTexture = function(texture, width, height) { var gl = this.gl_ // draw scene gl.clearColor(0, 0, 0, 1) @@ -171,7 +171,7 @@ Renderer.prototype.drawTexture = function (texture, width, height) { * @return {WebGLShader} The new WebGLShader. * @private */ -Renderer.prototype.compileShader_ = function (shaderSource, type) { +Renderer.prototype.compileShader_ = function(shaderSource, type) { var gl = this.gl_ var shader = gl.createShader(type) gl.shaderSource(shader, shaderSource) @@ -247,7 +247,7 @@ function WebGLRender(canvasElement) { //this.setup() } -WebGLRender.prototype.setup = function () { +WebGLRender.prototype.setup = function() { // create shaders var vertexShaderSrc = 'attribute vec2 aVertex;' + @@ -305,13 +305,13 @@ WebGLRender.prototype.setup = function () { } -WebGLRender.prototype.draw = function (image) { +WebGLRender.prototype.draw = function(image) { // this.renderer.drawTexture(image, image.width, image.height) this.renderer.drawTexture(image, 643, 1149) } -WebGLRender.prototype.drawOld = function (image) { +WebGLRender.prototype.drawOld = function(image) { var tex = this.ctx.createTexture() this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex) this.ctx.texParameteri( @@ -354,7 +354,7 @@ WebGLRender.prototype.drawOld = function (image) { this.ctx.vertexAttribPointer(this.tloc, 2, this.ctx.FLOAT, false, 0, 0) } -WebGLRender.prototype.clear = function () { +WebGLRender.prototype.clear = function() { } diff --git a/res/app/components/stf/screen/rotator-test.js b/res/app/components/stf/screen/rotator-test.js index 2807848f..18013018 100644 --- a/res/app/components/stf/screen/rotator-test.js +++ b/res/app/components/stf/screen/rotator-test.js @@ -1,3 +1,4 @@ +/* eslint no-console: 0 */ var rotator = require('./rotator') var tests = [ diff --git a/res/app/components/stf/screen/rotator.js b/res/app/components/stf/screen/rotator.js index 03546e02..a84a7a4e 100644 --- a/res/app/components/stf/screen/rotator.js +++ b/res/app/components/stf/screen/rotator.js @@ -27,7 +27,7 @@ var mapping = { module.exports = function rotator(oldRotation, newRotation) { var r1 = oldRotation < 0 ? 360 + oldRotation % 360 : oldRotation % 360 - , r2 = newRotation < 0 ? 360 + newRotation % 360 : newRotation % 360 + var r2 = newRotation < 0 ? 360 + newRotation % 360 : newRotation % 360 return mapping[r1][r2] } diff --git a/res/app/components/stf/screen/scaling/index.js b/res/app/components/stf/screen/scaling/index.js index da99b086..327fd7fb 100644 --- a/res/app/components/stf/screen/scaling/index.js +++ b/res/app/components/stf/screen/scaling/index.js @@ -1,2 +1,2 @@ module.exports = angular.module('stf/scaling', []) - .factory('ScalingService', require('./scaling-service')) \ No newline at end of file + .factory('ScalingService', require('./scaling-service')) diff --git a/res/app/components/stf/screen/scaling/scaling-service.js b/res/app/components/stf/screen/scaling/scaling-service.js index 2252d5e9..de804c64 100644 --- a/res/app/components/stf/screen/scaling/scaling-service.js +++ b/res/app/components/stf/screen/scaling/scaling-service.js @@ -2,7 +2,7 @@ module.exports = function ScalingServiceFactory() { var scalingService = { } - scalingService.coordinator = function (realWidth, realHeight) { + scalingService.coordinator = function(realWidth, realHeight) { var realRatio = realWidth / realHeight /** @@ -48,7 +48,7 @@ module.exports = function ScalingServiceFactory() { * |--------------|------|---------|---------|---------| */ return { - coords: function (boundingW, boundingH, relX, relY, rotation) { + coords: function(boundingW, boundingH, relX, relY, rotation) { var w, h, x, y, ratio, scaledValue switch (rotation) { @@ -138,7 +138,9 @@ module.exports = function ScalingServiceFactory() { , yP: y / h } } - , size: function (width, height) { + , size: function(sizeWidth, sizeHeight) { + var width = sizeWidth + var height = sizeHeight var ratio = width / height if (realRatio > ratio) { @@ -171,7 +173,7 @@ module.exports = function ScalingServiceFactory() { , height: height } } - , projectedSize: function (boundingW, boundingH, rotation) { + , projectedSize: function(boundingW, boundingH, rotation) { var w, h switch (rotation) { diff --git a/res/app/components/stf/screen/screen-controller.js b/res/app/components/stf/screen/screen-controller.js index eab3cafc..8078c278 100644 --- a/res/app/components/stf/screen/screen-controller.js +++ b/res/app/components/stf/screen/screen-controller.js @@ -7,7 +7,7 @@ module.exports = function DeviceScreenCtrl( $scope.displayError = false $scope.ScalingService = ScalingService - $scope.installFile = function ($files) { + $scope.installFile = function($files) { return InstallService.installFile($scope.control, $files) } } diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index 888d575b..ec4e56d0 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -17,14 +17,14 @@ module.exports = function DeviceScreenDirective( control: '&' , device: '&' } - , link: function (scope, element) { + , link: function(scope, element) { var URL = window.URL || window.webkitURL var BLANK_IMG = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' var cssTransform = VendorUtil.style(['transform', 'webkitTransform']) var device = scope.device() - , control = scope.control() + var control = scope.control() var input = element.find('input') @@ -74,8 +74,8 @@ module.exports = function DeviceScreenDirective( } var canvas = element.find('canvas')[0] - , g = canvas.getContext('2d') - , positioner = element.find('div')[0] + var g = canvas.getContext('2d') + var positioner = element.find('div')[0] function vendorBackingStorePixelRatio(g) { return g.webkitBackingStorePixelRatio || @@ -86,8 +86,8 @@ module.exports = function DeviceScreenDirective( } var devicePixelRatio = window.devicePixelRatio || 1 - , backingStoreRatio = vendorBackingStorePixelRatio(g) - , frontBackRatio = devicePixelRatio / backingStoreRatio + var backingStoreRatio = vendorBackingStorePixelRatio(g) + var frontBackRatio = devicePixelRatio / backingStoreRatio var options = { autoScaleForRetina: true @@ -101,8 +101,8 @@ module.exports = function DeviceScreenDirective( function updateBounds() { function adjustBoundedSize(w, h) { var sw = w * options.density - , sh = h * options.density - , f + var sh = h * options.density + var f if (sw < (f = device.display.width * options.minscale)) { sw *= f / sw @@ -122,7 +122,7 @@ module.exports = function DeviceScreenDirective( // FIXME: element is an object HTMLUnknownElement in IE9 var w = screen.bounds.w = element[0].offsetWidth - , h = screen.bounds.h = element[0].offsetHeight + var h = screen.bounds.h = element[0].offsetHeight // Developer error, let's try to reduce debug time if (!w || !h) { @@ -144,9 +144,9 @@ module.exports = function DeviceScreenDirective( } })() - if (!adjustedBoundSize - || newAdjustedBoundSize.w !== adjustedBoundSize.w - || newAdjustedBoundSize.h !== adjustedBoundSize.h) { + if (!adjustedBoundSize || + newAdjustedBoundSize.w !== adjustedBoundSize.w || + newAdjustedBoundSize.h !== adjustedBoundSize.h) { adjustedBoundSize = newAdjustedBoundSize onScreenInterestAreaChanged() } @@ -215,10 +215,10 @@ module.exports = function DeviceScreenDirective( } var cachedImageWidth = 0 - , cachedImageHeight = 0 - , cssRotation = 0 - , alwaysUpright = false - , imagePool = new ImagePool(10) + var cachedImageHeight = 0 + var cssRotation = 0 + var alwaysUpright = false + var imagePool = new ImagePool(10) function applyQuirks(banner) { element[0].classList.toggle( @@ -290,7 +290,7 @@ module.exports = function DeviceScreenDirective( if (message.data instanceof Blob) { if (shouldUpdateScreen()) { if (scope.displayError) { - scope.$apply(function () { + scope.$apply(function() { scope.displayError = false }) } @@ -343,7 +343,7 @@ module.exports = function DeviceScreenDirective( applyQuirks(JSON.parse(message.data.substr('start '.length))) } else if (message.data === 'secure_on') { - scope.$apply(function () { + scope.$apply(function() { scope.displayError = 'secure' }) } @@ -356,22 +356,22 @@ module.exports = function DeviceScreenDirective( scope.$on('visibilitychange', checkEnabled) scope.$watch('$parent.showScreen', checkEnabled) - scope.retryLoadingScreen = function () { + scope.retryLoadingScreen = function() { if (scope.displayError === 'secure') { control.home() } } - scope.$on('guest-portrait', function () { + scope.$on('guest-portrait', function() { control.rotate(0) }) - scope.$on('guest-landscape', function () { + scope.$on('guest-landscape', function() { control.rotate(90) }) var canvasAspect = 1 - , parentAspect = 1 + var parentAspect = 1 function resizeListener() { parentAspect = element[0].offsetWidth / element[0].offsetHeight @@ -513,12 +513,12 @@ module.exports = function DeviceScreenDirective( */ ;(function() { var slots = [] - , slotted = Object.create(null) - , fingers = [] - , seq = -1 - , cycle = 100 - , fakePinch = false - , lastPossiblyBuggyMouseUpEvent = 0 + var slotted = Object.create(null) + var fingers = [] + var seq = -1 + var cycle = 100 + var fakePinch = false + var lastPossiblyBuggyMouseUpEvent = 0 function nextSeq() { return ++seq >= cycle ? (seq = 0) : seq @@ -575,7 +575,8 @@ module.exports = function DeviceScreenDirective( } } - function mouseDownListener(e) { + function mouseDownListener(event) { + var e = event if (e.originalEvent) { e = e.originalEvent } @@ -593,9 +594,9 @@ module.exports = function DeviceScreenDirective( startMousing() var x = e.pageX - screen.bounds.x - , y = e.pageY - screen.bounds.y - , pressure = 0.5 - , scaled = scaler.coords( + var y = e.pageY - screen.bounds.y + var pressure = 0.5 + var scaled = scaler.coords( screen.bounds.w , screen.bounds.h , x @@ -634,7 +635,8 @@ module.exports = function DeviceScreenDirective( } } - function mouseMoveListener(e) { + function mouseMoveListener(event) { + var e = event if (e.originalEvent) { e = e.originalEvent } @@ -651,9 +653,9 @@ module.exports = function DeviceScreenDirective( fakePinch = e.altKey var x = e.pageX - screen.bounds.x - , y = e.pageY - screen.bounds.y - , pressure = 0.5 - , scaled = scaler.coords( + var y = e.pageY - screen.bounds.y + var pressure = 0.5 + var scaled = scaler.coords( screen.bounds.w , screen.bounds.h , x @@ -686,7 +688,8 @@ module.exports = function DeviceScreenDirective( } } - function mouseUpListener(e) { + function mouseUpListener(event) { + var e = event if (e.originalEvent) { e = e.originalEvent } @@ -782,7 +785,8 @@ module.exports = function DeviceScreenDirective( control.gestureStop(nextSeq()) } - function touchStartListener(e) { + function touchStartListener(event) { + var e = event e.preventDefault() //Make it jQuery compatible also @@ -800,7 +804,7 @@ module.exports = function DeviceScreenDirective( var i, l for (i = 0, l = e.touches.length; i < l; ++i) { - currentTouches[e.touches[i].identifier] = 1; + currentTouches[e.touches[i].identifier] = 1 } function maybeLostTouchEnd(id) { @@ -827,11 +831,11 @@ module.exports = function DeviceScreenDirective( for (i = 0, l = e.changedTouches.length; i < l; ++i) { var touch = e.changedTouches[i] - , slot = slots.pop() - , x = touch.pageX - screen.bounds.x - , y = touch.pageY - screen.bounds.y - , pressure = touch.force || 0.5 - , scaled = scaler.coords( + var slot = slots.pop() + var x = touch.pageX - screen.bounds.x + var y = touch.pageY - screen.bounds.y + var pressure = touch.force || 0.5 + var scaled = scaler.coords( screen.bounds.w , screen.bounds.h , x @@ -851,7 +855,8 @@ module.exports = function DeviceScreenDirective( control.touchCommit(nextSeq()) } - function touchMoveListener(e) { + function touchMoveListener(event) { + var e = event e.preventDefault() if (e.originalEvent) { @@ -860,11 +865,11 @@ module.exports = function DeviceScreenDirective( for (var i = 0, l = e.changedTouches.length; i < l; ++i) { var touch = e.changedTouches[i] - , slot = slotted[touch.identifier] - , x = touch.pageX - screen.bounds.x - , y = touch.pageY - screen.bounds.y - , pressure = touch.force || 0.5 - , scaled = scaler.coords( + var slot = slotted[touch.identifier] + var x = touch.pageX - screen.bounds.x + var y = touch.pageY - screen.bounds.y + var pressure = touch.force || 0.5 + var scaled = scaler.coords( screen.bounds.w , screen.bounds.h , x @@ -879,7 +884,8 @@ module.exports = function DeviceScreenDirective( control.touchCommit(nextSeq()) } - function touchEndListener(e) { + function touchEndListener(event) { + var e = event if (e.originalEvent) { e = e.originalEvent } @@ -888,8 +894,8 @@ module.exports = function DeviceScreenDirective( for (var i = 0, l = e.changedTouches.length; i < l; ++i) { var touch = e.changedTouches[i] - , slot = slotted[touch.identifier] - if (slot === void 0) { + var slot = slotted[touch.identifier] + if (typeof slot === 'undefined') { // We've already disposed of the contact. We may have gotten a // touchend event for the same contact twice. continue diff --git a/res/app/components/stf/screen/screen-keyboard/screen-keyboard-directive.js b/res/app/components/stf/screen/screen-keyboard/screen-keyboard-directive.js index fd85ff98..62789b60 100644 --- a/res/app/components/stf/screen/screen-keyboard/screen-keyboard-directive.js +++ b/res/app/components/stf/screen/screen-keyboard/screen-keyboard-directive.js @@ -2,7 +2,7 @@ module.exports = function screenKeyboardDirective() { return { restrict: 'E', template: require('./screen-keyboard.jade'), - link: function (scope, element) { + link: function(scope, element) { element.find('input') } diff --git a/res/app/components/stf/screen/screen-keyboard/screen-keyboard-spec.js b/res/app/components/stf/screen/screen-keyboard/screen-keyboard-spec.js index 499a18ca..506bab3c 100644 --- a/res/app/components/stf/screen/screen-keyboard/screen-keyboard-spec.js +++ b/res/app/components/stf/screen/screen-keyboard/screen-keyboard-spec.js @@ -1,15 +1,15 @@ -describe('screenKeyboard', function () { +describe('screenKeyboard', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('screenKeyboard', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/screen/screen-touch/screen-touch-directive.js b/res/app/components/stf/screen/screen-touch/screen-touch-directive.js index 272ab552..83169d76 100644 --- a/res/app/components/stf/screen/screen-touch/screen-touch-directive.js +++ b/res/app/components/stf/screen/screen-touch/screen-touch-directive.js @@ -1,7 +1,7 @@ module.exports = function screenTouchDirective() { return { restrict: 'A', - link: function () { + link: function() { } } diff --git a/res/app/components/stf/screen/screen-touch/screen-touch-spec.js b/res/app/components/stf/screen/screen-touch/screen-touch-spec.js index a1b8f2f1..a7536e7f 100644 --- a/res/app/components/stf/screen/screen-touch/screen-touch-spec.js +++ b/res/app/components/stf/screen/screen-touch/screen-touch-spec.js @@ -1,15 +1,15 @@ -describe('screenTouch', function () { +describe('screenTouch', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('screenTouch', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/settings/settings-service.js b/res/app/components/stf/settings/settings-service.js index 0fd155bd..c649fff4 100644 --- a/res/app/components/stf/settings/settings-service.js +++ b/res/app/components/stf/settings/settings-service.js @@ -8,14 +8,14 @@ module.exports = function SettingsServiceFactory( var SettingsService = {} var settings = UserService.currentUser.settings || {} - , syncListeners = [] + var syncListeners = [] function createListener(object, options, monitor) { var source = options.source || options.target return function() { - var value = object[options.target] = (source in settings) - ? settings[source] - : options.defaultValue + var value = object[options.target] = (source in settings) ? + settings[source] : + options.defaultValue if (monitor) { monitor(value) @@ -28,7 +28,9 @@ module.exports = function SettingsServiceFactory( $rootScope.safeApply(function() { _.merge(settings, delta, function(a, b) { // New Arrays overwrite old Arrays - return _.isArray(b) ? b : undefined + if (_.isArray(b)) { + return b + } }) for (var i = 0, l = syncListeners.length; i < l; ++i) { @@ -42,7 +44,7 @@ module.exports = function SettingsServiceFactory( applyDelta(delta) } - SettingsService.get = function (key) { + SettingsService.get = function(key) { return settings[key] } @@ -60,11 +62,11 @@ module.exports = function SettingsServiceFactory( SettingsService.bind = function(scope, options) { function value(possibleValue, defaultValue) { - return (possibleValue !== void 0) ? possibleValue : defaultValue + return (typeof possibleValue !== 'undefined') ? possibleValue : defaultValue } var source = options.source || options.target - , defaultValue = value(options.defaultValue, scope[options.target]) + var defaultValue = value(options.defaultValue, scope[options.target]) scope.$watch( options.target diff --git a/res/app/components/stf/socket/socket-service.js b/res/app/components/stf/socket/socket-service.js index 41425f2a..e11d82bd 100644 --- a/res/app/components/stf/socket/socket-service.js +++ b/res/app/components/stf/socket/socket-service.js @@ -11,17 +11,17 @@ module.exports = function SocketFactory( reconnection: false, transports: ['websocket'] }) - socket.scoped = function ($scope) { + socket.scoped = function($scope) { var listeners = [] - $scope.$on('$destroy', function () { - listeners.forEach(function (listener) { + $scope.$on('$destroy', function() { + listeners.forEach(function(listener) { socket.removeListener(listener.event, listener.handler) }) }) return { - on: function (event, handler) { + on: function(event, handler) { listeners.push({ event: event, handler: handler }) @@ -31,12 +31,12 @@ module.exports = function SocketFactory( } } - socket.on('outdated', function () { + socket.on('outdated', function() { VersionUpdateService.open() }) - socket.on('socket.ip', function (ip) { - $rootScope.$apply(function () { + socket.on('socket.ip', function(ip) { + $rootScope.$apply(function() { socket.ip = ip }) }) diff --git a/res/app/components/stf/socket/socket-state/index.js b/res/app/components/stf/socket/socket-state/index.js index e82dccdf..7722f720 100644 --- a/res/app/components/stf/socket/socket-state/index.js +++ b/res/app/components/stf/socket/socket-state/index.js @@ -7,12 +7,12 @@ module.exports = angular.module('stf/socket/socket-state', [ ]) .directive('socketState', require('./socket-state-directive')) .config([ - '$provide', function ($provide) { + '$provide', function($provide) { return $provide.decorator('$rootScope', [ - '$delegate', function ($delegate) { - $delegate.safeApply = function (fn) { + '$delegate', function($delegate) { + $delegate.safeApply = function(fn) { var phase = $delegate.$$phase - if (phase === "$apply" || phase === "$digest") { + if (phase === '$apply' || phase === '$digest') { if (fn && typeof fn === 'function') { fn() } diff --git a/res/app/components/stf/socket/socket-state/socket-state-directive.js b/res/app/components/stf/socket/socket-state/socket-state-directive.js index 7715bad6..2e7930e5 100644 --- a/res/app/components/stf/socket/socket-state/socket-state-directive.js +++ b/res/app/components/stf/socket/socket-state/socket-state-directive.js @@ -9,7 +9,7 @@ module.exports = function SocketStateDirectiveFactory( return { restrict: 'EA', template: require('./socket-state.jade'), - link: function (scope) { + link: function(scope) { var hasFailedOnce = false function setState(state) { @@ -40,36 +40,36 @@ module.exports = function SocketStateDirectiveFactory( break } - scope.$apply(function () { + scope.$apply(function() { scope.socketState = state }) } var socketListeners = { - 'connect': function () { + connect: function() { setState('connect') } - , 'disconnect': function () { + , disconnect: function() { setState('disconnect') hasFailedOnce = true } - , 'error': function () { + , error: function() { setState('error') hasFailedOnce = true } - , 'connect_error': function () { + , connect_error: function() { setState('connect_error') hasFailedOnce = true } - , 'reconnect_error': function () { + , reconnect_error: function() { setState('reconnect_error') hasFailedOnce = true } - , 'reconnect_failed': function () { + , reconnect_failed: function() { setState('reconnect_failed') hasFailedOnce = true } - , 'reconnect': function () { + , reconnect: function() { setState('reconnect') hasFailedOnce = true } diff --git a/res/app/components/stf/standalone/index.js b/res/app/components/stf/standalone/index.js index 1d9c8065..a785be2b 100644 --- a/res/app/components/stf/standalone/index.js +++ b/res/app/components/stf/standalone/index.js @@ -7,7 +7,7 @@ module.exports = angular.module('device-control.standalone', [ require('stf/settings').name, require('stf/screen/scaling').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/device-control/standalone/standalone.jade', require('./standalone.jade') ) diff --git a/res/app/components/stf/standalone/standalone-directive.js b/res/app/components/stf/standalone/standalone-directive.js index 0c4cb835..4662f6b9 100644 --- a/res/app/components/stf/standalone/standalone-directive.js +++ b/res/app/components/stf/standalone/standalone-directive.js @@ -1,7 +1,7 @@ module.exports = function standaloneDirective($rootScope, $location) { return { restrict: 'AE', - link: function () { + link: function() { //$rootScope.standalone = $window.history.length < 2 var standalone = $location.search().standalone $rootScope.standalone = standalone diff --git a/res/app/components/stf/standalone/standalone-service.js b/res/app/components/stf/standalone/standalone-service.js index 36392b88..d37d894d 100644 --- a/res/app/components/stf/standalone/standalone-service.js +++ b/res/app/components/stf/standalone/standalone-service.js @@ -39,7 +39,7 @@ module.exports = } - service.open = function (device) { + service.open = function(device) { var url = '#!/c/' + (device.serial ? device.serial : '') + '?standalone' var projected = fitDeviceInGuestScreen(device) @@ -74,7 +74,7 @@ module.exports = newWindow.document.title = windowTitle } - $timeout(function () { + $timeout(function() { if (newWindow.document) { newWindow.document.title = windowTitle } @@ -84,10 +84,10 @@ module.exports = setWindowTitle(newWindow, device) - newWindow.onbeforeunload = function () { + newWindow.onbeforeunload = function() { // TODO: check for usage - GroupService.kick(device).then(function () { + GroupService.kick(device).then(function() { $rootScope.$digest() }) diff --git a/res/app/components/stf/text-history/text-history-directive.js b/res/app/components/stf/text-history/text-history-directive.js index 0714889b..d0b183cf 100644 --- a/res/app/components/stf/text-history/text-history-directive.js +++ b/res/app/components/stf/text-history/text-history-directive.js @@ -5,7 +5,7 @@ module.exports = function textHistoryDirective() { return { restrict: 'A', template: '', - link: function () { + link: function() { } } diff --git a/res/app/components/stf/text-history/text-history-spec.js b/res/app/components/stf/text-history/text-history-spec.js index daa3671d..3ecd7e27 100644 --- a/res/app/components/stf/text-history/text-history-spec.js +++ b/res/app/components/stf/text-history/text-history-spec.js @@ -1,15 +1,15 @@ -describe('textHistory', function () { +describe('textHistory', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('textHistory', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/timeline/timeline-service.js b/res/app/components/stf/timeline/timeline-service.js index b2c108dc..1c3a5e9e 100644 --- a/res/app/components/stf/timeline/timeline-service.js +++ b/res/app/components/stf/timeline/timeline-service.js @@ -13,27 +13,27 @@ module.exports = function TimelineServiceFactory() { }) } - TimelineService.info = function (line) { + TimelineService.info = function(line) { addLine(line, 'info') } - TimelineService.warn = function (line) { + TimelineService.warn = function(line) { addLine(line, 'warn') } - TimelineService.success = function (line) { + TimelineService.success = function(line) { addLine(line, 'success') } - TimelineService.error = function (line) { + TimelineService.error = function(line) { addLine(line, 'error') } - TimelineService.fatal = function (line) { + TimelineService.fatal = function(line) { addLine(line, 'fatal') } - TimelineService.clear = function () { + TimelineService.clear = function() { TimelineService.lines = [] } diff --git a/res/app/components/stf/timeline/timeline-spec.js b/res/app/components/stf/timeline/timeline-spec.js index 6bc2050f..3f741228 100644 --- a/res/app/components/stf/timeline/timeline-spec.js +++ b/res/app/components/stf/timeline/timeline-spec.js @@ -1,11 +1,11 @@ describe('TimelineService', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) it('should ...', inject(function() { //expect(TimelineService.doSomething()).toEqual('something'); - })); + })) }) diff --git a/res/app/components/stf/timelines/timeline-message/timeline-message-directive.js b/res/app/components/stf/timelines/timeline-message/timeline-message-directive.js index b8821402..dd56ee27 100644 --- a/res/app/components/stf/timelines/timeline-message/timeline-message-directive.js +++ b/res/app/components/stf/timelines/timeline-message/timeline-message-directive.js @@ -11,15 +11,15 @@ module.exports = function timelineMessageDirective(Timelines, $sce, $interpolate replace: true, template: '', transclude: true, - link: function (scope, iElem, iAttrs, ctrls, transcludeFn) { + link: function(scope, iElem, iAttrs, ctrls, transcludeFn) { var options = angular.extend({}, defaults, scope.$eval(iAttrs.timelineMessage)) - transcludeFn(function (elem, scope) { + transcludeFn(function(elem, scope) { var e, html, interpolateFn, - safeHtml; + safeHtml // Create temporary wrapper element so we can grab the inner html e = angular.element(document.createElement('div')) diff --git a/res/app/components/stf/timelines/timeline-message/timeline-message-spec.js b/res/app/components/stf/timelines/timeline-message/timeline-message-spec.js index 7ff7e3e8..804bc607 100644 --- a/res/app/components/stf/timelines/timeline-message/timeline-message-spec.js +++ b/res/app/components/stf/timelines/timeline-message/timeline-message-spec.js @@ -1,15 +1,15 @@ -describe('timelineMessage', function () { +describe('timelineMessage', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('timelineMessage', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/timelines/timelines-directive.js b/res/app/components/stf/timelines/timelines-directive.js index 96cabc33..e010cb36 100644 --- a/res/app/components/stf/timelines/timelines-directive.js +++ b/res/app/components/stf/timelines/timelines-directive.js @@ -4,9 +4,9 @@ module.exports = function timelinesDirective(Timelines) { replace: false, scope: {}, template: require('./timelines.jade'), - link: function (scope) { - scope.cssPrefix = Timelines.options.cssPrefix; - scope.notifications = Timelines.notifications; + link: function(scope) { + scope.cssPrefix = Timelines.options.cssPrefix + scope.notifications = Timelines.notifications } } } diff --git a/res/app/components/stf/timelines/timelines-spec.js b/res/app/components/stf/timelines/timelines-spec.js index fc792723..c6f0c5c2 100644 --- a/res/app/components/stf/timelines/timelines-spec.js +++ b/res/app/components/stf/timelines/timelines-spec.js @@ -1,15 +1,15 @@ -describe('timelines', function () { +describe('timelines', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, compile; + var scope, compile - beforeEach(inject(function ($rootScope, $compile) { - scope = $rootScope.$new(); - compile = $compile; - })); + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) - it('should ...', function () { + it('should ...', function() { /* To test your directive, you need to create some html that would use your directive, @@ -19,5 +19,5 @@ describe('timelines', function () { expect(element.text()).toBe('hello, world'); */ - }); -}); + }) +}) diff --git a/res/app/components/stf/tokens/generate-access-token/generate-access-token-directive.js b/res/app/components/stf/tokens/generate-access-token/generate-access-token-directive.js index 2e034f08..1e12024e 100644 --- a/res/app/components/stf/tokens/generate-access-token/generate-access-token-directive.js +++ b/res/app/components/stf/tokens/generate-access-token/generate-access-token-directive.js @@ -3,7 +3,7 @@ module.exports = function generateAccessTokenDirective() { restrict: 'EA', replace: true, scope: { - showGenerate: '=', + showGenerate: '=' }, template: require('./generate-access-token.jade'), controller: function($scope, AccessTokenService) { @@ -11,12 +11,12 @@ module.exports = function generateAccessTokenDirective() { title: '' } - $scope.generateToken = function () { + $scope.generateToken = function() { AccessTokenService.generateAccessToken($scope.generateForm.title) $scope.closeGenerateToken() } - $scope.closeGenerateToken = function () { + $scope.closeGenerateToken = function() { $scope.title = '' $scope.showGenerate = false } diff --git a/res/app/components/stf/tokens/index.js b/res/app/components/stf/tokens/index.js index 11902070..b1ea6358 100644 --- a/res/app/components/stf/tokens/index.js +++ b/res/app/components/stf/tokens/index.js @@ -1,4 +1,4 @@ module.exports = angular.module('stf.tokens', [ - require('./generate-access-token').name, + require('./generate-access-token').name ]) .factory('AccessTokenService', require('./access-token-service')) diff --git a/res/app/components/stf/transaction/transaction-error.js b/res/app/components/stf/transaction/transaction-error.js index a0b9cb30..711b98fd 100644 --- a/res/app/components/stf/transaction/transaction-error.js +++ b/res/app/components/stf/transaction/transaction-error.js @@ -4,7 +4,7 @@ function TransactionError(result) { Error.captureStackTrace(this, TransactionError) } -TransactionError.prototype = Object.create(Error.prototype); -TransactionError.prototype.constructor = TransactionError; +TransactionError.prototype = Object.create(Error.prototype) +TransactionError.prototype.constructor = TransactionError module.exports = TransactionError diff --git a/res/app/components/stf/transaction/transaction-service.js b/res/app/components/stf/transaction/transaction-service.js index 8e2f1ecf..fc1454df 100644 --- a/res/app/components/stf/transaction/transaction-service.js +++ b/res/app/components/stf/transaction/transaction-service.js @@ -10,8 +10,8 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) { function MultiTargetTransaction(targets, options) { var pending = Object.create(null) - , results = [] - , channel = createChannel() + var results = [] + var channel = createChannel() function doneListener(someChannel, data) { if (someChannel === channel) { @@ -62,8 +62,8 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) { function SingleTargetTransaction(target, options) { var result = new options.result(target) - , pending = new PendingTransactionResult(result) - , channel = createChannel() + var pending = new PendingTransactionResult(result) + var channel = createChannel() function doneListener(someChannel, data) { if (someChannel === channel) { @@ -107,16 +107,16 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) { function PendingTransactionResult(result) { var resolver = Promise.defer() - , seq = 0 - , last = Infinity - , unplaced = [] + var seq = 0 + var last = Infinity + var unplaced = [] function readQueue() { var message - , foundAny = false + var foundAny = false while (seq <= last && (message = unplaced[seq])) { - unplaced[seq] = void 0 + unplaced[seq] = undefined if (seq === last) { result.success = message.success diff --git a/res/app/components/stf/upload/upload-error-filter.js b/res/app/components/stf/upload/upload-error-filter.js index 3f69d5d7..4537f247 100644 --- a/res/app/components/stf/upload/upload-error-filter.js +++ b/res/app/components/stf/upload/upload-error-filter.js @@ -1,10 +1,10 @@ module.exports = function uploadErrorFilter(gettext) { - return function (text) { + return function(text) { return { - 'fail_invalid_app_file': gettext('Uploaded file is not valid'), - 'fail_download': gettext('Failed to download file'), - 'fail_invalid_url': gettext('Cannot access specified URL'), - 'fail': gettext('Upload failed') + fail_invalid_app_file: gettext('Uploaded file is not valid'), + fail_download: gettext('Failed to download file'), + fail_invalid_url: gettext('Cannot access specified URL'), + fail: gettext('Upload failed') }[text] || gettext('Upload unknown error') } } diff --git a/res/app/components/stf/user/group/group-service.js b/res/app/components/stf/user/group/group-service.js index 99b5c242..100d08b6 100644 --- a/res/app/components/stf/user/group/group-service.js +++ b/res/app/components/stf/user/group/group-service.js @@ -8,7 +8,7 @@ module.exports = function GroupServiceFactory( var groupService = { } - groupService.invite = function (device) { + groupService.invite = function(device) { if (!device.usable) { return Promise.reject(new Error('Device is not usable')) } @@ -31,7 +31,7 @@ module.exports = function GroupServiceFactory( }) } - groupService.kick = function (device, force) { + groupService.kick = function(device, force) { if (!force && !device.usable) { return Promise.reject(new Error('Device is not usable')) } diff --git a/res/app/components/stf/util/vendor/vendor-util.js b/res/app/components/stf/util/vendor/vendor-util.js index c2d6d058..ea42ffe4 100644 --- a/res/app/components/stf/util/vendor/vendor-util.js +++ b/res/app/components/stf/util/vendor/vendor-util.js @@ -4,7 +4,7 @@ module.exports = function VendorUtilFactory() { vendorUtil.style = function(props) { var testee = document.createElement('span') for (var i = 0, l = props.length; i < l; ++i) { - if (testee.style[props[i]] !== void 0) { + if (typeof testee.style[props[i]] !== 'undefined') { return props[i] } } diff --git a/res/app/control-panes/activity/activity-controller.js b/res/app/control-panes/activity/activity-controller.js index 665deb46..cd866f5b 100644 --- a/res/app/control-panes/activity/activity-controller.js +++ b/res/app/control-panes/activity/activity-controller.js @@ -1,7 +1,7 @@ module.exports = function ActivityCtrl($scope, gettext, TimelineService) { $scope.timeline = TimelineService - $scope.$watch('device.state', function (newValue, oldValue) { + $scope.$watch('device.state', function(newValue, oldValue) { if (newValue !== oldValue) { diff --git a/res/app/control-panes/activity/activity-spec.js b/res/app/control-panes/activity/activity-spec.js index 686b380b..76212d03 100644 --- a/res/app/control-panes/activity/activity-spec.js +++ b/res/app/control-panes/activity/activity-spec.js @@ -1,17 +1,17 @@ -describe('ActivityCtrl', function () { +describe('ActivityCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('ActivityCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('ActivityCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/activity/index.js b/res/app/control-panes/activity/index.js index b261c501..965c1b82 100644 --- a/res/app/control-panes/activity/index.js +++ b/res/app/control-panes/activity/index.js @@ -5,7 +5,7 @@ module.exports = angular.module('stf.activity', [ require('stf/common-ui').name, require('stf/timeline').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/activity/activity.jade', require('./activity.jade') ) diff --git a/res/app/control-panes/advanced/advanced-spec.js b/res/app/control-panes/advanced/advanced-spec.js index 0c0d69fc..8bccaeaa 100644 --- a/res/app/control-panes/advanced/advanced-spec.js +++ b/res/app/control-panes/advanced/advanced-spec.js @@ -1,17 +1,17 @@ -describe('AdvancedCtrl', function () { +describe('AdvancedCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('AdvancedCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('AdvancedCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/index.js b/res/app/control-panes/advanced/index.js index c48408cb..ebcd7247 100644 --- a/res/app/control-panes/advanced/index.js +++ b/res/app/control-panes/advanced/index.js @@ -8,7 +8,7 @@ module.exports = angular.module('stf.advanced', [ require('./port-forwarding').name, require('./maintenance').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/advanced/advanced.jade', require('./advanced.jade') ) diff --git a/res/app/control-panes/advanced/input/index.js b/res/app/control-panes/advanced/input/index.js index 6fa33a00..f6d13768 100644 --- a/res/app/control-panes/advanced/input/index.js +++ b/res/app/control-panes/advanced/input/index.js @@ -2,7 +2,7 @@ require('./input.css') module.exports = angular.module('stf.advanced.input', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/advanced/input/input.jade', require('./input.jade') ) diff --git a/res/app/control-panes/advanced/input/input-controller.js b/res/app/control-panes/advanced/input/input-controller.js index 9da73c59..d941424b 100644 --- a/res/app/control-panes/advanced/input/input-controller.js +++ b/res/app/control-panes/advanced/input/input-controller.js @@ -1,6 +1,6 @@ module.exports = function InputCtrl($scope) { - $scope.press = function (key) { + $scope.press = function(key) { $scope.control.keyPress(key) } } diff --git a/res/app/control-panes/advanced/input/input-spec.js b/res/app/control-panes/advanced/input/input-spec.js index b3b79204..6c61e97f 100644 --- a/res/app/control-panes/advanced/input/input-spec.js +++ b/res/app/control-panes/advanced/input/input-spec.js @@ -1,17 +1,17 @@ -describe('InputAdvancedCtrl', function () { +describe('InputAdvancedCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('InputAdvancedCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('InputAdvancedCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/maintenance/index.js b/res/app/control-panes/advanced/maintenance/index.js index b153a661..37dc8485 100644 --- a/res/app/control-panes/advanced/maintenance/index.js +++ b/res/app/control-panes/advanced/maintenance/index.js @@ -1,7 +1,7 @@ module.exports = angular.module('stf.advanced.maintenance', [ require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/advanced/maintenance/maintenance.jade', require('./maintenance.jade') ) diff --git a/res/app/control-panes/advanced/maintenance/maintenance-controller.js b/res/app/control-panes/advanced/maintenance/maintenance-controller.js index a3dc643b..f63535be 100644 --- a/res/app/control-panes/advanced/maintenance/maintenance-controller.js +++ b/res/app/control-panes/advanced/maintenance/maintenance-controller.js @@ -1,15 +1,16 @@ -module.exports = function ($scope, gettext, $filter) { +module.exports = function($scope, gettext, $filter) { - $scope.reboot = function () { + $scope.reboot = function() { var config = { rebootEnabled: true } + /* eslint no-console: 0 */ if (config.rebootEnabled) { var line1 = $filter('translate')(gettext('Are you sure you want to reboot this device?')) var line2 = $filter('translate')(gettext('The device will be unavailable for a moment.')) if (confirm(line1 + '\n' + line2)) { - $scope.control.reboot().then(function (result) { + $scope.control.reboot().then(function(result) { console.error(result) }) } diff --git a/res/app/control-panes/advanced/maintenance/maintenance-spec.js b/res/app/control-panes/advanced/maintenance/maintenance-spec.js index ceb190c5..c710f22d 100644 --- a/res/app/control-panes/advanced/maintenance/maintenance-spec.js +++ b/res/app/control-panes/advanced/maintenance/maintenance-spec.js @@ -1,17 +1,17 @@ -describe('MaintenanceCtrl', function () { +describe('MaintenanceCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('MaintenanceCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('MaintenanceCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/port-forwarding/index.js b/res/app/control-panes/advanced/port-forwarding/index.js index a92201c9..0b9421b3 100644 --- a/res/app/control-panes/advanced/port-forwarding/index.js +++ b/res/app/control-panes/advanced/port-forwarding/index.js @@ -5,7 +5,7 @@ module.exports = angular.module('stf.port-forwarding', [ require('stf/settings').name, require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/advanced/port-forwarding/port-forwarding.jade', require('./port-forwarding.jade') diff --git a/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js b/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js index 8163c8a9..21fb5904 100644 --- a/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js +++ b/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js @@ -34,17 +34,17 @@ module.exports = function PortForwardingCtrl( $scope.reversePortForwards.forEach(function(forward) { var deviceForward = map[forward.id] forward.enabled = !!(deviceForward && deviceForward.id === forward.id && - deviceForward.devicePort == forward.devicePort) + deviceForward.devicePort === forward.devicePort) }) }) - $scope.applyForward = function (forward) { - return forward.enabled - ? $scope.control.createForward(forward) - : $scope.control.removeForward(forward) + $scope.applyForward = function(forward) { + return forward.enabled ? + $scope.control.createForward(forward) : + $scope.control.removeForward(forward) } - $scope.enableForward = function (forward) { + $scope.enableForward = function(forward) { if (forward.enabled) { return Promise.resolve() } @@ -52,7 +52,7 @@ module.exports = function PortForwardingCtrl( return $scope.control.createForward(forward) } - $scope.disableForward = function (forward) { + $scope.disableForward = function(forward) { if (!forward.enabled) { return Promise.resolve() } @@ -60,11 +60,11 @@ module.exports = function PortForwardingCtrl( return $scope.control.removeForward(forward) } - $scope.addRow = function () { + $scope.addRow = function() { $scope.reversePortForwards.push(defaults(uuid.v4())) } - $scope.removeRow = function (forward) { + $scope.removeRow = function(forward) { $scope.disableForward(forward) $scope.reversePortForwards.splice( $scope.reversePortForwards.indexOf(forward), 1) diff --git a/res/app/control-panes/advanced/port-forwarding/port-forwarding-spec.js b/res/app/control-panes/advanced/port-forwarding/port-forwarding-spec.js index b024b287..28e20468 100644 --- a/res/app/control-panes/advanced/port-forwarding/port-forwarding-spec.js +++ b/res/app/control-panes/advanced/port-forwarding/port-forwarding-spec.js @@ -1,17 +1,17 @@ -describe('PortForwardingCtrl', function () { +describe('PortForwardingCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('PortForwardingCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('PortForwardingCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/run-js/index.js b/res/app/control-panes/advanced/run-js/index.js index 8f03a4cf..e833d2d8 100644 --- a/res/app/control-panes/advanced/run-js/index.js +++ b/res/app/control-panes/advanced/run-js/index.js @@ -3,7 +3,7 @@ require('./run-js.css') module.exports = angular.module('stf.run-js', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/advanced/run-js/run-js.jade', require('./run-js.jade') ) diff --git a/res/app/control-panes/advanced/run-js/run-js-spec.js b/res/app/control-panes/advanced/run-js/run-js-spec.js index 9cad7b6e..1bde5f90 100644 --- a/res/app/control-panes/advanced/run-js/run-js-spec.js +++ b/res/app/control-panes/advanced/run-js/run-js-spec.js @@ -1,17 +1,17 @@ -describe('RunJsCtrl', function () { +describe('RunJsCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('RunJsCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('RunJsCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/usb/index.js b/res/app/control-panes/advanced/usb/index.js index 8fdd0918..845ccc9c 100644 --- a/res/app/control-panes/advanced/usb/index.js +++ b/res/app/control-panes/advanced/usb/index.js @@ -3,7 +3,7 @@ require('./usb.css') module.exports = angular.module('stf.usb', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/advanced/usb/usb.jade', require('./usb.jade') ) diff --git a/res/app/control-panes/advanced/usb/usb-spec.js b/res/app/control-panes/advanced/usb/usb-spec.js index 60680d18..6eae31fd 100644 --- a/res/app/control-panes/advanced/usb/usb-spec.js +++ b/res/app/control-panes/advanced/usb/usb-spec.js @@ -1,17 +1,17 @@ -describe('UsbCtrl', function () { +describe('UsbCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('UsbCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('UsbCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/advanced/vnc/index.js b/res/app/control-panes/advanced/vnc/index.js index da5b4f2b..0532ecec 100644 --- a/res/app/control-panes/advanced/vnc/index.js +++ b/res/app/control-panes/advanced/vnc/index.js @@ -3,7 +3,7 @@ require('./vnc.css') module.exports = angular.module('stf.vnc', [ require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/advanced/vnc/vnc.jade', require('./vnc.jade') diff --git a/res/app/control-panes/advanced/vnc/vnc-controller.js b/res/app/control-panes/advanced/vnc/vnc-controller.js index e0235bee..f3cce8cb 100644 --- a/res/app/control-panes/advanced/vnc/vnc-controller.js +++ b/res/app/control-panes/advanced/vnc/vnc-controller.js @@ -1,7 +1,7 @@ module.exports = function RemoteDebugCtrl($scope) { $scope.vnc = {} - $scope.generateVNCLogin = function () { + $scope.generateVNCLogin = function() { $scope.vnc = { serverHost: 'localhost' , serverPort: '7042' diff --git a/res/app/control-panes/advanced/vnc/vnc-spec.js b/res/app/control-panes/advanced/vnc/vnc-spec.js index c9b6d2fe..11c49975 100644 --- a/res/app/control-panes/advanced/vnc/vnc-spec.js +++ b/res/app/control-panes/advanced/vnc/vnc-spec.js @@ -1,17 +1,17 @@ -describe('VNCCtrl', function () { +describe('VNCCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('VNCCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('VNCCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/automation/device-settings/device-settings-controller.js b/res/app/control-panes/automation/device-settings/device-settings-controller.js index 005ddd5a..22de39d2 100644 --- a/res/app/control-panes/automation/device-settings/device-settings-controller.js +++ b/res/app/control-panes/automation/device-settings/device-settings-controller.js @@ -3,8 +3,8 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) { function getWifiStatus() { if ($scope.control) { - $scope.control.getWifiStatus().then(function (result) { - $scope.$apply(function () { + $scope.control.getWifiStatus().then(function(result) { + $scope.$apply(function() { $scope.wifiEnabled = (result.lastData === 'wifi_enabled') }) }) @@ -12,14 +12,14 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) { } getWifiStatus() - $scope.toggleWifi = function (enable) { + $scope.toggleWifi = function(enable) { if ($scope.control) { $scope.control.setWifiEnabled(enable) $timeout(getWifiStatus, 2500) } } - $scope.$watch('ringerMode', function (newValue, oldValue) { + $scope.$watch('ringerMode', function(newValue, oldValue) { if (oldValue) { if ($scope.control) { $scope.control.setRingerMode(newValue) @@ -29,8 +29,8 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) { function getRingerMode() { if ($scope.control) { - $scope.control.getRingerMode().then(function (result) { - $scope.$apply(function () { + $scope.control.getRingerMode().then(function(result) { + $scope.$apply(function() { $scope.ringerMode = result.body }) }) diff --git a/res/app/control-panes/automation/device-settings/device-settings-spec.js b/res/app/control-panes/automation/device-settings/device-settings-spec.js index e4d77f87..6c499943 100644 --- a/res/app/control-panes/automation/device-settings/device-settings-spec.js +++ b/res/app/control-panes/automation/device-settings/device-settings-spec.js @@ -1,17 +1,17 @@ -describe('DeviceSettingsCtrl', function () { +describe('DeviceSettingsCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('DeviceSettingsCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('DeviceSettingsCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/automation/device-settings/index.js b/res/app/control-panes/automation/device-settings/index.js index afb17e7e..a3602cc4 100644 --- a/res/app/control-panes/automation/device-settings/index.js +++ b/res/app/control-panes/automation/device-settings/index.js @@ -3,7 +3,7 @@ require('./device-settings.css') module.exports = angular.module('stf.device-settings', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/automation/device-settings/device-settings.jade', require('./device-settings.jade') ) diff --git a/res/app/control-panes/automation/index.js b/res/app/control-panes/automation/index.js index 0cf1e9f5..3ba2e852 100644 --- a/res/app/control-panes/automation/index.js +++ b/res/app/control-panes/automation/index.js @@ -2,7 +2,7 @@ module.exports = angular.module('stf.automation', [ require('./store-account').name, require('./device-settings').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/automation/automation.jade' , require('./automation.jade') diff --git a/res/app/control-panes/automation/store-account/index.js b/res/app/control-panes/automation/store-account/index.js index b0a2c871..28dfc41f 100644 --- a/res/app/control-panes/automation/store-account/index.js +++ b/res/app/control-panes/automation/store-account/index.js @@ -5,7 +5,7 @@ module.exports = angular.module('stf.store-account', [ 'angular-ladda', require('stf/common-ui/table').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/automation/store-account/store-account.jade', require('./store-account.jade') ) diff --git a/res/app/control-panes/automation/store-account/store-account-controller.js b/res/app/control-panes/automation/store-account/store-account-controller.js index 3e56e6e3..83ebda30 100644 --- a/res/app/control-panes/automation/store-account/store-account-controller.js +++ b/res/app/control-panes/automation/store-account/store-account-controller.js @@ -2,47 +2,47 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) { // TODO: This should come from the DB $scope.currentAppStore = 'google-play-store' $scope.deviceAppStores = { - "google-play-store": { - "type": 'google-play-store', - "name": 'Google Play Store', - "package": 'com.google' + 'google-play-store': { + type: 'google-play-store', + name: 'Google Play Store', + package: 'com.google' } } $scope.addingAccount = false - $scope.addAccount = function () { + $scope.addAccount = function() { $scope.addingAccount = true var user = $scope.storeLogin.username.$modelValue var pass = $scope.storeLogin.password.$modelValue - $scope.control.addAccount(user, pass).then(function () { - }).catch(function (result) { - console.log('Adding account failed', result) - }).finally(function () { + $scope.control.addAccount(user, pass).then(function() { + }).catch(function(result) { + throw new Error('Adding account failed', result) + }).finally(function() { $scope.addingAccount = false - $timeout(function () { + $timeout(function() { getAccounts() }, 500) }) } - $scope.removeAccount = function (account) { + $scope.removeAccount = function(account) { var storeAccountType = $scope.deviceAppStores[$scope.currentAppStore].package $scope.control.removeAccount(storeAccountType, account) - .then(function () { + .then(function() { getAccounts() }) - .catch(function (result) { - console.log('Removing account failed', result) + .catch(function(result) { + throw new Error('Removing account failed', result) }) } function getAccounts() { var storeAccountType = $scope.deviceAppStores[$scope.currentAppStore].package if ($scope.control) { - $scope.control.getAccounts(storeAccountType).then(function (result) { - $scope.$apply(function () { + $scope.control.getAccounts(storeAccountType).then(function(result) { + $scope.$apply(function() { $scope.accountsList = result.body }) }) diff --git a/res/app/control-panes/automation/store-account/store-account-spec.js b/res/app/control-panes/automation/store-account/store-account-spec.js index 0caf2cbe..e0a3d550 100644 --- a/res/app/control-panes/automation/store-account/store-account-spec.js +++ b/res/app/control-panes/automation/store-account/store-account-spec.js @@ -1,17 +1,17 @@ -describe('StoreAccountCtrl', function () { +describe('StoreAccountCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('StoreAccountCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('StoreAccountCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/control-panes-controller.js b/res/app/control-panes/control-panes-controller.js index ea936d18..f026d397 100644 --- a/res/app/control-panes/control-panes-controller.js +++ b/res/app/control-panes/control-panes-controller.js @@ -1,5 +1,5 @@ module.exports = - function ControlPanesController ($scope, $http, gettext, $routeParams, + function ControlPanesController($scope, $http, gettext, $routeParams, $timeout, $location, DeviceService, GroupService, ControlService, StorageService, FatalMessageService, SettingsService) { @@ -58,12 +58,12 @@ module.exports = $scope.control = null // TODO: Move this out to Ctrl.resolve - function getDevice (serial) { + function getDevice(serial) { DeviceService.get(serial, $scope) - .then(function (device) { + .then(function(device) { return GroupService.invite(device) }) - .then(function (device) { + .then(function(device) { $scope.device = device $scope.control = ControlService.create(device, device.channel) @@ -74,8 +74,8 @@ module.exports = return device }) - .catch(function () { - $timeout(function () { + .catch(function() { + $timeout(function() { $location.path('/') }) }) @@ -83,7 +83,7 @@ module.exports = getDevice($routeParams.serial) - $scope.$watch('device.state', function (newValue, oldValue) { + $scope.$watch('device.state', function(newValue, oldValue) { if (newValue !== oldValue) { if (oldValue === 'using') { FatalMessageService.open($scope.device, false) diff --git a/res/app/control-panes/control-panes-hotkeys-controller.js b/res/app/control-panes/control-panes-hotkeys-controller.js index b31f551b..c4b8bb87 100644 --- a/res/app/control-panes/control-panes-hotkeys-controller.js +++ b/res/app/control-panes/control-panes-hotkeys-controller.js @@ -1,24 +1,24 @@ module.exports = - function ($scope, gettext, $location, $rootScope, ScopedHotkeysService, + function($scope, gettext, $location, $rootScope, ScopedHotkeysService, $window) { $scope.remotePaneSize = '30% + 2px' var actions = { - previousDevice: function () { - console.log('prev') + previousDevice: function() { + // console.log('prev') }, - nextDevice: function () { - console.log('next') + nextDevice: function() { + // console.log('next') }, - deviceList: function () { + deviceList: function() { $location.path('/devices/') }, - switchCharset: function () { + switchCharset: function() { $scope.control.keyPress('switch_charset') }, // TODO: Refactor this - rotateLeft: function () { + rotateLeft: function() { var angle = 0 if ($scope.device && $scope.device.display) { angle = $scope.device.display.rotation @@ -35,7 +35,7 @@ module.exports = } }, - rotateRight: function () { + rotateRight: function() { var angle = 0 if ($scope.device && $scope.device.display) { angle = $scope.device.display.rotation @@ -51,34 +51,34 @@ module.exports = $window.resizeTo($window.outerHeight, $window.outerWidth) } }, - focusUrlBar: function () { + focusUrlBar: function() { // TODO: Switch tab and focus - console.log('focus') + // console.log('focus') }, - takeScreenShot: function () { + takeScreenShot: function() { // TODO: Switch tab and take screenshot //$scope.takeScreenShot() }, - pressMenu: function () { + pressMenu: function() { $scope.control.menu() }, - pressHome: function () { + pressHome: function() { $scope.control.home() }, - pressBack: function () { + pressBack: function() { $scope.control.back() }, - toggleDevice: function () { + toggleDevice: function() { // $scope.controlScreen.show = !$scope.controlScreen.show }, - togglePlatform: function () { + togglePlatform: function() { if ($rootScope.platform === 'web') { $rootScope.platform = 'native' } else { $rootScope.platform = 'web' } }, - scale: function () { + scale: function() { // TODO: scale size } } diff --git a/res/app/control-panes/control-panes-service.js b/res/app/control-panes/control-panes-service.js index 23caf119..53daeaee 100644 --- a/res/app/control-panes/control-panes-service.js +++ b/res/app/control-panes/control-panes-service.js @@ -4,4 +4,4 @@ module.exports = function ControlPanesServiceFactory() { return ControlPanesService -} \ No newline at end of file +} diff --git a/res/app/control-panes/cpu/cpu-spec.js b/res/app/control-panes/cpu/cpu-spec.js index 5a504046..17987896 100644 --- a/res/app/control-panes/cpu/cpu-spec.js +++ b/res/app/control-panes/cpu/cpu-spec.js @@ -1,17 +1,17 @@ -describe('CpuCtrl', function () { +describe('CpuCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('CpuCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('CpuCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/cpu/index.js b/res/app/control-panes/cpu/index.js index b88f08ab..49ce5b40 100644 --- a/res/app/control-panes/cpu/index.js +++ b/res/app/control-panes/cpu/index.js @@ -3,7 +3,7 @@ require('./cpu.css') module.exports = angular.module('stf.cpu', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/cpu/cpu.jade', require('./cpu.jade') ) diff --git a/res/app/control-panes/dashboard/apps/apps-controller.js b/res/app/control-panes/dashboard/apps/apps-controller.js index 2fd1bc82..f8d5ca06 100644 --- a/res/app/control-panes/dashboard/apps/apps-controller.js +++ b/res/app/control-panes/dashboard/apps/apps-controller.js @@ -3,12 +3,13 @@ module.exports = function ShellCtrl($scope) { $scope.result = null - var run = function (command) { + var run = function(cmd) { + var command = cmd // Force run activity command += ' --activity-clear-top' return $scope.control.shell(command) - .then(function (result) { - console.log(result) + .then(function(result) { + // console.log(result) }) } @@ -20,45 +21,45 @@ module.exports = function ShellCtrl($scope) { activity) } - $scope.openSettings = function () { + $scope.openSettings = function() { run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings') } - $scope.openWiFiSettings = function () { + $scope.openWiFiSettings = function() { //openSetting('WifiSettingsActivity') run('am start -a android.settings.WIFI_SETTINGS') } - $scope.openLocaleSettings = function () { + $scope.openLocaleSettings = function() { openSetting('LocalePickerActivity') } - $scope.openIMESettings = function () { + $scope.openIMESettings = function() { openSetting('KeyboardLayoutPickerActivity') } - $scope.openDisplaySettings = function () { + $scope.openDisplaySettings = function() { openSetting('DisplaySettingsActivity') } - $scope.openDeviceInfo = function () { + $scope.openDeviceInfo = function() { openSetting('DeviceInfoSettingsActivity') } - $scope.openManageApps = function () { + $scope.openManageApps = function() { //openSetting('ManageApplicationsActivity') run('am start -a android.settings.APPLICATION_SETTINGS') } - $scope.openRunningApps = function () { + $scope.openRunningApps = function() { openSetting('RunningServicesActivity') } - $scope.openDeveloperSettings = function () { + $scope.openDeveloperSettings = function() { openSetting('DevelopmentSettingsActivity') } - $scope.clear = function () { + $scope.clear = function() { $scope.command = '' $scope.data = '' $scope.result = null diff --git a/res/app/control-panes/dashboard/apps/index.js b/res/app/control-panes/dashboard/apps/index.js index 83862ae2..9ecb204f 100644 --- a/res/app/control-panes/dashboard/apps/index.js +++ b/res/app/control-panes/dashboard/apps/index.js @@ -3,7 +3,7 @@ require('./apps.css') module.exports = angular.module('stf.apps', [ require('stf/common-ui').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/dashboard/apps/apps.jade', require('./apps.jade') ) diff --git a/res/app/control-panes/dashboard/clipboard/clipboard-spec.js b/res/app/control-panes/dashboard/clipboard/clipboard-spec.js index 454f7f47..d836c567 100644 --- a/res/app/control-panes/dashboard/clipboard/clipboard-spec.js +++ b/res/app/control-panes/dashboard/clipboard/clipboard-spec.js @@ -1,17 +1,17 @@ -describe('ClipboardCtrl', function () { +describe('ClipboardCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('ClipboardCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('ClipboardCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/clipboard/index.js b/res/app/control-panes/dashboard/clipboard/index.js index 26051c0e..d51c363b 100644 --- a/res/app/control-panes/dashboard/clipboard/index.js +++ b/res/app/control-panes/dashboard/clipboard/index.js @@ -6,7 +6,7 @@ module.exports = angular.module('stf.clipboard', [ 'monospaced.elastic', require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/dashboard/clipboard/clipboard.jade', require('./clipboard.jade') ) diff --git a/res/app/control-panes/dashboard/dashboard-spec.js b/res/app/control-panes/dashboard/dashboard-spec.js index 347ab2c6..7b73334b 100644 --- a/res/app/control-panes/dashboard/dashboard-spec.js +++ b/res/app/control-panes/dashboard/dashboard-spec.js @@ -1,17 +1,17 @@ -describe('DashboardCtrl', function () { +describe('DashboardCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('DashboardCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('DashboardCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/index.js b/res/app/control-panes/dashboard/index.js index cf4eb274..4ee62e6f 100644 --- a/res/app/control-panes/dashboard/index.js +++ b/res/app/control-panes/dashboard/index.js @@ -6,7 +6,7 @@ module.exports = angular.module('stf.dashboard', [ require('./clipboard/index').name, require('./remote-debug/index').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/dashboard/dashboard.jade' , require('./dashboard.jade') diff --git a/res/app/control-panes/dashboard/install/activities/activities-controller.js b/res/app/control-panes/dashboard/install/activities/activities-controller.js index 775c1366..b1afb243 100644 --- a/res/app/control-panes/dashboard/install/activities/activities-controller.js +++ b/res/app/control-panes/dashboard/install/activities/activities-controller.js @@ -15,33 +15,33 @@ module.exports = function ActivitiesCtrl($scope) { $scope.packageNames = [$scope.selectedPackageName] $scope.activityNames = [] - $scope.$watch('installation.manifest.application', function (newValue) { + $scope.$watch('installation.manifest.application', function(newValue) { if (newValue.activities) { var activityActions = [] var activityCategories = [] var activityData = [] var activityNames = [] - _.forEach(newValue.activities, function (activity) { + _.forEach(newValue.activities, function(activity) { if (activity.name) { activityNames.push(activity.name) } - _.forEach(activity.intentFilters, function (intentFilter) { + _.forEach(activity.intentFilters, function(intentFilter) { - _.forEach(intentFilter.actions, function (action) { + _.forEach(intentFilter.actions, function(action) { if (action.name) { activityActions.push(action.name) } }) - _.forEach(intentFilter.categories, function (category) { + _.forEach(intentFilter.categories, function(category) { if (category.name) { activityCategories.push(category.name) } }) - _.forEach(intentFilter.data, function (data) { + _.forEach(intentFilter.data, function(data) { if (data.scheme) { var uri = data.scheme + '://' if (data.host) { @@ -72,7 +72,7 @@ module.exports = function ActivitiesCtrl($scope) { } }) - $scope.runActivity = function () { + $scope.runActivity = function() { var command = 'am start' if ($scope.selectedAction) { command += ' -a ' + $scope.selectedAction @@ -89,8 +89,8 @@ module.exports = function ActivitiesCtrl($scope) { } return $scope.control.shell(command) - .then(function (result) { - console.log(result) + .then(function(result) { + // console.log(result) }) } } diff --git a/res/app/control-panes/dashboard/install/activities/activities-spec.js b/res/app/control-panes/dashboard/install/activities/activities-spec.js index efb3cd20..511582f6 100644 --- a/res/app/control-panes/dashboard/install/activities/activities-spec.js +++ b/res/app/control-panes/dashboard/install/activities/activities-spec.js @@ -1,17 +1,17 @@ -describe('ActivitiesCtrl', function () { +describe('ActivitiesCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('ActivitiesCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('ActivitiesCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/install/activities/index.js b/res/app/control-panes/dashboard/install/activities/index.js index 49197681..490414a2 100644 --- a/res/app/control-panes/dashboard/install/activities/index.js +++ b/res/app/control-panes/dashboard/install/activities/index.js @@ -3,7 +3,7 @@ require('./activities.css') module.exports = angular.module('stf.activities', [ require('stf/common-ui').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/dashboard/install/activities/activities.jade', require('./activities.jade') diff --git a/res/app/control-panes/dashboard/install/index.js b/res/app/control-panes/dashboard/install/index.js index d353dc24..b5ebb85a 100644 --- a/res/app/control-panes/dashboard/install/index.js +++ b/res/app/control-panes/dashboard/install/index.js @@ -10,7 +10,7 @@ module.exports = angular.module('stf.install', [ require('stf/install').name, require('stf/upload').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/dashboard/install/install.jade', require('./install.jade') ) diff --git a/res/app/control-panes/dashboard/install/install-controller.js b/res/app/control-panes/dashboard/install/install-controller.js index 9a7ebfff..a49193c6 100644 --- a/res/app/control-panes/dashboard/install/install-controller.js +++ b/res/app/control-panes/dashboard/install/install-controller.js @@ -5,7 +5,7 @@ module.exports = function InstallCtrl( $scope.accordionOpen = true $scope.installation = null - $scope.clear = function () { + $scope.clear = function() { $scope.installation = null $scope.accordionOpen = false } @@ -14,21 +14,21 @@ module.exports = function InstallCtrl( $scope.installation = installation.apply($scope) }) - $scope.installUrl = function (url) { + $scope.installUrl = function(url) { return InstallService.installUrl($scope.control, url) } - $scope.installFile = function ($files) { + $scope.installFile = function($files) { if ($files.length) { return InstallService.installFile($scope.control, $files) } } - $scope.uninstall = function (packageName) { + $scope.uninstall = function(packageName) { // TODO: After clicking uninstall accordion opens return $scope.control.uninstall(packageName) - .then(function () { - $scope.$apply(function () { + .then(function() { + $scope.$apply(function() { $scope.clear() }) }) diff --git a/res/app/control-panes/dashboard/install/install-spec.js b/res/app/control-panes/dashboard/install/install-spec.js index f25e7b91..438ab6d4 100644 --- a/res/app/control-panes/dashboard/install/install-spec.js +++ b/res/app/control-panes/dashboard/install/install-spec.js @@ -1,17 +1,17 @@ -describe('InstallCtrl', function () { +describe('InstallCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('InstallCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('InstallCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/navigation/index.js b/res/app/control-panes/dashboard/navigation/index.js index d611c9ae..db2068b1 100644 --- a/res/app/control-panes/dashboard/navigation/index.js +++ b/res/app/control-panes/dashboard/navigation/index.js @@ -3,7 +3,7 @@ require('./navigation.css') module.exports = angular.module('stf.navigation', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/dashboard/navigation/navigation.jade', require('./navigation.jade') ) diff --git a/res/app/control-panes/dashboard/navigation/navigation-controller.js b/res/app/control-panes/dashboard/navigation/navigation-controller.js index 8a0f0c29..8ea10e15 100644 --- a/res/app/control-panes/dashboard/navigation/navigation-controller.js +++ b/res/app/control-panes/dashboard/navigation/navigation-controller.js @@ -17,7 +17,7 @@ module.exports = function NavigationCtrl($scope, $rootScope) { resetFavicon() - $scope.textUrlChanged = function () { + $scope.textUrlChanged = function() { if (faviconIsSet) { resetFavicon() } @@ -33,7 +33,7 @@ module.exports = function NavigationCtrl($scope, $rootScope) { $scope.blurUrl = false - $scope.openURL = function () { + $scope.openURL = function() { $scope.blurUrl = true $rootScope.screenFocus = true @@ -64,13 +64,13 @@ module.exports = function NavigationCtrl($scope, $rootScope) { setCurrentBrowser($scope.device ? $scope.device.browser : null) - $scope.$watch('device.browser', function (newValue, oldValue) { + $scope.$watch('device.browser', function(newValue, oldValue) { if (newValue !== oldValue) { setCurrentBrowser(newValue) } }, true) - $scope.clearSettings = function () { + $scope.clearSettings = function() { var browser = $scope.browser $scope.control.clearBrowser(browser) } diff --git a/res/app/control-panes/dashboard/navigation/navigation-spec.js b/res/app/control-panes/dashboard/navigation/navigation-spec.js index 8889efa8..9ec253f5 100644 --- a/res/app/control-panes/dashboard/navigation/navigation-spec.js +++ b/res/app/control-panes/dashboard/navigation/navigation-spec.js @@ -1,17 +1,17 @@ -describe('NavigationCtrl', function () { +describe('NavigationCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('NavigationCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('NavigationCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/remote-debug/index.js b/res/app/control-panes/dashboard/remote-debug/index.js index 16150d96..907ea5d7 100644 --- a/res/app/control-panes/dashboard/remote-debug/index.js +++ b/res/app/control-panes/dashboard/remote-debug/index.js @@ -3,7 +3,7 @@ require('./remote-debug.css') module.exports = angular.module('stf.remote-debug', [ require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'control-panes/advanced/remote-debug/remote-debug.jade', require('./remote-debug.jade') diff --git a/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js b/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js index d08a2d17..05fa980f 100644 --- a/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js +++ b/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js @@ -1,9 +1,9 @@ module.exports = function RemoteDebugCtrl($scope, $timeout, gettext) { function startRemoteConnect() { if ($scope.control) { - $scope.control.startRemoteConnect().then(function (result) { + $scope.control.startRemoteConnect().then(function(result) { var url = result.lastData - $scope.$apply(function () { + $scope.$apply(function() { $scope.debugCommand = 'adb connect ' + url }) }) @@ -15,14 +15,14 @@ module.exports = function RemoteDebugCtrl($scope, $timeout, gettext) { // TODO: Remove timeout and fix control initialization if (!startRemoteConnect()) { - $timeout(function () { + $timeout(function() { if (!startRemoteConnect()) { $timeout(startRemoteConnect, 1000) } }, 200) } - $scope.$watch('platform', function (newValue) { + $scope.$watch('platform', function(newValue) { if (newValue === 'native') { $scope.remoteDebugTooltip = gettext('Run the following on your command line to debug the device from your IDE') diff --git a/res/app/control-panes/dashboard/remote-debug/remote-debug-spec.js b/res/app/control-panes/dashboard/remote-debug/remote-debug-spec.js index df9d31ed..75ac380f 100644 --- a/res/app/control-panes/dashboard/remote-debug/remote-debug-spec.js +++ b/res/app/control-panes/dashboard/remote-debug/remote-debug-spec.js @@ -1,17 +1,17 @@ -describe('RemoteDebugCtrl', function () { +describe('RemoteDebugCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('RemoteDebugCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('RemoteDebugCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/dashboard/shell/index.js b/res/app/control-panes/dashboard/shell/index.js index 7e564ed7..6570c3ac 100644 --- a/res/app/control-panes/dashboard/shell/index.js +++ b/res/app/control-panes/dashboard/shell/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.shell', [ require('stf/common-ui').name, require('gettext').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/dashboard/shell/shell.jade', require('./shell.jade') ) diff --git a/res/app/control-panes/dashboard/shell/shell-controller.js b/res/app/control-panes/dashboard/shell/shell-controller.js index dc746f99..47025ff2 100644 --- a/res/app/control-panes/dashboard/shell/shell-controller.js +++ b/res/app/control-panes/dashboard/shell/shell-controller.js @@ -22,7 +22,7 @@ module.exports = function ShellCtrl($scope) { }) } - $scope.clear = function () { + $scope.clear = function() { $scope.command = '' $scope.data = '' $scope.result = null diff --git a/res/app/control-panes/dashboard/shell/shell-spec.js b/res/app/control-panes/dashboard/shell/shell-spec.js index 10ea077a..db396ae8 100644 --- a/res/app/control-panes/dashboard/shell/shell-spec.js +++ b/res/app/control-panes/dashboard/shell/shell-spec.js @@ -1,15 +1,15 @@ -describe('ShellCtrl', function () { +describe('ShellCtrl', function() { beforeEach(angular.mock.module(require('./').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('ShellCtrl', {$scope: scope}) })) - it('should clear the results', inject(function () { + it('should clear the results', inject(function() { scope.result = ['result'] scope.run('clear') expect(scope.result).toBe(null) diff --git a/res/app/control-panes/device-control/device-control-controller.js b/res/app/control-panes/device-control/device-control-controller.js index dd26f98c..64246663 100644 --- a/res/app/control-panes/device-control/device-control-controller.js +++ b/res/app/control-panes/device-control/device-control-controller.js @@ -9,7 +9,7 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, $scope.groupDevices = $scope.groupTracker.devices - $scope.kickDevice = function (device) { + $scope.kickDevice = function(device) { if (!device || !$scope.device) { alert('No device found') @@ -24,24 +24,24 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, if ($scope.groupDevices.length > 1) { // Control first free device first - var firstFreeDevice = _.find($scope.groupDevices, function (dev) { + var firstFreeDevice = _.find($scope.groupDevices, function(dev) { return dev.serial !== $scope.device.serial }) $scope.controlDevice(firstFreeDevice) // Then kick the old device - GroupService.kick(device).then(function () { + GroupService.kick(device).then(function() { $scope.$digest() }) } else { // Kick the device - GroupService.kick(device).then(function () { + GroupService.kick(device).then(function() { $scope.$digest() }) $location.path('/devices/') } } else { - GroupService.kick(device).then(function () { + GroupService.kick(device).then(function() { $scope.$digest() }) } @@ -50,35 +50,37 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, } } - $scope.controlDevice = function (device) { + $scope.controlDevice = function(device) { $location.path('/control/' + device.serial) } - function isPortrait(value) { + function isPortrait(val) { + var value = val if (typeof value === 'undefined' && $scope.device) { value = $scope.device.display.rotation } return (value === 0 || value === 180) } - function isLandscape(value) { + function isLandscape(val) { + var value = val if (typeof value === 'undefined' && $scope.device) { value = $scope.device.display.rotation } return (value === 90 || value === 270) } - $scope.tryToRotate = function (rotation) { + $scope.tryToRotate = function(rotation) { if (rotation === 'portrait') { $scope.control.rotate(0) - $timeout(function () { + $timeout(function() { if (isLandscape()) { $scope.currentRotation = 'landscape' } }, 400) } else if (rotation === 'landscape') { $scope.control.rotate(90) - $timeout(function () { + $timeout(function() { if (isPortrait()) { $scope.currentRotation = 'portrait' } @@ -88,7 +90,7 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, $scope.currentRotation = 'portrait' - $scope.$watch('device.display.rotation', function (newValue) { + $scope.$watch('device.display.rotation', function(newValue) { if (isPortrait(newValue)) { $scope.currentRotation = 'portrait' } else if (isLandscape(newValue)) { @@ -97,7 +99,7 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, }) // TODO: Refactor this inside control and server-side - $scope.rotateLeft = function () { + $scope.rotateLeft = function() { var angle = 0 if ($scope.device && $scope.device.display) { angle = $scope.device.display.rotation @@ -114,7 +116,7 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, } } - $scope.rotateRight = function () { + $scope.rotateRight = function() { var angle = 0 if ($scope.device && $scope.device.display) { angle = $scope.device.display.rotation diff --git a/res/app/control-panes/device-control/device-control-key-directive.js b/res/app/control-panes/device-control/device-control-key-directive.js index 07d26bf6..d7c4e125 100644 --- a/res/app/control-panes/device-control/device-control-key-directive.js +++ b/res/app/control-panes/device-control/device-control-key-directive.js @@ -1,7 +1,7 @@ module.exports = function DeviceControlKeyDirective() { return { restrict: 'A' - , link: function (scope, element, attrs) { + , link: function(scope, element, attrs) { var key = attrs.deviceControlKey function up() { diff --git a/res/app/control-panes/device-control/index.js b/res/app/control-panes/device-control/index.js index 87a79b68..6fb3e3ec 100644 --- a/res/app/control-panes/device-control/index.js +++ b/res/app/control-panes/device-control/index.js @@ -7,7 +7,7 @@ module.exports = angular.module('device-control', [ require('ng-context-menu').name, require('stf/device-context-menu').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/device-control/device-control.jade', require('./device-control.jade') ) diff --git a/res/app/control-panes/explorer/explorer-controller.js b/res/app/control-panes/explorer/explorer-controller.js index 478023e5..23c22178 100644 --- a/res/app/control-panes/explorer/explorer-controller.js +++ b/res/app/control-panes/explorer/explorer-controller.js @@ -5,7 +5,7 @@ module.exports = function ExplorerCtrl($scope) { paths: [] } - $scope.getAbsolutePath = function () { + $scope.getAbsolutePath = function() { return ('/' + $scope.explorer.paths.join('/')).replace(/\/\/+/g, '/') } @@ -18,16 +18,16 @@ module.exports = function ExplorerCtrl($scope) { $scope.explorer.search = path $scope.control.fslist(path) - .then(function (result) { - $scope.explorer.files = result.body; - $scope.$digest(); + .then(function(result) { + $scope.explorer.files = result.body + $scope.$digest() }) - .catch(function (err) { - alert(err.message) + .catch(function(err) { + throw new Error(err.message) }) } - $scope.dirEnterLocation = function () { + $scope.dirEnterLocation = function() { if ($scope.explorer.search) { resetPaths($scope.explorer.search) listDir() @@ -35,7 +35,7 @@ module.exports = function ExplorerCtrl($scope) { } } - $scope.dirEnter = function (name) { + $scope.dirEnter = function(name) { if (name) { $scope.explorer.paths.push(name) } @@ -43,7 +43,7 @@ module.exports = function ExplorerCtrl($scope) { $scope.explorer.search = $scope.getAbsolutePath() } - $scope.dirUp = function () { + $scope.dirUp = function() { if ($scope.explorer.paths.length !== 0) { $scope.explorer.paths.pop() } @@ -51,16 +51,16 @@ module.exports = function ExplorerCtrl($scope) { $scope.explorer.search = $scope.getAbsolutePath() } - $scope.getFile = function (file) { + $scope.getFile = function(file) { var path = $scope.getAbsolutePath() + '/' + file $scope.control.fsretrieve(path) - .then(function (result) { + .then(function(result) { if (result.body) { - location.href = result.body.href + "?download" + location.href = result.body.href + '?download' } }) - .catch(function (err) { - alert(err.message) + .catch(function(err) { + throw new Error(err.message) }) } diff --git a/res/app/control-panes/explorer/explorer-spec.js b/res/app/control-panes/explorer/explorer-spec.js index 52ebf1af..bdfb1d3e 100644 --- a/res/app/control-panes/explorer/explorer-spec.js +++ b/res/app/control-panes/explorer/explorer-spec.js @@ -1,15 +1,15 @@ -describe('FsCtrl', function () { +describe('FsCtrl', function() { beforeEach(angular.mock.module(require('./').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('ExplorerCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/control-panes/explorer/index.js b/res/app/control-panes/explorer/index.js index db6d88aa..4a275cd7 100644 --- a/res/app/control-panes/explorer/index.js +++ b/res/app/control-panes/explorer/index.js @@ -1,16 +1,16 @@ require('./explorer.css') module.exports = angular.module('stf.explorer', []) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/explorer/explorer.jade', require('./explorer.jade') ) }]) - .filter('formatPermissionMode', function () { - return function (mode) { + .filter('formatPermissionMode', function() { + return function(mode) { if (mode !== null) { - var res = []; - var s = ['x', 'w', 'r']; + var res = [] + var s = ['x', 'w', 'r'] for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { if ((mode >> (i * 3 + j)) & 1 !== 0) { @@ -20,22 +20,23 @@ module.exports = angular.module('stf.explorer', []) } } } - res.unshift(mode & 040000 ? 'd' : '-'); - return res.join(''); + res.unshift(mode & 040000 ? 'd' : '-') + return res.join('') } } }) - .filter('fileIsDir', function () { - return function (mode) { + .filter('fileIsDir', function() { + return function(m) { + var mode = m if (mode !== null) { mode = parseInt(mode, 10) - mode = mode - (mode & 0777) - return (mode == 040000) || (mode == 0120000) + mode -= (mode & 0777) + return (mode === 040000) || (mode === 0120000) } } }) - .filter('formatFileSize', function () { - return function (size) { + .filter('formatFileSize', function() { + return function(size) { var formattedSize if (size < 1024) { formattedSize = size + ' B' @@ -47,8 +48,8 @@ module.exports = angular.module('stf.explorer', []) return formattedSize } }) - .filter('formatFileDate', function () { - return function (inputString) { + .filter('formatFileDate', function() { + return function(inputString) { var input = new Date(inputString) return input instanceof Date ? input.toISOString().substring(0, 19).replace('T', ' ') : diff --git a/res/app/control-panes/index.js b/res/app/control-panes/index.js index 1e35aeb6..70fa134c 100644 --- a/res/app/control-panes/index.js +++ b/res/app/control-panes/index.js @@ -16,7 +16,7 @@ module.exports = angular.module('control-panes', [ require('./explorer').name, require('./info').name ]) - .config(['$routeProvider', function ($routeProvider) { + .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/control', { diff --git a/res/app/control-panes/info/index.js b/res/app/control-panes/info/index.js index 7f505cde..26c9a5a2 100644 --- a/res/app/control-panes/info/index.js +++ b/res/app/control-panes/info/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.info', [ require('stf/angular-packery').name, require('stf/common-ui/modals/lightbox-image').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/info/info.jade', require('./info.jade') ) diff --git a/res/app/control-panes/info/info-controller.js b/res/app/control-panes/info/info-controller.js index f7aeea23..a2eb1851 100644 --- a/res/app/control-panes/info/info-controller.js +++ b/res/app/control-panes/info/info-controller.js @@ -1,14 +1,14 @@ module.exports = function InfoCtrl($scope, LightboxImageService) { - $scope.openDevicePhoto = function (device) { + $scope.openDevicePhoto = function(device) { var title = device.name var enhancedPhoto800 = '/static/app/devices/photo/x800/' + device.image LightboxImageService.open(title, enhancedPhoto800) } - var getSdStatus = function () { + var getSdStatus = function() { if ($scope.control) { - $scope.control.getSdStatus().then(function (result) { - $scope.$apply(function () { + $scope.control.getSdStatus().then(function(result) { + $scope.$apply(function() { $scope.sdCardMounted = (result.lastData === 'sd_mounted') }) }) diff --git a/res/app/control-panes/info/info-spec.js b/res/app/control-panes/info/info-spec.js index d3f63880..6000c9fb 100644 --- a/res/app/control-panes/info/info-spec.js +++ b/res/app/control-panes/info/info-spec.js @@ -1,17 +1,17 @@ -describe('InfoCtrl', function () { +describe('InfoCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('InfoCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('InfoCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/inspect/index.js b/res/app/control-panes/inspect/index.js index d73c5403..e604b0e0 100644 --- a/res/app/control-panes/inspect/index.js +++ b/res/app/control-panes/inspect/index.js @@ -3,7 +3,7 @@ require('./inspect.css') module.exports = angular.module('stf.inspect', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/inspect/inspect.jade', require('./inspect.jade') ) diff --git a/res/app/control-panes/inspect/inspect-spec.js b/res/app/control-panes/inspect/inspect-spec.js index 4c0797e5..4fd98a10 100644 --- a/res/app/control-panes/inspect/inspect-spec.js +++ b/res/app/control-panes/inspect/inspect-spec.js @@ -1,17 +1,17 @@ -describe('InspectCtrl', function () { +describe('InspectCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('InspectCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('InspectCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/logs/index.js b/res/app/control-panes/logs/index.js index 676464c5..e8cc0d70 100644 --- a/res/app/control-panes/logs/index.js +++ b/res/app/control-panes/logs/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.logs', [ require('stf/logcat').name, require('stf/logcat-table').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/logs/logs.jade', require('./logs.jade') ) diff --git a/res/app/control-panes/logs/logs-controller.js b/res/app/control-panes/logs/logs-controller.js index ee6069e9..86f91b98 100644 --- a/res/app/control-panes/logs/logs-controller.js +++ b/res/app/control-panes/logs/logs-controller.js @@ -8,11 +8,11 @@ module.exports = function LogsCtrl($scope, LogcatService) { LogcatService.filters.filterLines() - $scope.$watch('started', function (newValue, oldValue) { + $scope.$watch('started', function(newValue, oldValue) { if (newValue !== oldValue) { LogcatService.started = newValue if (newValue) { - $scope.control.startLogcat([]).then(function () { + $scope.control.startLogcat([]).then(function() { }) } else { $scope.control.stopLogcat() @@ -20,19 +20,19 @@ module.exports = function LogsCtrl($scope, LogcatService) { } }) - window.onbeforeunload = function () { + window.onbeforeunload = function() { if ($scope.control) { $scope.control.stopLogcat() } } - $scope.clear = function () { + $scope.clear = function() { LogcatService.clear() } function defineFilterWatchers(props) { - angular.forEach(props, function (prop) { - $scope.$watch('filters.' + prop, function (newValue, oldValue) { + angular.forEach(props, function(prop) { + $scope.$watch('filters.' + prop, function(newValue, oldValue) { if (!angular.equals(newValue, oldValue)) { LogcatService.filters[prop] = newValue } diff --git a/res/app/control-panes/logs/logs-spec.js b/res/app/control-panes/logs/logs-spec.js index 1b4a15c7..a07264a4 100644 --- a/res/app/control-panes/logs/logs-spec.js +++ b/res/app/control-panes/logs/logs-spec.js @@ -1,17 +1,17 @@ -describe('LogsCtrl', function () { +describe('LogsCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('LogsCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('LogsCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/performance/cpu/cpu-spec.js b/res/app/control-panes/performance/cpu/cpu-spec.js index 85e92102..d57fd96e 100644 --- a/res/app/control-panes/performance/cpu/cpu-spec.js +++ b/res/app/control-panes/performance/cpu/cpu-spec.js @@ -1,15 +1,15 @@ -describe('CpuCtrl', function () { +describe('CpuCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('CpuCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/control-panes/performance/cpu/index.js b/res/app/control-panes/performance/cpu/index.js index 60542899..2751bbf5 100644 --- a/res/app/control-panes/performance/cpu/index.js +++ b/res/app/control-panes/performance/cpu/index.js @@ -1,11 +1,9 @@ require('./cpu.css') - - module.exports = angular.module('stf.cpu', [ require('epoch').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/performance/cpu/cpu.jade', require('./cpu.jade') ) diff --git a/res/app/control-panes/performance/index.js b/res/app/control-panes/performance/index.js index fcb95894..ffb58295 100644 --- a/res/app/control-panes/performance/index.js +++ b/res/app/control-panes/performance/index.js @@ -3,7 +3,7 @@ require('./performance.css') module.exports = angular.module('stf.performance', [ require('./cpu').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/performance/performance.jade', require('./performance.jade') ) diff --git a/res/app/control-panes/performance/performance-spec.js b/res/app/control-panes/performance/performance-spec.js index ab525f8b..d38ac560 100644 --- a/res/app/control-panes/performance/performance-spec.js +++ b/res/app/control-panes/performance/performance-spec.js @@ -1,15 +1,15 @@ -describe('PerformanceCtrl', function () { +describe('PerformanceCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('PerformanceCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/control-panes/resources/index.js b/res/app/control-panes/resources/index.js index 012adcfc..b28c3491 100644 --- a/res/app/control-panes/resources/index.js +++ b/res/app/control-panes/resources/index.js @@ -3,7 +3,7 @@ require('./resources.css') module.exports = angular.module('stf.resources', [ ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/resources/resources.jade', require('./resources.jade') ) diff --git a/res/app/control-panes/resources/resources-spec.js b/res/app/control-panes/resources/resources-spec.js index 12e5950e..6c23d374 100644 --- a/res/app/control-panes/resources/resources-spec.js +++ b/res/app/control-panes/resources/resources-spec.js @@ -1,17 +1,17 @@ -describe('ResourcesCtrl', function () { +describe('ResourcesCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('ResourcesCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('ResourcesCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/control-panes/screenshots/index.js b/res/app/control-panes/screenshots/index.js index 2b2d8a83..6c4d9864 100644 --- a/res/app/control-panes/screenshots/index.js +++ b/res/app/control-panes/screenshots/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.screenshots', [ require('stf/image-onload').name, require('stf/settings').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('control-panes/screenshots/screenshots.jade', require('./screenshots.jade') ) diff --git a/res/app/control-panes/screenshots/screenshots-controller.js b/res/app/control-panes/screenshots/screenshots-controller.js index 994d197f..1ae167df 100644 --- a/res/app/control-panes/screenshots/screenshots-controller.js +++ b/res/app/control-panes/screenshots/screenshots-controller.js @@ -2,11 +2,11 @@ module.exports = function ScreenshotsCtrl($scope) { $scope.screenshots = [] $scope.screenShotSize = 400 - $scope.clear = function () { + $scope.clear = function() { $scope.screenshots = [] } - $scope.shotSizeParameter = function (maxSize, multiplier) { + $scope.shotSizeParameter = function(maxSize, multiplier) { var finalSize = $scope.screenShotSize * multiplier var finalMaxSize = maxSize * multiplier @@ -14,15 +14,15 @@ module.exports = function ScreenshotsCtrl($scope) { '?crop=' + finalSize + 'x' } - $scope.takeScreenShot = function () { - $scope.control.screenshot().then(function (result) { - $scope.$apply(function () { + $scope.takeScreenShot = function() { + $scope.control.screenshot().then(function(result) { + $scope.$apply(function() { $scope.screenshots.unshift(result) }) }) } - $scope.zoom = function (param) { + $scope.zoom = function(param) { var newValue = parseInt($scope.screenShotSize, 10) + param.step if (param.min && newValue < param.min) { newValue = param.min diff --git a/res/app/control-panes/screenshots/screenshots-spec.js b/res/app/control-panes/screenshots/screenshots-spec.js index 778fe7db..7f39708f 100644 --- a/res/app/control-panes/screenshots/screenshots-spec.js +++ b/res/app/control-panes/screenshots/screenshots-spec.js @@ -1,17 +1,17 @@ -describe('ScreenshotsCtrl', function () { +describe('ScreenshotsCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('ScreenshotsCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('ScreenshotsCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/device-list/column/device-column-service.js b/res/app/device-list/column/device-column-service.js index c8c8dfac..750fb42b 100644 --- a/res/app/device-list/column/device-column-service.js +++ b/res/app/device-list/column/device-column-service.js @@ -58,14 +58,14 @@ module.exports = function DeviceColumnService($filter, gettext) { } , compare: function(deviceA, deviceB) { var va = (deviceA.version || '0').split('.') - , vb = (deviceB.version || '0').split('.') - , la = va.length - , lb = vb.length + var vb = (deviceB.version || '0').split('.') + var la = va.length + var lb = vb.length for (var i = 0, l = Math.max(la, lb); i < l; ++i) { var a = i < la ? parseInt(va[i], 10) : 0 - , b = i < lb ? parseInt(vb[i], 10) : 0 - , diff = a - b + var b = i < lb ? parseInt(vb[i], 10) : 0 + var diff = a - b // One of the values might be something like 'M'. If so, do a string // comparison instead. @@ -82,10 +82,10 @@ module.exports = function DeviceColumnService($filter, gettext) { } , filter: function(device, filter) { var va = (device.version || '0').split('.') - , vb = (filter.query || '0').split('.') - , la = va.length - , lb = vb.length - , op = filterOps[filter.op || '='] + var vb = (filter.query || '0').split('.') + var la = va.length + var lb = vb.length + var op = filterOps[filter.op || '='] // We have a single value and no operator or field. It matches // too easily, let's wait for a dot (e.g. '5.'). An example of a @@ -106,7 +106,7 @@ module.exports = function DeviceColumnService($filter, gettext) { for (var i = 0, l = Math.min(la, lb); i < l; ++i) { var a = parseInt(va[i], 10) - , b = parseInt(vb[i], 10) + var b = parseInt(vb[i], 10) // One of the values might be non-numeric, e.g. 'M'. In that case // filter by string value instead. @@ -231,7 +231,7 @@ module.exports = function DeviceColumnService($filter, gettext) { } , compare: function(deviceA, deviceB) { var va = deviceA.battery ? deviceA.battery.level : 0 - , vb = deviceB.battery ? deviceB.battery.level : 0 + var vb = deviceB.battery ? deviceB.battery.level : 0 return va - vb } }) @@ -242,7 +242,7 @@ module.exports = function DeviceColumnService($filter, gettext) { } , compare: function(deviceA, deviceB) { var va = deviceA.battery ? deviceA.battery.temp : 0 - , vb = deviceB.battery ? deviceB.battery.temp : 0 + var vb = deviceB.battery ? deviceB.battery.temp : 0 return va - vb } }) @@ -277,27 +277,36 @@ function zeroPadTwoDigit(digit) { function compareIgnoreCase(a, b) { var la = (a || '').toLowerCase() - , lb = (b || '').toLowerCase() - return la === lb ? 0 : (la < lb ? -1 : 1) + var lb = (b || '').toLowerCase() + if (la === lb) { + return 0 + } + else { + return la < lb ? -1 : 1 + } } function filterIgnoreCase(a, filterValue) { var va = (a || '').toLowerCase() - , vb = filterValue.toLowerCase() + var vb = filterValue.toLowerCase() return va.indexOf(vb) !== -1 } function compareRespectCase(a, b) { - return a === b ? 0 : (a < b ? -1 : 1) + if (a === b) { + return 0 + } + else { + return a < b ? -1 : 1 + } } - function TextCell(options) { return _.defaults(options, { title: options.title , defaultOrder: 'asc' - , build: function () { + , build: function() { var td = document.createElement('td') td.appendChild(document.createTextNode('')) return td @@ -320,7 +329,7 @@ function NumberCell(options) { return _.defaults(options, { title: options.title , defaultOrder: 'asc' - , build: function () { + , build: function() { var td = document.createElement('td') td.appendChild(document.createTextNode('')) return td @@ -337,7 +346,7 @@ function NumberCell(options) { return function(item, filter) { return filterOps[filter.op || '=']( options.value(item) - , +filter.query + , Number(filter.query) ) } })() @@ -348,14 +357,14 @@ function DateCell(options) { return _.defaults(options, { title: options.title , defaultOrder: 'desc' - , build: function () { + , build: function() { var td = document.createElement('td') td.appendChild(document.createTextNode('')) return td } , update: function(td, item) { var t = td.firstChild - , date = options.value(item) + var date = options.value(item) if (date) { t.nodeValue = date.getFullYear() + '-' @@ -370,7 +379,7 @@ function DateCell(options) { } , compare: function(a, b) { var va = options.value(a) || 0 - , vb = options.value(b) || 0 + var vb = options.value(b) || 0 return va - vb } , filter: (function() { @@ -381,8 +390,8 @@ function DateCell(options) { } return function(item, filter) { var filterDate = new Date(filter.query) - , va = dateNumber(options.value(item)) - , vb = dateNumber(filterDate) + var va = dateNumber(options.value(item)) + var vb = dateNumber(filterDate) return filterOps[filter.op || '='](va, vb) } })() @@ -393,17 +402,17 @@ function LinkCell(options) { return _.defaults(options, { title: options.title , defaultOrder: 'asc' - , build: function () { + , build: function() { var td = document.createElement('td') - , a = document.createElement('a') + var a = document.createElement('a') a.appendChild(document.createTextNode('')) td.appendChild(a) return td } , update: function(td, item) { var a = td.firstChild - , t = a.firstChild - , href = options.link(item) + var t = a.firstChild + var href = options.link(item) if (href) { a.setAttribute('href', href) } @@ -429,22 +438,22 @@ function DeviceBrowserCell(options) { , defaultOrder: 'asc' , build: function() { var td = document.createElement('td') - , span = document.createElement('span') + var span = document.createElement('span') span.className = 'device-browser-list' td.appendChild(span) return td } , update: function(td, device) { var span = td.firstChild - , browser = options.value(device) - , apps = browser.apps.slice().sort(function(appA, appB) { + var browser = options.value(device) + var apps = browser.apps.slice().sort(function(appA, appB) { return compareIgnoreCase(appA.name, appB.name) }) for (var i = 0, l = apps.length; i < l; ++i) { var app = apps[i] - , img = span.childNodes[i] || span.appendChild(document.createElement('img')) - , src = '/static/app/browsers/icon/36x36/' + (app.type || '_default') + '.png' + var img = span.childNodes[i] || span.appendChild(document.createElement('img')) + var src = '/static/app/browsers/icon/36x36/' + (app.type || '_default') + '.png' // Only change if necessary so that we don't trigger a download if (img.getAttribute('src') !== src) { @@ -477,8 +486,8 @@ function DeviceModelCell(options) { , defaultOrder: 'asc' , build: function() { var td = document.createElement('td') - , span = document.createElement('span') - , image = document.createElement('img') + var span = document.createElement('span') + var image = document.createElement('img') span.className = 'device-small-image' image.className = 'device-small-image-img pointer' span.appendChild(image) @@ -488,9 +497,9 @@ function DeviceModelCell(options) { } , update: function(td, device) { var span = td.firstChild - , image = span.firstChild - , t = span.nextSibling - , src = '/static/app/devices/icon/x24/' + + var image = span.firstChild + var t = span.nextSibling + var src = '/static/app/devices/icon/x24/' + (device.image || '_default.jpg') // Only change if necessary so that we don't trigger a download @@ -517,14 +526,14 @@ function DeviceNameCell(options) { , defaultOrder: 'asc' , build: function() { var td = document.createElement('td') - , a = document.createElement('a') + var a = document.createElement('a') a.appendChild(document.createTextNode('')) td.appendChild(a) return td } , update: function(td, device) { var a = td.firstChild - , t = a.firstChild + var t = a.firstChild if (device.using) { a.className = 'device-product-name-using' @@ -569,14 +578,14 @@ function DeviceStatusCell(options) { , defaultOrder: 'asc' , build: function() { var td = document.createElement('td') - , a = document.createElement('a') + var a = document.createElement('a') a.appendChild(document.createTextNode('')) td.appendChild(a) return td } , update: function(td, device) { var a = td.firstChild - , t = a.firstChild + var t = a.firstChild a.className = 'btn btn-xs device-status ' + (stateClasses[device.state] || 'btn-default-outline') @@ -618,10 +627,10 @@ function DeviceNoteCell(options) { return _.defaults(options, { title: options.title , defaultOrder: 'asc' - , build: function () { + , build: function() { var td = document.createElement('td') - , span = document.createElement('span') - , i = document.createElement('i') + var span = document.createElement('span') + var i = document.createElement('i') td.className = 'device-note' span.className = 'xeditable-wrapper' @@ -636,7 +645,7 @@ function DeviceNoteCell(options) { } , update: function(td, item) { var span = td.firstChild - , t = span.firstChild + var t = span.firstChild t.nodeValue = options.value(item) return td diff --git a/res/app/device-list/details/device-list-details-directive.js b/res/app/device-list/details/device-list-details-directive.js index 420afa0d..4a6c8c34 100644 --- a/res/app/device-list/details/device-list-details-directive.js +++ b/res/app/device-list/details/device-list-details-directive.js @@ -20,33 +20,33 @@ module.exports = function DeviceListDetailsDirective( , sort: '=sort' , filter: '&filter' } - , link: function (scope, element) { + , link: function(scope, element) { var tracker = scope.tracker() - , activeColumns = [] - , activeSorting = [] - , activeFilters = [] - , table = element.find('table')[0] - , tbody = table.createTBody() - , rows = tbody.rows - , prefix = 'd' + Math.floor(Math.random() * 1000000) + '-' - , mapping = Object.create(null) - , childScopes = Object.create(null) + var activeColumns = [] + var activeSorting = [] + var activeFilters = [] + var table = element.find('table')[0] + var tbody = table.createTBody() + var rows = tbody.rows + var prefix = 'd' + Math.floor(Math.random() * 1000000) + '-' + var mapping = Object.create(null) + var childScopes = Object.create(null) function kickDevice(device, force) { - return GroupService.kick(device, force).catch(function (e) { - console.log(e) + return GroupService.kick(device, force).catch(function(e) { alert($filter('translate')(gettext('Device cannot get kicked from the group'))) + throw new Error(e) }) } function inviteDevice(device) { - return GroupService.invite(device).then(function () { + return GroupService.invite(device).then(function() { scope.$digest() }) } - function checkDeviceStatus (e) { + function checkDeviceStatus(e) { if (e.target.classList.contains('device-status')) { var id = e.target.parentNode.parentNode.id var device = mapping[id] @@ -94,11 +94,11 @@ module.exports = function DeviceListDetailsDirective( if (e.target.classList.contains('device-note-edit')) { var i = e.target - , id = i.parentNode.parentNode.id - , device = mapping[id] - , xeditableWrapper = i.parentNode.firstChild - , xeditableSpan = document.createElement('span') - , childScope = scope.$new() + var id = i.parentNode.parentNode.id + var device = mapping[id] + var xeditableWrapper = i.parentNode.firstChild + var xeditableSpan = document.createElement('span') + var childScope = scope.$new() // Ref: http://vitalets.github.io/angular-xeditable/#text-btn xeditableSpan.setAttribute('editable-text', 'device.notes') @@ -123,11 +123,11 @@ module.exports = function DeviceListDetailsDirective( var col = tr.cells[i] if (col.firstChild && - col.firstChild.nodeName.toLowerCase() == 'span' && + col.firstChild.nodeName.toLowerCase() === 'span' && col.firstChild.classList.contains('xeditable-wrapper')) { var xeditableWrapper = col.firstChild - , children = xeditableWrapper.children + var children = xeditableWrapper.children // Remove all childs under xeditablerWrapper for (var j = 0; j < children.length; j++) { @@ -147,7 +147,7 @@ module.exports = function DeviceListDetailsDirective( destroyXeditableNote(id) } - element.on('click', function (e) { + element.on('click', function(e) { checkDeviceStatus(e) checkDeviceSmallImage(e) checkDeviceNote(e) @@ -275,7 +275,7 @@ module.exports = function DeviceListDetailsDirective( function match(device) { for (var i = 0, l = activeFilters.length; i < l; ++i) { var filter = activeFilters[i] - , column + var column if (filter.field) { column = scope.columnDefinitions[filter.field] if (column && !column.filter(device, filter)) { @@ -347,8 +347,8 @@ module.exports = function DeviceListDetailsDirective( // the first time we see the device. function createRow(device) { var id = calculateId(device) - , tr = document.createElement('tr') - , td + var tr = document.createElement('tr') + var td tr.id = id @@ -430,8 +430,10 @@ module.exports = function DeviceListDetailsDirective( // according to current sorting. The value of `hi` is the index // of the last item in the segment, or -1 if none. The value of `lo` // is the index of the first item in the segment, or 0 if none. - function insertRowToSegment(tr, deviceA, lo, hi) { + function insertRowToSegment(tr, deviceA, low, high) { var total = rows.length + var lo = low + var hi = high if (lo > hi) { // This means that `lo` refers to the first item of the next @@ -441,8 +443,8 @@ module.exports = function DeviceListDetailsDirective( } else { var after = true - , pivot = 0 - , deviceB + var pivot = 0 + var deviceB while (lo <= hi) { pivot = ~~((lo + hi) / 2) @@ -480,8 +482,8 @@ module.exports = function DeviceListDetailsDirective( // row, or 0 if the position is already correct. function compareRow(tr, device) { var prev = tr.previousSibling - , next = tr.nextSibling - , diff + var next = tr.nextSibling + var diff if (prev) { diff = compare(device, mapping[prev.id]) @@ -525,7 +527,7 @@ module.exports = function DeviceListDetailsDirective( // Triggers when the tracker notices that a device changed. function changeListener(device) { var id = calculateId(device) - , tr = tbody.children[id] + var tr = tbody.children[id] if (tr) { // First, update columns @@ -548,7 +550,7 @@ module.exports = function DeviceListDetailsDirective( // Triggers when a device is removed entirely from the tracker. function removeListener(device) { var id = calculateId(device) - , tr = tbody.children[id] + var tr = tbody.children[id] if (tr) { tbody.removeChild(tr) diff --git a/res/app/device-list/device-list-controller.js b/res/app/device-list/device-list-controller.js index 9f84dd05..d1fb19dc 100644 --- a/res/app/device-list/device-list-controller.js +++ b/res/app/device-list/device-list-controller.js @@ -154,7 +154,7 @@ module.exports = function DeviceListCtrl( , source: 'deviceListActiveTabs' }) - $scope.toggle = function (device) { + $scope.toggle = function(device) { if (device.using) { $scope.kick(device) } else { @@ -162,8 +162,8 @@ module.exports = function DeviceListCtrl( } } - $scope.invite = function (device) { - return GroupService.invite(device).then(function () { + $scope.invite = function(device) { + return GroupService.invite(device).then(function() { $scope.$digest() }) } @@ -177,13 +177,13 @@ module.exports = function DeviceListCtrl( focusElement: false } - $scope.focusSearch = function () { + $scope.focusSearch = function() { if (!$scope.basicMode) { $scope.search.focusElement = true } } - $scope.reset = function () { + $scope.reset = function() { $scope.search.deviceFilter = '' $scope.filter = [] $scope.sort = defaultSort diff --git a/res/app/device-list/empty/device-list-empty-directive.js b/res/app/device-list/empty/device-list-empty-directive.js index dcf224aa..3cd40dd9 100644 --- a/res/app/device-list/empty/device-list-empty-directive.js +++ b/res/app/device-list/empty/device-list-empty-directive.js @@ -5,14 +5,14 @@ module.exports = function DeviceListEmptyDirective() { , scope: { tracker: '&tracker' } - , link: function (scope) { + , link: function(scope) { var tracker = scope.tracker() scope.empty = !tracker.devices.length function update() { var oldEmpty = scope.empty - , newEmpty = !tracker.devices.length + var newEmpty = !tracker.devices.length if (oldEmpty !== newEmpty) { scope.$apply(function() { diff --git a/res/app/device-list/icons/device-list-icons-directive.js b/res/app/device-list/icons/device-list-icons-directive.js index d148fe9d..1e3d50eb 100644 --- a/res/app/device-list/icons/device-list-icons-directive.js +++ b/res/app/device-list/icons/device-list-icons-directive.js @@ -39,12 +39,12 @@ module.exports = function DeviceListIconsDirective( } , update: function(li, device) { var a = li.firstChild - , img = a.firstChild.firstChild - , name = a.firstChild.nextSibling - , nt = name.firstChild - , button = name.nextSibling - , at = button.firstChild - , classes = 'btn btn-xs device-status ' + var img = a.firstChild.firstChild + var name = a.firstChild.nextSibling + var nt = name.firstChild + var button = name.nextSibling + var at = button.firstChild + var classes = 'btn btn-xs device-status ' // .device-photo-small if (img.getAttribute('src') !== device.enhancedImage120) { @@ -105,32 +105,32 @@ module.exports = function DeviceListIconsDirective( , sort: '=sort' , filter: '&filter' } - , link: function (scope, element) { + , link: function(scope, element) { var tracker = scope.tracker() - , activeColumns = [] - , activeSorting = [] - , activeFilters = [] - , list = element.find('ul')[0] - , items = list.childNodes - , prefix = 'd' + Math.floor(Math.random() * 1000000) + '-' - , mapping = Object.create(null) - , builder = DeviceItem() + var activeColumns = [] + var activeSorting = [] + var activeFilters = [] + var list = element.find('ul')[0] + var items = list.childNodes + var prefix = 'd' + Math.floor(Math.random() * 1000000) + '-' + var mapping = Object.create(null) + var builder = DeviceItem() function kickDevice(device, force) { - return GroupService.kick(device, force).catch(function (e) { - console.log(e) + return GroupService.kick(device, force).catch(function(e) { alert($filter('translate')(gettext('Device cannot get kicked from the group'))) + throw new Error(e) }) } function inviteDevice(device) { - return GroupService.invite(device).then(function () { + return GroupService.invite(device).then(function() { scope.$digest() }) } - element.on('click', function (e) { + element.on('click', function(e) { var id @@ -286,7 +286,7 @@ module.exports = function DeviceListIconsDirective( function match(device) { for (var i = 0, l = activeFilters.length; i < l; ++i) { var filter = activeFilters[i] - , column + var column if (filter.field) { column = scope.columnDefinitions[filter.field] if (column && !column.filter(device, filter)) { @@ -358,7 +358,7 @@ module.exports = function DeviceListIconsDirective( // the first time we see the device. function createItem(device) { var id = calculateId(device) - , item = builder.build() + var item = builder.build() item.id = id builder.update(item, device) @@ -403,8 +403,10 @@ module.exports = function DeviceListIconsDirective( // according to current sorting. The value of `hi` is the index // of the last item in the segment, or -1 if none. The value of `lo` // is the index of the first item in the segment, or 0 if none. - function insertItemToSegment(item, deviceA, lo, hi) { + function insertItemToSegment(item, deviceA, low, high) { var total = items.length + var lo = low + var hi = high if (lo > hi) { // This means that `lo` refers to the first item of the next @@ -414,8 +416,8 @@ module.exports = function DeviceListIconsDirective( } else { var after = true - , pivot = 0 - , deviceB + var pivot = 0 + var deviceB while (lo <= hi) { pivot = ~~((lo + hi) / 2) @@ -453,8 +455,8 @@ module.exports = function DeviceListIconsDirective( // item, or 0 if the position is already correct. function compareItem(item, device) { var prev = item.previousSibling - , next = item.nextSibling - , diff + var next = item.nextSibling + var diff if (prev) { diff = compare(device, mapping[prev.id]) @@ -498,7 +500,7 @@ module.exports = function DeviceListIconsDirective( // Triggers when the tracker notices that a device changed. function changeListener(device) { var id = calculateId(device) - , item = list.children[id] + var item = list.children[id] if (item) { // First, update columns @@ -519,7 +521,7 @@ module.exports = function DeviceListIconsDirective( // Triggers when a device is removed entirely from the tracker. function removeListener(device) { var id = calculateId(device) - , item = list.children[id] + var item = list.children[id] if (item) { list.removeChild(item) diff --git a/res/app/device-list/index.js b/res/app/device-list/index.js index 6cdd52e8..6aa53155 100644 --- a/res/app/device-list/index.js +++ b/res/app/device-list/index.js @@ -15,7 +15,7 @@ module.exports = angular.module('device-list', [ require('./customize').name, require('./search').name ]) - .config(['$routeProvider', function ($routeProvider) { + .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/devices', { template: require('./device-list.jade'), diff --git a/res/app/device-list/stats/device-list-stats-directive.js b/res/app/device-list/stats/device-list-stats-directive.js index 5b822a68..94ac6c63 100644 --- a/res/app/device-list/stats/device-list-stats-directive.js +++ b/res/app/device-list/stats/device-list-stats-directive.js @@ -7,10 +7,10 @@ module.exports = function DeviceListStatsDirective( , scope: { tracker: '&tracker' } - , link: function (scope, element) { + , link: function(scope, element) { var tracker = scope.tracker() - , mapping = Object.create(null) - , nodes = Object.create(null) + var mapping = Object.create(null) + var nodes = Object.create(null) scope.counter = { total: 0 @@ -56,8 +56,8 @@ module.exports = function DeviceListStatsDirective( function changeListener(device) { var oldStats = mapping[device.serial] - , newStats = updateStats(device) - , diffs = Object.create(null) + var newStats = updateStats(device) + var diffs = Object.create(null) scope.counter.usable += diffs.usable = newStats.usable - oldStats.usable scope.counter.busy += diffs.busy = newStats.busy - oldStats.busy @@ -70,7 +70,7 @@ module.exports = function DeviceListStatsDirective( function removeListener(device) { var oldStats = mapping[device.serial] - , newStats = updateStats(device) + var newStats = updateStats(device) scope.counter.total -= 1 scope.counter.busy += newStats.busy - oldStats.busy diff --git a/res/app/device-list/util/patch-array/index.js b/res/app/device-list/util/patch-array/index.js index d72e81ff..3f5d2c78 100644 --- a/res/app/device-list/util/patch-array/index.js +++ b/res/app/device-list/util/patch-array/index.js @@ -12,14 +12,11 @@ module.exports = function patchArray(a, b) { var ops = [] var workA = [].concat(a) - , inA = Object.create(null) - , itemA - , cursorA + var inA = Object.create(null) + var itemA, cursorA, itemB, cursorB var inB = existenceMap(b) - , posB = Object.create(null) - , itemB - , cursorB + var posB = Object.create(null) // First, check what was removed from a. for (cursorA = 0; cursorA < workA.length;) { diff --git a/res/app/device-list/util/patch-array/patch-array-test.js b/res/app/device-list/util/patch-array/patch-array-test.js index c1287678..dad0a135 100644 --- a/res/app/device-list/util/patch-array/patch-array-test.js +++ b/res/app/device-list/util/patch-array/patch-array-test.js @@ -1,3 +1,5 @@ +/* eslint no-console: 0 */ + var assert = require('assert') var patchArray = require('./patch-array') diff --git a/res/app/docs/docs-controller.js b/res/app/docs/docs-controller.js index babedf6c..fd33df1e 100644 --- a/res/app/docs/docs-controller.js +++ b/res/app/docs/docs-controller.js @@ -7,17 +7,18 @@ module.exports = $scope.hasHistory = hasHistory() - $scope.goBack = function () { + $scope.goBack = function() { $window.history.back() } - $scope.goHome = function () { + $scope.goHome = function() { $location.path('/docs/Help') } - $rootScope.$on("$routeChangeError", - function (event, current, previous, rejection) { - console.log("ROUTE CHANGE ERROR: " + rejection) + /* eslint no-console:0 */ + $rootScope.$on('$routeChangeError', + function(event, current, previous, rejection) { + console.error('ROUTE CHANGE ERROR: ' + rejection) console.log('event', event) console.log('current', current) console.log('previous', previous) diff --git a/res/app/docs/index.js b/res/app/docs/index.js index bd3066e5..8df212fb 100644 --- a/res/app/docs/index.js +++ b/res/app/docs/index.js @@ -3,7 +3,7 @@ require('./docs.css') module.exports = angular.module('stf.help.docs', [ require('stf/language').name ]) - .config(function ($routeProvider, languageProvider) { + .config(function($routeProvider, languageProvider) { // TODO: Solutions to the lang problem // // 1) Use $route inside a controller instead of $routeProvider @@ -16,7 +16,7 @@ module.exports = angular.module('stf.help.docs', [ $routeProvider .when('/docs/:document*', { - templateUrl: function (params) { + templateUrl: function(params) { var lang = languageProvider.$get().selectedLanguage lang = 'en' // Only English for now var document = params.document.replace('.md', '') @@ -24,10 +24,10 @@ module.exports = angular.module('stf.help.docs', [ } }) .when('/help', { - templateUrl: function () { + templateUrl: function() { var lang = languageProvider.$get().selectedLanguage lang = 'en' // Only English for now - return '/static/wiki/[' + lang + ']-' + 'Help' + return '/static/wiki/[' + lang + ']-Help' } }) //.when('/docs/:lang/:document*', { diff --git a/res/app/layout/index.js b/res/app/layout/index.js index 69facf99..4ec7fe7b 100644 --- a/res/app/layout/index.js +++ b/res/app/layout/index.js @@ -14,7 +14,7 @@ module.exports = angular.module('layout', [ require('stf/common-ui/modals/socket-disconnected').name, require('stf/browser-info').name ]) - .config(['$uibTooltipProvider', function ($uibTooltipProvider) { + .config(['$uibTooltipProvider', function($uibTooltipProvider) { $uibTooltipProvider.options({ appendToBody: true, animation: false diff --git a/res/app/menu/index.js b/res/app/menu/index.js index bfe85e93..f7667b49 100644 --- a/res/app/menu/index.js +++ b/res/app/menu/index.js @@ -7,6 +7,6 @@ module.exports = angular.module('stf.menu', [ require('stf/native-url').name ]) .controller('MenuCtrl', require('./menu-controller')) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put('menu.jade', require('./menu.jade')) }]) diff --git a/res/app/menu/menu-controller.js b/res/app/menu/menu-controller.js index 3b35dcd4..b053b9f8 100644 --- a/res/app/menu/menu-controller.js +++ b/res/app/menu/menu-controller.js @@ -10,7 +10,7 @@ module.exports = function MenuCtrl($scope, $rootScope, SettingsService, defaultValue: 'native' }) - $scope.$on('$routeChangeSuccess', function () { + $scope.$on('$routeChangeSuccess', function() { $scope.isControlRoute = $location.path().search('/control') !== -1 }) diff --git a/res/app/menu/menu-spec.js b/res/app/menu/menu-spec.js index 70224293..b95d71b9 100644 --- a/res/app/menu/menu-spec.js +++ b/res/app/menu/menu-spec.js @@ -1,17 +1,17 @@ -describe('MenuCtrl', function () { +describe('MenuCtrl', function() { - beforeEach(angular.mock.module(require('./').name)); + beforeEach(angular.mock.module(require('./').name)) - var scope, ctrl; + var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - ctrl = $controller('MenuCtrl', {$scope: scope}); - })); + beforeEach(inject(function($rootScope, $controller) { + scope = $rootScope.$new() + ctrl = $controller('MenuCtrl', {$scope: scope}) + })) - it('should ...', inject(function () { - expect(1).toEqual(1); + it('should ...', inject(function() { + expect(1).toEqual(1) - })); + })) -}); +}) diff --git a/res/app/settings/general/general-spec.js b/res/app/settings/general/general-spec.js index 9bda6dad..7235cbad 100644 --- a/res/app/settings/general/general-spec.js +++ b/res/app/settings/general/general-spec.js @@ -1,15 +1,15 @@ -describe('GeneralCtrl', function () { +describe('GeneralCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('GeneralCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/settings/general/index.js b/res/app/settings/general/index.js index f49f90af..5f27cf2d 100644 --- a/res/app/settings/general/index.js +++ b/res/app/settings/general/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.settings.general', [ require('./language').name, require('./local').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/general/general.jade' , require('./general.jade') diff --git a/res/app/settings/general/language/index.js b/res/app/settings/general/language/index.js index 7e83d400..eb3d9f6d 100644 --- a/res/app/settings/general/language/index.js +++ b/res/app/settings/general/language/index.js @@ -2,7 +2,7 @@ module.exports = angular.module('stf-ui-language', [ require('stf/settings').name, require('stf/language').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/general/language/language.jade', require('./language.jade') ) diff --git a/res/app/settings/general/language/language-controller.js b/res/app/settings/general/language/language-controller.js index df497b63..742937b8 100644 --- a/res/app/settings/general/language/language-controller.js +++ b/res/app/settings/general/language/language-controller.js @@ -1,4 +1,4 @@ -module.exports = function ($scope, LanguageService, SettingsService) { +module.exports = function($scope, LanguageService, SettingsService) { SettingsService.bind($scope, { target: 'language' , source: LanguageService.settingKey diff --git a/res/app/settings/general/local/index.js b/res/app/settings/general/local/index.js index bdef6d8c..c6b1b784 100644 --- a/res/app/settings/general/local/index.js +++ b/res/app/settings/general/local/index.js @@ -5,7 +5,7 @@ module.exports = angular.module('ui-local-settings', [ require('stf/common-ui/modals/common').name, 'ui.bootstrap' ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/general/local/local-settings.jade' , require('./local-settings.jade') diff --git a/res/app/settings/general/local/local-settings-controller.js b/res/app/settings/general/local/local-settings-controller.js index 9ea3a129..f42e3d9a 100644 --- a/res/app/settings/general/local/local-settings-controller.js +++ b/res/app/settings/general/local/local-settings-controller.js @@ -1,7 +1,7 @@ -module.exports = function ($scope, SettingsService) { - $scope.resetSettings = function () { +module.exports = function($scope, SettingsService) { + $scope.resetSettings = function() { SettingsService.reset() - console.log('Settings cleared') + alert('Settings cleared') } } diff --git a/res/app/settings/index.js b/res/app/settings/index.js index 4f85b8c2..a0f48275 100644 --- a/res/app/settings/index.js +++ b/res/app/settings/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('ui-settings', [ require('stf/common-ui/nice-tabs').name //require('./notifications').name ]) - .config(['$routeProvider', function ($routeProvider) { + .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/settings', { template: require('./settings.jade') }) diff --git a/res/app/settings/keys/access-tokens/access-tokens-controller.js b/res/app/settings/keys/access-tokens/access-tokens-controller.js index db48cff3..81095bcd 100644 --- a/res/app/settings/keys/access-tokens/access-tokens-controller.js +++ b/res/app/settings/keys/access-tokens/access-tokens-controller.js @@ -10,7 +10,7 @@ module.exports = function AccessTokensCtrl($scope, AccessTokenService) { }) } - $scope.removeToken = function (title) { + $scope.removeToken = function(title) { AccessTokenService.removeAccessToken(title) } diff --git a/res/app/settings/keys/access-tokens/access-tokens-spec.js b/res/app/settings/keys/access-tokens/access-tokens-spec.js index 8d542dcb..cd2a0808 100644 --- a/res/app/settings/keys/access-tokens/access-tokens-spec.js +++ b/res/app/settings/keys/access-tokens/access-tokens-spec.js @@ -1,15 +1,15 @@ -describe('AccessTokensCtrl', function () { +describe('AccessTokensCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('AccessTokensCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/settings/keys/access-tokens/index.js b/res/app/settings/keys/access-tokens/index.js index f2bbc059..4b82a46a 100644 --- a/res/app/settings/keys/access-tokens/index.js +++ b/res/app/settings/keys/access-tokens/index.js @@ -5,7 +5,7 @@ module.exports = angular.module('stf.settings.keys.access-tokens', [ require('stf/tokens').name, require('stf/tokens/generate-access-token').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/keys/access-tokens/access-tokens.jade', require('./access-tokens.jade') ) diff --git a/res/app/settings/keys/adb-keys/adb-keys-controller.js b/res/app/settings/keys/adb-keys/adb-keys-controller.js index 2f0dc637..77e3f514 100644 --- a/res/app/settings/keys/adb-keys/adb-keys-controller.js +++ b/res/app/settings/keys/adb-keys/adb-keys-controller.js @@ -6,7 +6,7 @@ module.exports = $scope.adbKeys = UserService.getAdbKeys() } - $scope.removeKey = function (key) { + $scope.removeKey = function(key) { UserService.removeAdbKey(key) } diff --git a/res/app/settings/keys/adb-keys/adb-keys-service.js b/res/app/settings/keys/adb-keys/adb-keys-service.js index 03526a4f..bfc48cba 100644 --- a/res/app/settings/keys/adb-keys/adb-keys-service.js +++ b/res/app/settings/keys/adb-keys/adb-keys-service.js @@ -1,7 +1,7 @@ module.exports = function AdbKeysServiceFactory() { var service = {} - service.hostNameFromKey = function (key) { + service.hostNameFromKey = function(key) { if (key.match(/.+= (.+)/)) { return key.replace(/.+= (.+)/g, '$1') } diff --git a/res/app/settings/keys/adb-keys/adb-keys-spec.js b/res/app/settings/keys/adb-keys/adb-keys-spec.js index c37ce1e1..720057b6 100644 --- a/res/app/settings/keys/adb-keys/adb-keys-spec.js +++ b/res/app/settings/keys/adb-keys/adb-keys-spec.js @@ -1,15 +1,15 @@ -describe('AdbKeysCtrl', function () { +describe('AdbKeysCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('AdbKeysCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/settings/keys/adb-keys/index.js b/res/app/settings/keys/adb-keys/index.js index 2688d1fe..1b904be1 100644 --- a/res/app/settings/keys/adb-keys/index.js +++ b/res/app/settings/keys/adb-keys/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.settings.keys.adb-keys', [ require('stf/common-ui').name, require('stf/keys/add-adb-key').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/keys/adb-keys/adb-keys.jade', require('./adb-keys.jade') ) diff --git a/res/app/settings/keys/index.js b/res/app/settings/keys/index.js index f9e263dd..066293c0 100644 --- a/res/app/settings/keys/index.js +++ b/res/app/settings/keys/index.js @@ -4,7 +4,7 @@ module.exports = angular.module('stf.settings.keys', [ require('./adb-keys').name, require('./access-tokens').name ]) - .run(["$templateCache", function ($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/keys/keys.jade', require('./keys.jade') ) diff --git a/res/app/settings/keys/keys-spec.js b/res/app/settings/keys/keys-spec.js index 1509e65e..e9f0239b 100644 --- a/res/app/settings/keys/keys-spec.js +++ b/res/app/settings/keys/keys-spec.js @@ -1,15 +1,15 @@ -describe('KeysCtrl', function () { +describe('KeysCtrl', function() { beforeEach(angular.mock.module(require('./index').name)) var scope, ctrl - beforeEach(inject(function ($rootScope, $controller) { + beforeEach(inject(function($rootScope, $controller) { scope = $rootScope.$new() ctrl = $controller('KeysCtrl', {$scope: scope}) })) - it('should ...', inject(function () { + it('should ...', inject(function() { expect(1).toEqual(1) })) diff --git a/res/app/settings/notifications/index.js b/res/app/settings/notifications/index.js index 0e820678..a28d4ce6 100644 --- a/res/app/settings/notifications/index.js +++ b/res/app/settings/notifications/index.js @@ -1,7 +1,7 @@ module.exports = angular.module('settings-notifications', [ require('stf/settings').name ]) - .run(["$templateCache", function($templateCache) { + .run(['$templateCache', function($templateCache) { $templateCache.put( 'settings/notifications/notifications.jade' , require('./notifications.jade') diff --git a/res/app/settings/notifications/notifications-service.js b/res/app/settings/notifications/notifications-service.js index 0ebfdf27..460c5609 100644 --- a/res/app/settings/notifications/notifications-service.js +++ b/res/app/settings/notifications/notifications-service.js @@ -3,4 +3,4 @@ module.exports = function NotificationsServiceFactory() { return NotificationsService -} \ No newline at end of file +} diff --git a/res/app/user/index.js b/res/app/user/index.js index e6ccbb0e..d8413e3f 100644 --- a/res/app/user/index.js +++ b/res/app/user/index.js @@ -1,5 +1,5 @@ module.exports = angular.module('stf.user-profile', []) - .config(function ($routeProvider) { + .config(function($routeProvider) { $routeProvider .when('/user/:user*', { diff --git a/res/auth/ldap/scripts/entry.js b/res/auth/ldap/scripts/entry.js index a48ca51c..15ad6b78 100644 --- a/res/auth/ldap/scripts/entry.js +++ b/res/auth/ldap/scripts/entry.js @@ -1,4 +1,4 @@ -require.ensure([], function (require) { +require.ensure([], function(require) { require('nine-bootstrap') require('angular') @@ -11,7 +11,7 @@ require.ensure([], function (require) { require('gettext').name, require('./signin').name ]) - .config(function ($routeProvider, $locationProvider) { + .config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true) $routeProvider .otherwise({ diff --git a/res/auth/ldap/scripts/signin/index.js b/res/auth/ldap/scripts/signin/index.js index 83ca07a4..3f142bc9 100644 --- a/res/auth/ldap/scripts/signin/index.js +++ b/res/auth/ldap/scripts/signin/index.js @@ -1,7 +1,7 @@ require('./signin.css') module.exports = angular.module('stf.signin', []) - .config(function ($routeProvider) { + .config(function($routeProvider) { $routeProvider .when('/auth/ldap/', { template: require('./signin.jade') diff --git a/res/auth/ldap/scripts/signin/signin-controller.js b/res/auth/ldap/scripts/signin/signin-controller.js index e9d08c87..25aee8d4 100644 --- a/res/auth/ldap/scripts/signin/signin-controller.js +++ b/res/auth/ldap/scripts/signin/signin-controller.js @@ -2,18 +2,18 @@ module.exports = function SignInCtrl($scope, $http) { $scope.error = null - $scope.submit = function () { + $scope.submit = function() { var data = { username: $scope.signin.username.$modelValue , password: $scope.signin.password.$modelValue } $scope.invalid = false $http.post('/auth/api/v1/ldap', data) - .success(function (response) { + .success(function(response) { $scope.error = null location.replace(response.redirect) }) - .error(function (response) { + .error(function(response) { switch (response.error) { case 'ValidationError': $scope.error = { diff --git a/res/auth/mock/scripts/entry.js b/res/auth/mock/scripts/entry.js index 6eb76670..a007f1b0 100644 --- a/res/auth/mock/scripts/entry.js +++ b/res/auth/mock/scripts/entry.js @@ -1,4 +1,4 @@ -require.ensure([], function (require) { +require.ensure([], function(require) { require('nine-bootstrap') require('angular') @@ -11,7 +11,7 @@ require.ensure([], function (require) { require('gettext').name, require('./signin').name ]) - .config(function ($routeProvider, $locationProvider) { + .config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true) $routeProvider .otherwise({ diff --git a/res/auth/mock/scripts/signin/index.js b/res/auth/mock/scripts/signin/index.js index ad708aea..929fc3b6 100644 --- a/res/auth/mock/scripts/signin/index.js +++ b/res/auth/mock/scripts/signin/index.js @@ -1,7 +1,7 @@ require('./signin.css') module.exports = angular.module('stf.signin', []) - .config(function ($routeProvider) { + .config(function($routeProvider) { $routeProvider .when('/auth/mock/', { template: require('./signin.jade') diff --git a/res/auth/mock/scripts/signin/signin-controller.js b/res/auth/mock/scripts/signin/signin-controller.js index 44f657ed..70ce9011 100644 --- a/res/auth/mock/scripts/signin/signin-controller.js +++ b/res/auth/mock/scripts/signin/signin-controller.js @@ -2,18 +2,18 @@ module.exports = function SignInCtrl($scope, $http) { $scope.error = null - $scope.submit = function () { + $scope.submit = function() { var data = { name: $scope.signin.username.$modelValue , email: $scope.signin.email.$modelValue } $scope.invalid = false $http.post('/auth/api/v1/mock', data) - .success(function (response) { + .success(function(response) { $scope.error = null location.replace(response.redirect) }) - .error(function (response) { + .error(function(response) { switch (response.error) { case 'ValidationError': $scope.error = { diff --git a/res/common/lang/index.js b/res/common/lang/index.js index b32695c3..a2534214 100644 --- a/res/common/lang/index.js +++ b/res/common/lang/index.js @@ -1,6 +1,6 @@ -angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) { +angular.module('gettext').run(['gettextCatalog', function(gettextCatalog) { // Load all supported languages - angular.forEach(require('./langs'), function (value, key) { + angular.forEach(require('./langs'), function(value, key) { if (key !== 'en') { gettextCatalog.setStrings(key, require('./translations/stf.' + key + '.json')[key]) @@ -10,4 +10,4 @@ angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) { module.exports = angular.module('stf/lang', [ 'gettext' -]) \ No newline at end of file +]) diff --git a/res/test/e2e/control/control-spec.js b/res/test/e2e/control/control-spec.js index 26e32884..460cbede 100644 --- a/res/test/e2e/control/control-spec.js +++ b/res/test/e2e/control/control-spec.js @@ -1,57 +1,57 @@ -describe('Control Page', function () { +describe('Control Page', function() { var DeviceListPage = require('../devices') var deviceListPage = new DeviceListPage() - var ControlPage = function () { - this.get = function () { + var ControlPage = function() { + this.get = function() { browser.get(protractor.getInstance().baseUrl + 'control') } this.kickDeviceButton = element.all(by.css('.kick-device')).first() - this.kickDevice = function () { + this.kickDevice = function() { this.openDevicesDropDown() this.kickDeviceButton.click() } this.devicesDropDown = element(by.css('.device-name-text')) - this.openDevicesDropDown = function () { + this.openDevicesDropDown = function() { this.devicesDropDown.click() } } var controlPage = new ControlPage() - it('should control an usable device', function () { + it('should control an usable device', function() { deviceListPage.controlAvailableDevice() waitUrl(/control/) browser.sleep(500) - browser.getLocationAbsUrl().then(function (newUrl) { + browser.getLocationAbsUrl().then(function(newUrl) { expect(newUrl).toMatch(protractor.getInstance().baseUrl + 'control') }) }) - it('should have a kick button', function () { + it('should have a kick button', function() { expect(controlPage.kickDeviceButton.isPresent()).toBeTruthy() }) - describe('Remote Control', function () { + describe('Remote Control', function() { //var RemoteCtrl = function () { // this.paneHandleHorizontal = element(by.css('.fa-pane-handle.horizontal')) //} - it('should resize panel to the right', function () { + it('should resize panel to the right', function() { }) - it('should rotate device', function () { + it('should rotate device', function() { }) }) - describe('Dashboard Tab', function () { + describe('Dashboard Tab', function() { - describe('Shell', function () { - var ShellCtrl = function () { + describe('Shell', function() { + var ShellCtrl = function() { this.commandInput = element(by.model('command')) this.results = element.all(by.css('.shell-results')).first() @@ -60,13 +60,13 @@ describe('Control Page', function () { this.clearCommand = 'clear' this.openMenuCommand = 'input keyevent 3' - this.execute = function (command) { + this.execute = function(command) { this.commandInput.sendKeys(command, protractor.Key.ENTER) } } var shell = new ShellCtrl() - it('should echo "hello adb" to the adb shell', function () { + it('should echo "hello adb" to the adb shell', function() { expect(shell.commandInput.isPresent()).toBe(true) shell.execute(shell.echoCommand) @@ -74,29 +74,29 @@ describe('Control Page', function () { expect(shell.results.getText()).toBe(shell.helloString) }) - it('should clear adb shell input', function () { + it('should clear adb shell input', function() { shell.execute(shell.clearCommand) expect(shell.results.getText()).toBeFalsy() }) - it('should open and close the menu button trough adb shell', function () { + it('should open and close the menu button trough adb shell', function() { shell.execute(shell.openMenuCommand) shell.execute(shell.openMenuCommand) }) }) - describe('Navigation', function () { - var NavigationCtrl = function () { + describe('Navigation', function() { + var NavigationCtrl = function() { this.urlInput = element(by.model('textURL')) - this.goToUrl = function (url) { + this.goToUrl = function(url) { this.urlInput.sendKeys(url, protractor.Key.ENTER) } this.resetButton = element(by.css('[ng-click="clearSettings()"]')) } var navigation = new NavigationCtrl() - it('should go to an URL', function () { + it('should go to an URL', function() { var url = 'google.com' navigation.goToUrl(url) expect(navigation.urlInput.getAttribute('value')).toBe(url) @@ -104,40 +104,40 @@ describe('Control Page', function () { browser.sleep(500) }) - it('should clear the URL input', function () { + it('should clear the URL input', function() { navigation.urlInput.clear() expect(navigation.urlInput.getAttribute('value')).toBeFalsy() }) - it('should reset browser settings', function () { + it('should reset browser settings', function() { navigation.resetButton.click() }) }) }) - describe('Screenshots Tab', function () { + describe('Screenshots Tab', function() { }) - describe('Automation Tab', function () { + describe('Automation Tab', function() { }) - describe('Advanced Tab', function () { + describe('Advanced Tab', function() { }) - describe('Logs Tab', function () { + describe('Logs Tab', function() { }) - it('should stop controlling an usable device', function () { + it('should stop controlling an usable device', function() { controlPage.kickDevice() waitUrl(/devices/) - browser.getLocationAbsUrl().then(function (newUrl) { + browser.getLocationAbsUrl().then(function(newUrl) { expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices') }) }) diff --git a/res/test/e2e/devices/devices-spec.js b/res/test/e2e/devices/devices-spec.js index 41bf2a40..30ce7966 100644 --- a/res/test/e2e/devices/devices-spec.js +++ b/res/test/e2e/devices/devices-spec.js @@ -1,36 +1,36 @@ -describe('Device Page', function () { - describe('Icon View', function () { +describe('Device Page', function() { + describe('Icon View', function() { var DeviceListPage = require('./') var deviceListPage = new DeviceListPage() - it('should go to Devices List page', function () { + it('should go to Devices List page', function() { deviceListPage.get() - browser.getLocationAbsUrl().then(function (newUrl) { + browser.getLocationAbsUrl().then(function(newUrl) { expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices') }) }) - it('should have more than 1 device in the list', function () { + it('should have more than 1 device in the list', function() { expect(deviceListPage.numberOfDevices()).toBeGreaterThan(0) }) - it('should filter available devices', function () { + it('should filter available devices', function() { deviceListPage.filterAvailableDevices() expect(deviceListPage.searchInput.getAttribute('value')).toBe('state: "available"') }) - it('should have more than 1 device available', function () { + it('should have more than 1 device available', function() { expect(deviceListPage.devicesUsable.count()).toBeGreaterThan(0) }) - it('should have one device usable', function () { + it('should have one device usable', function() { expect(deviceListPage.availableDevice().getAttribute('class')).toMatch('state-available') }) }) - describe('List View', function () { + describe('List View', function() { }) }) diff --git a/res/test/e2e/devices/index.js b/res/test/e2e/devices/index.js index 3ed274d7..92529a95 100644 --- a/res/test/e2e/devices/index.js +++ b/res/test/e2e/devices/index.js @@ -1,5 +1,5 @@ module.exports = function DeviceListPage() { - this.get = function () { + this.get = function() { // TODO: Let's get rid off the login first browser.get(protractor.getInstance().baseUrl + 'devices') } @@ -7,16 +7,16 @@ module.exports = function DeviceListPage() { this.devicesByCss = element.all(by.css('ul.devices-icon-view > li')) this.devicesUsable = element.all(by.css('.state-available')) this.searchInput = element(by.model('search.deviceFilter')) - this.filterAvailableDevices = function () { + this.filterAvailableDevices = function() { return this.searchInput.sendKeys('state: "available"') } - this.numberOfDevices = function () { + this.numberOfDevices = function() { return this.devicesByCss.count() } - this.availableDevice = function () { + this.availableDevice = function() { return this.devicesUsable.first() } - this.controlAvailableDevice = function () { + this.controlAvailableDevice = function() { return this.availableDevice().click() } } diff --git a/res/test/e2e/help/help-spec.js b/res/test/e2e/help/help-spec.js index ff9bdab2..8366a994 100644 --- a/res/test/e2e/help/help-spec.js +++ b/res/test/e2e/help/help-spec.js @@ -1,4 +1,4 @@ -describe('Help Page', function () { +describe('Help Page', function() { //var HelpPage = function () { // this.get = function () { // browser.get(protractor.getInstance().baseUrl + 'help') diff --git a/res/test/e2e/helpers/browser-logs.js b/res/test/e2e/helpers/browser-logs.js index c8f9f5e6..989e8b60 100644 --- a/res/test/e2e/helpers/browser-logs.js +++ b/res/test/e2e/helpers/browser-logs.js @@ -1,10 +1,11 @@ var chalk = require('chalk') +/* eslint no-console:0 */ // http://stackoverflow.com/questions/7157999/output-jasmine-test-results-to-the-console // https://github.com/pivotal/jasmine/blob/master/src/console/ConsoleReporter.js -module.exports = function BrowserLogs(options) { - options = options || {} +module.exports = function BrowserLogs(opts) { + var options = opts || {} if (typeof options.expectNoLogs === 'undefined') { options.expectNoLogs = false @@ -13,17 +14,17 @@ module.exports = function BrowserLogs(options) { options.outputLogs = true } - browser.getCapabilities().then(function (cap) { + browser.getCapabilities().then(function(cap) { var browserName = ' ' + cap.caps_.browserName + ' log ' var browserStyled = chalk.bgBlue.white.bold(browserName) + ' ' - browser.manage().logs().get('browser').then(function (browserLogs) { + browser.manage().logs().get('browser').then(function(browserLogs) { if (options.expectNoLogs) { expect(browserLogs.length).toEqual(0) } if (options.outputLogs && browserLogs.length) { - browserLogs.forEach(function (log) { + browserLogs.forEach(function(log) { if (log.level.value > 900) { console.error(browserStyled + chalk.white.bold(log.message)) } else { diff --git a/res/test/e2e/helpers/fail-fast.js b/res/test/e2e/helpers/fail-fast.js index 342a14c7..acfb6fd0 100644 --- a/res/test/e2e/helpers/fail-fast.js +++ b/res/test/e2e/helpers/fail-fast.js @@ -3,7 +3,7 @@ module.exports = function FailFast() { var passed = jasmine.getEnv().currentSpec.results().passed() if (!passed) { - jasmine.getEnv().specFilter = function () { + jasmine.getEnv().specFilter = function() { return false } } diff --git a/res/test/e2e/helpers/gulp-protractor-adv.js b/res/test/e2e/helpers/gulp-protractor-adv.js index e4b4ad7d..bcaabd81 100644 --- a/res/test/e2e/helpers/gulp-protractor-adv.js +++ b/res/test/e2e/helpers/gulp-protractor-adv.js @@ -7,13 +7,13 @@ - Added feature to detect if selenium is running or not */ -var es = require('event-stream') +var es = require('event-that') var path = require('path') var childProcess = require('child_process') var PluginError = require('gulp-util').PluginError -var winExt = /^win/.test(process.platform) ? ".cmd" : "" +var winExt = /^win/.test(process.platform) ? '.cmd' : '' var http = require('http') -var Promise = require("bluebird") +var Promise = require('bluebird') // optimization: cache for protractor binaries directory var protractorDir = null @@ -22,32 +22,31 @@ function getProtractorDir() { if (protractorDir) { return protractorDir } - var result = require.resolve("protractor") + var result = require.resolve('protractor') if (result) { // result is now something like // c:\\Source\\gulp-protractor\\node_modules\\protractor\\lib\\protractor.js protractorDir = - path.resolve(path.join(path.dirname(result), "..", "..", ".bin")) + path.resolve(path.join(path.dirname(result), '..', '..', '.bin')) return protractorDir } - throw new Error("No protractor installation found.") + throw new Error('No protractor installation found.') } -var protractor = function (options) { - var files = [], - child, args - - options = options || {} - args = options.args || [] +var protractor = function(opts) { + var files = [] + var options = opts || {} + var args = options.args || [] + var child if (!options.configFile) { this.emit('error', new PluginError('gulp-protractor', 'Please specify the protractor config file')) } - return es.through(function (file) { + return es.through(function(file) { files.push(file.path) - }, function () { - var stream = this + }, function() { + var that = this // Enable debug mode if (options.debug) { @@ -74,31 +73,31 @@ var protractor = function (options) { winExt), args, { stdio: 'inherit', env: process.env - }).on('exit', function (code) { + }).on('exit', function(code) { if (child) { child.kill() } - if (stream) { + if (that) { if (code) { - stream.emit('error', new PluginError('gulp-protractor', + that.emit('error', new PluginError('gulp-protractor', 'protractor exited with code ' + code)) } else { - stream.emit('end') + that.emit('end') } } }) }) } -var webdriverUpdate = function (opts, cb) { - var callback = (cb ? cb : opts) +var webdriverUpdate = function(opts, cb) { + var callback = cb || opts var options = (cb ? opts : null) - var args = ["update", "--standalone"] + var args = ['update', '--standalone'] if (options) { if (options.browsers) { - options.browsers.forEach(function (element) { - args.push("--" + element) + options.browsers.forEach(function(element) { + args.push('--' + element) }) } } @@ -108,14 +107,14 @@ var webdriverUpdate = function (opts, cb) { }).once('close', callback) } -var webdriverUpdateSpecific = function (opts) { +var webdriverUpdateSpecific = function(opts) { return webdriverUpdate.bind(this, opts) } -webdriverUpdate.bind(null, ["ie", "chrome"]) +webdriverUpdate.bind(null, ['ie', 'chrome']) -var webdriverStandalone = function (opts, cb) { - var callback = (cb ? cb : opts) +var webdriverStandalone = function(opts, cb) { + var callback = cb || opts var options = (cb ? opts : null) var stdio = 'inherit' @@ -130,7 +129,7 @@ var webdriverStandalone = function (opts, cb) { stdio: stdio }) .once('close', callback) - .on('exit', function (code) { + .on('exit', function(code) { if (child) { child.kill() } @@ -142,33 +141,33 @@ function getProtractorExplorerDir() { if (protractorExplorerDir) { return protractorExplorerDir } - var result = require.resolve("protractor") + var result = require.resolve('protractor') if (result) { // result is now something like // c:\\Source\\gulp-protractor\\node_modules\\protractor\\lib\\protractor.js protractorExplorerDir = - path.resolve(path.join(path.dirname(result), "..", "bin")) + path.resolve(path.join(path.dirname(result), '..', 'bin')) return protractorExplorerDir } - throw new Error("No protractor installation found.") + throw new Error('No protractor installation found.') } -var isWebDriverRunning = function () { - return new Promise(function (resolve) { +var isWebDriverRunning = function() { + return new Promise(function(resolve) { var options = { hostname: 'localhost', port: 4444, path: '/wd/hub/status' } - var req = http.request(options, function (res) { + var req = http.request(options, function(res) { if (res.statusCode !== 200) { throw new Error('Selenium is running but status code is' + res.statusCode) } resolve(true) }) - req.on('error', function () { + req.on('error', function() { resolve(false) }) req.write('data\n') @@ -188,8 +187,8 @@ var isWebDriverRunning = function () { //} -var protractorExplorer = function (opts, cb) { - var callback = (cb ? cb : opts) +var protractorExplorer = function(opts, cb) { + var callback = cb || opts var options = (cb ? opts : null) var url = 'https://angularjs.org/' @@ -211,7 +210,7 @@ var protractorExplorer = function (opts, cb) { '/elementexplorer.js'), [url], { stdio: 'inherit' }) - .on('exit', function () { + .on('exit', function() { if (child) { child.kill() } @@ -220,16 +219,16 @@ var protractorExplorer = function (opts, cb) { } function runWebDriver() { - isWebDriverRunning().then(function (running) { + isWebDriverRunning().then(function(running) { if (running) { runElementExplorer(callback) } else { webdriverStandalone({stdio: ['pipe', 'pipe', process.stderr]}, - function () { + function() { }) - setTimeout(function () { + setTimeout(function() { runElementExplorer(callback) }, 2000) } diff --git a/res/test/e2e/login/index.js b/res/test/e2e/login/index.js index 63016534..cb6389cb 100644 --- a/res/test/e2e/login/index.js +++ b/res/test/e2e/login/index.js @@ -1,7 +1,7 @@ module.exports = function LoginPage() { this.login = protractor.getInstance().params.login - this.get = function () { + this.get = function() { return browser.get(this.login.url) } @@ -14,19 +14,19 @@ module.exports = function LoginPage() { } - this.setName = function (username) { + this.setName = function(username) { return this.username.sendKeys(username) } - this.setEmail = function (email) { + this.setEmail = function(email) { return this.email.sendKeys(email) } - this.setPassword = function (password) { + this.setPassword = function(password) { return this.password.sendKeys(password) } - this.submit = function () { + this.submit = function() { return this.username.submit() } - this.doLogin = function () { + this.doLogin = function() { this.get() this.setName(this.login.username) if (this.login.method === 'ldap') { @@ -37,13 +37,13 @@ module.exports = function LoginPage() { this.submit() - return browser.driver.wait(function () { - return browser.driver.getCurrentUrl().then(function (url) { + return browser.driver.wait(function() { + return browser.driver.getCurrentUrl().then(function(url) { return /devices/.test(url) }) }) } - this.cleanUp = function () { + this.cleanUp = function() { this.username = null this.password = null this.email = null diff --git a/res/test/e2e/login/login-spec.js b/res/test/e2e/login/login-spec.js index 778022e7..1a89644c 100644 --- a/res/test/e2e/login/login-spec.js +++ b/res/test/e2e/login/login-spec.js @@ -1,14 +1,14 @@ -describe('Login Page', function () { +describe('Login Page', function() { var LoginPage = require('./') var loginPage = new LoginPage() - it('should have an url to login', function () { + it('should have an url to login', function() { expect(loginPage.login.url).toMatch('http') }) - it('should login with method: "' + loginPage.login.method + '"', function () { - loginPage.doLogin().then(function () { - browser.getLocationAbsUrl().then(function (newUrl) { + it('should login with method: "' + loginPage.login.method + '"', function() { + loginPage.doLogin().then(function() { + browser.getLocationAbsUrl().then(function(newUrl) { expect(newUrl).toBe(protractor.getInstance().baseUrl + 'devices') }) }) diff --git a/res/test/e2e/settings/settings-spec.js b/res/test/e2e/settings/settings-spec.js index eb510292..973fe2bf 100644 --- a/res/test/e2e/settings/settings-spec.js +++ b/res/test/e2e/settings/settings-spec.js @@ -1,4 +1,4 @@ -describe('Settings Page', function () { +describe('Settings Page', function() { //var SettingsPage = function () { // this.get = function () { // browser.get(protractor.getInstance().baseUrl + 'settings') diff --git a/res/test/karma.conf.js b/res/test/karma.conf.js index d93bf12a..43d09588 100644 --- a/res/test/karma.conf.js +++ b/res/test/karma.conf.js @@ -2,12 +2,12 @@ var webpackConfig = require('./../../webpack.config') var webpack = require('webpack') -module.exports = function (config) { +module.exports = function(config) { config.set({ frameworks: ['jasmine'], files: [ 'helpers/**/*.js', - '../app/**/*-spec.js', + '../app/**/*-spec.js' // '../app/components/stf/common-ui/clear-button/*-spec.js' ], diff --git a/res/test/protractor.conf.js b/res/test/protractor.conf.js index e12a153e..9c2610cb 100644 --- a/res/test/protractor.conf.js +++ b/res/test/protractor.conf.js @@ -38,7 +38,7 @@ module.exports.config = { } }, chromeOnly: true, - onPrepare: function () { + onPrepare: function() { var loginPage = new LoginPage() loginPage.doLogin() loginPage.cleanUp() @@ -49,12 +49,12 @@ module.exports.config = { baseDirectory: './res/test/test_out/screenshots' })) - afterEach(function () { + afterEach(function() { BrowserLogs({expectNoLogs: true}) //FailFast() }) }, - onComplete: function () { + onComplete: function() { } }