1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Fix all res/ files with ESLint rules with 0 errors.

This commit is contained in:
Gunther Brunner 2016-01-19 23:08:33 +09:00
parent 1006564ae7
commit a3f815c118
258 changed files with 1634 additions and 1634 deletions

View file

@ -8,7 +8,7 @@
"no-cond-assign": 2, // TODO: conflicts with no-extra-parens for while use case "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-extra-parens": 0, // For now going with 0 since 1 does more harm than good
"no-unexpected-multiline": 2, "no-unexpected-multiline": 2,
"valid-jsdoc": 2, "valid-jsdoc": 1,
"valid-typeof": 2, "valid-typeof": 2,
// Best practices // Best practices
@ -90,7 +90,7 @@
"comma-spacing": [2, {"before": false, "after": true}], "comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [1, "first"], // optionally set `[2, "first", {"exceptions": {"ArrayExpression": true, "ObjectExpression": true}}]` "comma-style": [1, "first"], // optionally set `[2, "first", {"exceptions": {"ArrayExpression": true, "ObjectExpression": true}}]`
"computed-property-spacing": [2, "never"], "computed-property-spacing": [2, "never"],
"consistent-this": [2, "self"], "consistent-this": [2, "that"],
"eol-last": 2, "eol-last": 2,
"func-names": 0, "func-names": 0,
"func-style": 0, // optionally set `[2, "expression"]` "func-style": 0, // optionally set `[2, "expression"]`
@ -128,7 +128,7 @@
"operator-assignment": [2, "always"], // optionally set `[2, "always"]` "operator-assignment": [2, "always"], // optionally set `[2, "always"]`
"operator-linebreak": [2, "after"], // optionally set `[2, "before", {"overrides": {"?": "after"}}]` // TODO: check for conditionals "operator-linebreak": [2, "after"], // optionally set `[2, "before", {"overrides": {"?": "after"}}]` // TODO: check for conditionals
"padded-blocks": [2, "never"], "padded-blocks": [2, "never"],
"quote-props": [2, "consistent-as-needed"], "quote-props": [2, "as-needed", { "numbers": true }],
"quotes": [2, "single", "avoid-escape"], "quotes": [2, "single", "avoid-escape"],
"require-jsdoc": 0, "require-jsdoc": 0,
"semi-spacing": [2, {"before": false, "after": true}], "semi-spacing": [2, {"before": false, "after": true}],

View file

@ -1,9 +1,29 @@
// TODO: Some day use eslint-plugin-angular
// https://github.com/Gillespie59/eslint-plugin-angular
{ {
"env": { "env": {
"commonjs": true, "commonjs": true,
"mocha": true, "browser": true,
"browser": true "node": false,
"jasmine": true,
"protractor": true
}, },
"rules": { "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
} }
} }

View file

@ -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
}
}

View file

@ -1,5 +1,4 @@
require.ensure([], function (require) { require.ensure([], function(require) {
require('angular') require('angular')
require('angular-route') require('angular-route')
require('angular-touch') require('angular-touch')
@ -19,7 +18,7 @@ require.ensure([], function (require) {
require('./../common/lang').name, require('./../common/lang').name,
require('stf/standalone').name require('stf/standalone').name
]) ])
.config(function ($routeProvider, $locationProvider) { .config(function($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('!') $locationProvider.hashPrefix('!')
$routeProvider $routeProvider
.otherwise({ .otherwise({
@ -27,7 +26,7 @@ require.ensure([], function (require) {
}) })
}) })
.config(function (hotkeysProvider) { .config(function(hotkeysProvider) {
hotkeysProvider.templateTitle = 'Keyboard Shortcuts:' hotkeysProvider.templateTitle = 'Keyboard Shortcuts:'
}) })
}) })

View file

@ -1,7 +1,7 @@
module.exports = function adminModeDirective($rootScope, SettingsService) { module.exports = function adminModeDirective($rootScope, SettingsService) {
return { return {
restrict: 'AE', restrict: 'AE',
link: function () { link: function() {
SettingsService.bind($rootScope, { SettingsService.bind($rootScope, {
target: 'adminMode', target: 'adminMode',
defaultValue: false defaultValue: false

View file

@ -1,5 +1,3 @@
describe('AdminModeService', function() { describe('AdminModeService', function() {
beforeEach(angular.mock.module(require('./').name))
beforeEach(angular.mock.module(require('./').name));
}) })

View file

@ -2,7 +2,7 @@ module.exports =
function angularDraggabillyDirective(DraggabillyService, $parse) { function angularDraggabillyDirective(DraggabillyService, $parse) {
return { return {
restrict: 'AE', restrict: 'AE',
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var parsedAttrs = $parse(attrs.angularDraggabilly)() var parsedAttrs = $parse(attrs.angularDraggabilly)()
if (typeof parsedAttrs !== 'object') { if (typeof parsedAttrs !== 'object') {
parsedAttrs = {} parsedAttrs = {}
@ -11,7 +11,7 @@ module.exports =
var options = angular.extend({ var options = angular.extend({
}, parsedAttrs) }, parsedAttrs)
/* jshint unused: false */ /* eslint no-unused-vars: 0 */
var draggie = new DraggabillyService(element[0], options) var draggie = new DraggabillyService(element[0], options)
} }
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () {
it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, To test your directive, you need to create some html that would use your directive,
send that through compile() then compare the results. send that through compile() then compare the results.
var element = compile('<div angular-draggabilly name="name">hi</div>')(scope); var element = compile('<div angular-draggabilly name="name">hi</div>')(scope)
expect(element.text()).toBe('hello, world'); expect(element.text()).toBe('hello, world')
*/ */
})
}); })
});

View file

@ -3,7 +3,7 @@ var draggabilly = require('draggabilly')
module.exports = angular.module('stf.angular-draggabilly', [ module.exports = angular.module('stf.angular-draggabilly', [
]) ])
.factory('DraggabillyService', function () { .factory('DraggabillyService', function() {
return draggabilly return draggabilly
}) })
.directive('angularDraggabilly', require('./angular-draggabilly-directive')) .directive('angularDraggabilly', require('./angular-draggabilly-directive'))

View file

@ -5,7 +5,7 @@ module.exports = function angularPackeryDirective(PackeryService,
return { return {
restrict: 'AE', restrict: 'AE',
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var container = element[0] var container = element[0]
var parsedAttrs = $parse(attrs.angularPackery)() var parsedAttrs = $parse(attrs.angularPackery)()
if (typeof parsedAttrs !== 'object') { if (typeof parsedAttrs !== 'object') {
@ -24,10 +24,10 @@ module.exports = function angularPackeryDirective(PackeryService,
pckry.bindResize() pckry.bindResize()
bindDraggable() bindDraggable()
$timeout(function () { $timeout(function() {
pckry.layout() pckry.layout()
}, 0) }, 0)
$timeout(function () { $timeout(function() {
pckry.layout() pckry.layout()
}, 100) }, 100)
@ -56,7 +56,7 @@ module.exports = function angularPackeryDirective(PackeryService,
scope.$on('panelsResized', _.throttle(onPanelsResized, 300)) scope.$on('panelsResized', _.throttle(onPanelsResized, 300))
scope.$on('$destroy', function () { scope.$on('$destroy', function() {
pckry.unbindResize() pckry.unbindResize()
pckry.off('layoutComplete', onLayoutComplete) pckry.off('layoutComplete', onLayoutComplete)
pckry.destroy() pckry.destroy()

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -8,7 +8,7 @@ var packery = require('packery/js/packery.js')
module.exports = angular.module('stf.angular-packery', [ module.exports = angular.module('stf.angular-packery', [
require('stf/angular-draggabilly').name require('stf/angular-draggabilly').name
]) ])
.factory('PackeryService', function () { .factory('PackeryService', function() {
return packery return packery
}) })
.directive('angularPackery', require('./angular-packery-directive')) .directive('angularPackery', require('./angular-packery-directive'))

View file

@ -8,16 +8,16 @@ module.exports = function AppStateProvider() {
} }
} }
/*globals GLOBAL_APPSTATE:false*/ /* global GLOBAL_APPSTATE:false */
if (typeof GLOBAL_APPSTATE !== 'undefined') { if (typeof GLOBAL_APPSTATE !== 'undefined') {
values = angular.extend(values, GLOBAL_APPSTATE) values = angular.extend(values, GLOBAL_APPSTATE)
} }
return { return {
set: function (constants) { set: function(constants) {
angular.extend(values, constants) angular.extend(values, constants)
}, },
$get: function () { $get: function() {
return values return values
} }
} }

View file

@ -1,7 +1,7 @@
module.exports = function basicModeDirective($rootScope, BrowserInfo) { module.exports = function basicModeDirective($rootScope, BrowserInfo) {
return { return {
restrict: 'AE', restrict: 'AE',
link: function (scope, element) { link: function(scope, element) {
$rootScope.basicMode = !!BrowserInfo.mobile $rootScope.basicMode = !!BrowserInfo.mobile
if ($rootScope.basicMode) { if ($rootScope.basicMode) {
element.addClass('basic-mode') element.addClass('basic-mode')

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -10,12 +10,12 @@ module.exports = function BrowserInfoServiceFactory() {
service[key] = (typeof test == 'function') ? test() : test service[key] = (typeof test == 'function') ? test() : test
} }
addTest('touch', function () { addTest('touch', function() {
return ('ontouchstart' in window) || window.DocumentTouch && return ('ontouchstart' in window) || window.DocumentTouch &&
document instanceof window.DocumentTouch document instanceof window.DocumentTouch
}) })
addTest('retina', function () { addTest('retina', function() {
var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), ' + var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), ' +
'(min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), ' + '(min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), ' +
'(min-resolution: 1.5dppx)' '(min-resolution: 1.5dppx)'
@ -25,28 +25,30 @@ module.exports = function BrowserInfoServiceFactory() {
return !!(window.matchMedia && window.matchMedia(mediaQuery).matches) return !!(window.matchMedia && window.matchMedia(mediaQuery).matches)
}) })
addTest('small', function () { addTest('small', function() {
var windowWidth = window.screen.width < window.outerWidth ? var windowWidth = window.screen.width < window.outerWidth ?
window.screen.width : window.outerWidth window.screen.width : window.outerWidth
return windowWidth < 800 return windowWidth < 800
}) })
addTest('mobile', function () { addTest('mobile', function() {
return !!(service.small && service.touch) return !!(service.small && service.touch)
}) })
addTest('os', function () { addTest('os', function() {
var ua = navigator.userAgent var ua = navigator.userAgent
if (ua.match(/Android/i)) { if (ua.match(/Android/i)) {
return 'android' return 'android'
} else if (ua.match(/iPhone|iPad|iPod/i)) { }
else if (ua.match(/iPhone|iPad|iPod/i)) {
return 'ios' return 'ios'
} else { }
else {
return 'pc' return 'pc'
} }
}) })
addTest('webgl', function () { addTest('webgl', function() {
var canvas = createElement('canvas') var canvas = createElement('canvas')
if ('supportsContext' in canvas) { if ('supportsContext' in canvas) {
return canvas.supportsContext('webgl') || return canvas.supportsContext('webgl') ||

View file

@ -4,7 +4,7 @@ describe('BrowserInfo', function() {
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(BrowserInfo.doSomething()).toEqual('something'); // expect(BrowserInfo.doSomething()).toEqual('something')
})) }))

View file

@ -5,7 +5,7 @@ module.exports = function badgeIconDirective() {
scope: { scope: {
}, },
template: require('./badge-icon.jade'), template: require('./badge-icon.jade'),
link: function () { link: function() {
} }
} }
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,18 +1,18 @@
module.exports = function blurElementDirective($parse, $timeout) { module.exports = function blurElementDirective($parse, $timeout) {
return { return {
restrict: 'A', restrict: 'A',
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var model = $parse(attrs.blurElement) var model = $parse(attrs.blurElement)
scope.$watch(model, function (value) { scope.$watch(model, function(value) {
if (value === true) { if (value === true) {
$timeout(function () { $timeout(function() {
element[0].blur() element[0].blur()
}) })
} }
}) })
element.bind('blur', function () { element.bind('blur', function() {
scope.$apply(model.assign(scope, false)) scope.$apply(model.assign(scope, false))
}) })
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,20 +1,20 @@
describe('clearButton', function () { describe('clearButton', function() {
beforeEach(angular.mock.module(require('./').name)) beforeEach(angular.mock.module(require('./').name))
var scope, compile var scope, compile
beforeEach(inject(function ($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new() scope = $rootScope.$new()
compile = $compile compile = $compile
})) }))
it('should display a text label', function () { it('should display a text label', function() {
var element = compile('<clear-button />')(scope) var element = compile('<clear-button />')(scope)
expect(element.find('span').text()).toBe('Clear') expect(element.find('span').text()).toBe('Clear')
}) })
it('should display a trash icon', function () { it('should display a trash icon', function() {
var element = compile('<clear-button />')(scope) var element = compile('<clear-button />')(scope)
expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o') expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o')
}) })

View file

@ -2,15 +2,15 @@ module.exports = function counterDirective($timeout) {
return { return {
replace: false, replace: false,
scope: true, scope: true,
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var el = element[0] var el = element[0]
var num, refreshInterval, duration, steps, step, countTo, increment var num, refreshInterval, duration, steps, step, countTo, increment
var calculate = function () { var calculate = function() {
refreshInterval = 32 refreshInterval = 32
step = 0 step = 0
scope.timoutId = null scope.timoutId = null
countTo = parseInt(attrs.countTo) || 0 countTo = parseInt(attrs.countTo, 10) || 0
scope.value = parseInt(attrs.countFrom, 10) || 0 scope.value = parseInt(attrs.countFrom, 10) || 0
duration = parseFloat(attrs.duration) || 0 duration = parseFloat(attrs.duration) || 0
@ -20,15 +20,16 @@ module.exports = function counterDirective($timeout) {
num = scope.value num = scope.value
} }
var tick = function () { var tick = function() {
scope.timoutId = $timeout(function () { scope.timoutId = $timeout(function() {
num += increment num += increment
step++ step++
if (step >= steps) { if (step >= steps) {
$timeout.cancel(scope.timoutId) $timeout.cancel(scope.timoutId)
num = countTo num = countTo
el.innerText = countTo el.innerText = countTo
} else { }
else {
el.innerText = Math.round(num) el.innerText = Math.round(num)
tick() tick()
} }
@ -36,7 +37,7 @@ module.exports = function counterDirective($timeout) {
} }
var start = function () { var start = function() {
if (scope.timoutId) { if (scope.timoutId) {
$timeout.cancel(scope.timoutId) $timeout.cancel(scope.timoutId)
} }
@ -44,13 +45,13 @@ module.exports = function counterDirective($timeout) {
tick() tick()
} }
attrs.$observe('countTo', function (val) { attrs.$observe('countTo', function(val) {
if (val) { if (val) {
start() start()
} }
}) })
attrs.$observe('countFrom', function (/*val*/) { attrs.$observe('countFrom', function() {
start() start()
}) })

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -15,7 +15,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) {
tElement.attr('method', 'post') tElement.attr('method', 'post')
} else { } else {
if (!tAttrs.method.match(/post/i)) { 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 { return {
pre: function (scope, element, attrs) { pre: function(scope, element, attrs) {
// Angular needs this so the form action doesn't get removed // Angular needs this so the form action doesn't get removed
// Also, trying to set a url at this time doesn't work neither // Also, trying to set a url at this time doesn't work neither
attrs.action = '' attrs.action = ''

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -6,8 +6,8 @@ module.exports = function errorMessageDirective() {
message: '@' message: '@'
}, },
template: require('./error-message.jade'), template: require('./error-message.jade'),
link: function (scope) { link: function(scope) {
scope.closeMessage = function () { scope.closeMessage = function() {
scope.message = '' scope.message = ''
} }
} }

View file

@ -1,15 +1,15 @@
describe('errorMessage', function () { describe('errorMessage', function() {
beforeEach(angular.mock.module(require('./index').name)) beforeEach(angular.mock.module(require('./index').name))
var scope, compile var scope, compile
beforeEach(inject(function ($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new() scope = $rootScope.$new()
compile = $compile compile = $compile
})) }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, To test your directive, you need to create some html that would use your directive,

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,18 +1,18 @@
module.exports = function focusElementDirective($parse, $timeout) { module.exports = function focusElementDirective($parse, $timeout) {
return { return {
restrict: 'A', restrict: 'A',
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var model = $parse(attrs.focusElement) var model = $parse(attrs.focusElement)
scope.$watch(model, function (value) { scope.$watch(model, function(value) {
if (value === true) { if (value === true) {
$timeout(function () { $timeout(function() {
element[0].focus() element[0].focus()
}) })
} }
}) })
element.bind('blur', function () { element.bind('blur', function() {
if (model && model.assign) { if (model && model.assign) {
scope.$apply(model.assign(scope, false)) scope.$apply(model.assign(scope, false))
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,7 +1,7 @@
module.exports = function iconInsideInputDirective() { module.exports = function iconInsideInputDirective() {
return { return {
restrict: 'A', 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 // NOTE: this doesn't work on Chrome with auto-fill, known Chrome bug
element.css({ element.css({
'background-repeat': 'no-repeat', 'background-repeat': 'no-repeat',
@ -11,7 +11,7 @@ module.exports = function iconInsideInputDirective() {
attrs.$observe('iconInsideInput', function(value) { attrs.$observe('iconInsideInput', function(value) {
element.css({ element.css({
'background-image': 'url(' + value +')' 'background-image': 'url(' + value + ')'
}) })
}) })
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,12 +1,12 @@
module.exports = function ($http, $templateCache, $compile) { module.exports = function($http, $templateCache, $compile) {
var cache = {} var cache = {}
return function (src, scope, cloneAttachFn) { return function(src, scope, cloneAttachFn) {
var compileFn = cache[src] var compileFn = cache[src]
if (compileFn) { if (compileFn) {
compileFn(scope, cloneAttachFn) compileFn(scope, cloneAttachFn)
} else { } else {
$http.get(src, { cache: $templateCache }).success(function (response) { $http.get(src, {cache: $templateCache}).success(function(response) {
var responseContents = angular.element('<div></div>').html(response).contents() var responseContents = angular.element('<div></div>').html(response).contents()
compileFn = cache[src] = $compile(responseContents) compileFn = cache[src] = $compile(responseContents)
compileFn(scope, cloneAttachFn) compileFn(scope, cloneAttachFn)

View file

@ -2,13 +2,13 @@ module.exports = function includeCachedDirective(CompileCacheService) {
return { return {
restrict: 'ECA', restrict: 'ECA',
terminal: true, terminal: true,
compile: function (element, attrs) { compile: function(element, attrs) {
var srcExp = attrs.ngIncludeCached || attrs.src var srcExp = attrs.ngIncludeCached || attrs.src
return function (scope, element) { return function(scope, element) {
var src = scope.$eval(srcExp) var src = scope.$eval(srcExp)
var newScope = scope.$new() var newScope = scope.$new()
CompileCacheService(src, newScope, function (compiledElm) { CompileCacheService(src, newScope, function(compiledElm) {
element.append(compiledElm) element.append(compiledElm)
}) })
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -2,33 +2,33 @@ module.exports =
function AddAdbKeyModalServiceFactory($uibModal) { function AddAdbKeyModalServiceFactory($uibModal) {
var service = {} var service = {}
var ModalInstanceCtrl = function ($scope, $uibModalInstance, data) { var ModalInstanceCtrl = function($scope, $uibModalInstance, data) {
$scope.modal = {} $scope.modal = {}
$scope.modal.showAdd = true $scope.modal.showAdd = true
$scope.modal.fingerprint = data.fingerprint $scope.modal.fingerprint = data.fingerprint
$scope.modal.title = data.title $scope.modal.title = data.title
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
} }
$scope.$watch('modal.showAdd', function (newValue) { $scope.$watch('modal.showAdd', function(newValue) {
if (newValue === false) { if (newValue === false) {
$scope.ok() $scope.ok()
} }
}) })
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
} }
service.open = function (data) { service.open = function(data) {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./add-adb-key-modal.jade'), template: require('./add-adb-key-modal.jade'),
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
resolve: { resolve: {
data: function () { data: function() {
return data return data
} }
} }

View file

@ -1,11 +1,11 @@
describe('FatalMessageService', function() { describe('FatalMessageService', function() {
beforeEach(angular.mock.module(require('./').name)); beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(FatalMessageService.doSomething()).toEqual('something'); //expect(FatalMessageService.doSomething()).toEqual('something');
})); }))
}) })

View file

@ -1,8 +1,8 @@
module.exports = function ServiceFactory($uibModal, $sce) { module.exports = function ServiceFactory($uibModal, $sce) {
var service = {} var service = {}
var ModalInstanceCtrl = function ($scope, $uibModalInstance, url, title, icon) { var ModalInstanceCtrl = function($scope, $uibModalInstance, url, title, icon) {
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
} }
@ -10,12 +10,12 @@ module.exports = function ServiceFactory($uibModal, $sce) {
$scope.title = title $scope.title = title
$scope.icon = icon $scope.icon = icon
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
} }
service.open = function (url, title, icon) { service.open = function(url, title, icon) {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./external-url-modal.jade'), template: require('./external-url-modal.jade'),
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
@ -24,17 +24,17 @@ module.exports = function ServiceFactory($uibModal, $sce) {
title: function() { title: function() {
return title return title
}, },
url: function () { url: function() {
return url return url
}, },
icon: function () { icon: function() {
return icon return icon
} }
} }
}) })
modalInstance.result.then(function () { modalInstance.result.then(function() {
}, function () { }, function() {
}) })
} }

View file

@ -1,11 +1,11 @@
describe('ExternalUrlModalService', function() { describe('ExternalUrlModalService', function() {
beforeEach(angular.mock.module(require('./').name)); beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(FatalMessageService.doSomething()).toEqual('something'); //expect(FatalMessageService.doSomething()).toEqual('something');
})); }))
}) })

View file

@ -1,8 +1,8 @@
// TODO: Test this // TODO: Test this
module.exports = function () { module.exports = function() {
return function (scope, element, attrs) { return function(scope, element, attrs) {
scope.$watch(attrs.pageVisible, function () { scope.$watch(attrs.pageVisible, function() {
element.bind('load', function () { element.bind('load', function() {
scope.$apply(attrs.pageLoad) scope.$apply(attrs.pageLoad)
}) })
}) })

View file

@ -5,9 +5,9 @@ module.exports =
var intervalDeviceInfo var intervalDeviceInfo
var ModalInstanceCtrl = function ($scope, $uibModalInstance, device, var ModalInstanceCtrl = function($scope, $uibModalInstance, device,
tryToReconnect) { tryToReconnect) {
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
$route.reload() $route.reload()
} }
@ -24,7 +24,7 @@ module.exports =
if (tryToReconnect) { if (tryToReconnect) {
// TODO: this is ugly, find why its not updated correctly (also on the device list) // TODO: this is ugly, find why its not updated correctly (also on the device list)
intervalDeviceInfo = $interval(function () { intervalDeviceInfo = $interval(function() {
update() update()
if (device.usable) { if (device.usable) {
@ -34,43 +34,43 @@ module.exports =
}, 1000, 500) }, 1000, 500)
} }
$scope.second = function () { $scope.second = function() {
$uibModalInstance.dismiss() $uibModalInstance.dismiss()
$location.path('/devices/') $location.path('/devices/')
} }
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
var destroyInterval = function () { var destroyInterval = function() {
if (angular.isDefined(intervalDeviceInfo)) { if (angular.isDefined(intervalDeviceInfo)) {
$interval.cancel(intervalDeviceInfo) $interval.cancel(intervalDeviceInfo)
intervalDeviceInfo = undefined intervalDeviceInfo = undefined
} }
} }
$scope.$on('$destroy', function () { $scope.$on('$destroy', function() {
destroyInterval() destroyInterval()
}) })
} }
FatalMessageService.open = function (device, tryToReconnect) { FatalMessageService.open = function(device, tryToReconnect) {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./fatal-message.jade'), template: require('./fatal-message.jade'),
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
resolve: { resolve: {
device: function () { device: function() {
return device return device
}, },
tryToReconnect: function () { tryToReconnect: function() {
return tryToReconnect return tryToReconnect
} }
} }
}) })
modalInstance.result.then(function () { modalInstance.result.then(function() {
}, function () { }, function() {
}) })
} }

View file

@ -1,11 +1,11 @@
describe('FatalMessageService', function() { describe('FatalMessageService', function() {
beforeEach(angular.mock.module(require('./').name)); beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(FatalMessageService.doSomething()).toEqual('something'); //expect(FatalMessageService.doSomething()).toEqual('something');
})); }))
}) })

View file

@ -1,20 +1,20 @@
module.exports = function ServiceFactory($uibModal) { module.exports = function ServiceFactory($uibModal) {
var service = {} var service = {}
var ModalInstanceCtrl = function ($scope, $uibModalInstance, title, imageUrl) { var ModalInstanceCtrl = function($scope, $uibModalInstance, title, imageUrl) {
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
} }
$scope.title = title $scope.title = title
$scope.imageUrl = imageUrl $scope.imageUrl = imageUrl
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
} }
service.open = function (title, imageUrl) { service.open = function(title, imageUrl) {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./lightbox-image.jade'), template: require('./lightbox-image.jade'),
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
@ -23,14 +23,14 @@ module.exports = function ServiceFactory($uibModal) {
title: function() { title: function() {
return title return title
}, },
imageUrl: function () { imageUrl: function() {
return imageUrl return imageUrl
} }
} }
}) })
modalInstance.result.then(function () { modalInstance.result.then(function() {
}, function () { }, function() {
}) })
} }

View file

@ -1,11 +1,11 @@
describe('LightboxImageService', function() { describe('LightboxImageService', function() {
beforeEach(angular.mock.module(require('./').name)); beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(XLightboxImageService.doSomething()).toEqual('something'); //expect(XLightboxImageService.doSomething()).toEqual('something');
})); }))
}) })

View file

@ -2,33 +2,33 @@ module.exports =
function SocketDisconnectedServiceFactory($uibModal, $location, $window) { function SocketDisconnectedServiceFactory($uibModal, $location, $window) {
var service = {} var service = {}
var ModalInstanceCtrl = function ($scope, $uibModalInstance, message) { var ModalInstanceCtrl = function($scope, $uibModalInstance, message) {
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
$window.location.reload() $window.location.reload()
} }
$scope.message = message $scope.message = message
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
} }
service.open = function (message) { service.open = function(message) {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./socket-disconnected.jade'), template: require('./socket-disconnected.jade'),
controller: ModalInstanceCtrl, controller: ModalInstanceCtrl,
resolve: { resolve: {
message: function () { message: function() {
return message return message
} }
} }
}) })
modalInstance.result.then(function () { modalInstance.result.then(function() {
}, function () { }, function() {
}) })
} }

View file

@ -1,25 +1,25 @@
module.exports = function ServiceFactory($uibModal, $location) { module.exports = function ServiceFactory($uibModal, $location) {
var service = {} var service = {}
var ModalInstanceCtrl = function ($scope, $uibModalInstance) { var ModalInstanceCtrl = function($scope, $uibModalInstance) {
$scope.ok = function () { $scope.ok = function() {
$uibModalInstance.close(true) $uibModalInstance.close(true)
$location.path('/') $location.path('/')
} }
$scope.cancel = function () { $scope.cancel = function() {
$uibModalInstance.dismiss('cancel') $uibModalInstance.dismiss('cancel')
} }
} }
service.open = function () { service.open = function() {
var modalInstance = $uibModal.open({ var modalInstance = $uibModal.open({
template: require('./version-update.jade'), template: require('./version-update.jade'),
controller: ModalInstanceCtrl controller: ModalInstanceCtrl
}) })
modalInstance.result.then(function (/*selectedItem*/) { modalInstance.result.then(function(/*selectedItem*/) {
}, function () { }, function() {
}) })
} }

View file

@ -1,12 +1,12 @@
describe('VersionUpdateService', function() { describe('VersionUpdateService', function() {
beforeEach(angular.mock.module(require('ui-bootstrap').name)); beforeEach(angular.mock.module(require('ui-bootstrap').name))
beforeEach(angular.mock.module(require('./').name)); beforeEach(angular.mock.module(require('./').name))
it('should ...', inject(function() { it('should ...', inject(function() {
//expect(VersionUpdateService.doSomething()).toEqual('something'); //expect(VersionUpdateService.doSomething()).toEqual('something');
})); }))
}) })

View file

@ -1,12 +1,12 @@
module.exports = function ngEnterDirective() { module.exports = function ngEnterDirective() {
return function (scope, element, attrs) { return function(scope, element, attrs) {
element.bind("keydown keypress", function (event) { element.bind('keydown keypress', function(event) {
if (event.which === 13) { if (event.which === 13) {
scope.$apply(function () { scope.$apply(function() {
scope.$eval(attrs.ngEnter, {'event': event}) scope.$eval(attrs.ngEnter, {event: event})
}) })
event.preventDefault() event.preventDefault()
} }
}) })
} }
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -6,7 +6,7 @@ module.exports = function niceTabDirective() {
scope: { scope: {
}, },
template: require('./nice-tab.jade'), template: require('./nice-tab.jade'),
link: function () { link: function() {
} }
} }
} }

View file

@ -3,25 +3,25 @@ module.exports = function niceTabsDirective() {
restrict: 'EA', restrict: 'EA',
replace: true, replace: true,
template: require('./nice-tabs.jade'), 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 'key' for saving in Settings
// TODO: add support for 'direction=below' for below tabs // 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.tabs = newValue
}) })
scope.$watch(attrs.filter, function (newValue) { scope.$watch(attrs.filter, function(newValue) {
scope.filter = newValue scope.filter = newValue
}) })
scope.tabFound = function (tab) { scope.tabFound = function(tab) {
if (!tab.filters) { if (!tab.filters) {
return true return true
} }
var found = false var found = false
angular.forEach(tab.filters, function (value) { angular.forEach(tab.filters, function(value) {
if (value === scope.filter) { if (value === scope.filter) {
found = true found = true
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,4 +1,4 @@
module.exports = function () { module.exports = function() {
return { return {
restrict: 'EA', restrict: 'EA',
transclude: true, transclude: true,
@ -7,7 +7,7 @@ module.exports = function () {
message: '@' message: '@'
}, },
template: require('./nothing-to-show.html'), template: require('./nothing-to-show.html'),
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
scope.icon = attrs.icon scope.icon = attrs.icon
scope.message = attrs.message scope.message = attrs.message
} }

View file

@ -5,8 +5,8 @@ module.exports = function refreshPageDirective($window) {
scope: { scope: {
}, },
template: require('./refresh-page.jade'), template: require('./refresh-page.jade'),
link: function (scope) { link: function(scope) {
scope.reloadWindow = function () { scope.reloadWindow = function() {
$window.location.reload() $window.location.reload()
} }
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,11 +1,11 @@
module.exports = angular.module('stf.safe-apply', []) module.exports = angular.module('stf.safe-apply', [])
.config([ .config([
'$provide', function ($provide) { '$provide', function($provide) {
return $provide.decorator('$rootScope', [ return $provide.decorator('$rootScope', [
'$delegate', function ($delegate) { '$delegate', function($delegate) {
$delegate.safeApply = function (fn) { $delegate.safeApply = function(fn) {
var phase = $delegate.$$phase var phase = $delegate.$$phase
if (phase === "$apply" || phase === "$digest") { if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') { if (fn && typeof fn === 'function') {
fn() fn()
} }

View file

@ -1,9 +1,9 @@
module.exports = function textFocusSelectDirective() { module.exports = function textFocusSelectDirective() {
return { return {
restrict: 'AC', restrict: 'AC',
link: function (scope, element) { link: function(scope, element) {
// TODO: try with focus event // TODO: try with focus event
element.bind('click', function () { element.bind('click', function() {
this.select() this.select()
}) })
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,7 +1,7 @@
module.exports = function tooltipsDirective() { module.exports = function tooltipsDirective() {
return { return {
restrict: 'A', restrict: 'A',
link: function () { link: function() {
} }
} }
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -71,28 +71,28 @@ module.exports = function ControlServiceFactory(
}) })
} }
this.touchUp = function(seq, contact) { this.touchUp = function(seq, contact) {
sendOneWay('input.touchUp', { sendOneWay('input.touchUp', {
seq: seq seq: seq
, contact: contact , contact: contact
}) })
} }
this.touchCommit = function(seq) { this.touchCommit = function(seq) {
sendOneWay('input.touchCommit', { sendOneWay('input.touchCommit', {
seq: seq seq: seq
}) })
} }
this.touchReset = function(seq) { this.touchReset = function(seq) {
sendOneWay('input.touchReset', { sendOneWay('input.touchReset', {
seq: seq seq: seq
}) })
} }
this.keyDown = keySender('input.keyDown') this.keyDown = keySender('input.keyDown')
this.keyUp = keySender('input.keyUp') this.keyUp = keySender('input.keyUp')
this.keyPress = keySender('input.keyPress') this.keyPress = keySender('input.keyPress')
this.home = keySender('input.keyPress', 'home') this.home = keySender('input.keyPress', 'home')
this.menu = keySender('input.keyPress', 'menu') this.menu = keySender('input.keyPress', 'menu')
@ -116,9 +116,9 @@ module.exports = function ControlServiceFactory(
//@TODO: Refactor this please //@TODO: Refactor this please
var that = this var that = this
this.getClipboardContent = function () { this.getClipboardContent = function() {
that.copy().then(function (result) { that.copy().then(function(result) {
$rootScope.$apply(function () { $rootScope.$apply(function() {
if (result.success) { if (result.success) {
if (result.lastData) { if (result.lastData) {
that.clipboardContent = result.lastData that.clipboardContent = result.lastData
@ -167,16 +167,16 @@ module.exports = function ControlServiceFactory(
this.testForward = function(forward) { this.testForward = function(forward) {
return sendTwoWay('forward.test', { return sendTwoWay('forward.test', {
targetHost: forward.targetHost targetHost: forward.targetHost
, targetPort: +forward.targetPort , targetPort: Number(forward.targetPort)
}) })
} }
this.createForward = function(forward) { this.createForward = function(forward) {
return sendTwoWay('forward.create', { return sendTwoWay('forward.create', {
id: forward.id id: forward.id
, devicePort: +forward.devicePort , devicePort: Number(forward.devicePort)
, targetHost: forward.targetHost , targetHost: forward.targetHost
, targetPort: +forward.targetPort , targetPort: Number(forward.targetPort)
}) })
} }
@ -225,15 +225,15 @@ module.exports = function ControlServiceFactory(
return sendTwoWay('screen.capture') return sendTwoWay('screen.capture')
} }
this.fsretrieve = function(file){ this.fsretrieve = function(file) {
return sendTwoWay('fs.retrieve', { return sendTwoWay('fs.retrieve', {
file: file, file: file
}) })
} }
this.fslist = function(dir){ this.fslist = function(dir) {
return sendTwoWay('fs.list', { return sendTwoWay('fs.list', {
dir: dir, dir: dir
}) })
} }

View file

@ -8,15 +8,15 @@ module.exports = function deviceContextMenuDirective($window) {
//}, //},
transclude: true, transclude: true,
template: require('./device-context-menu.jade'), template: require('./device-context-menu.jade'),
link: function (scope) { link: function(scope) {
//var device = scope.device() //var device = scope.device()
//var control = scope.control() //var control = scope.control()
scope.windowClose = function () { scope.windowClose = function() {
$window.close() $window.close()
} }
scope.saveScreenShot = function () { scope.saveScreenShot = function() {
scope.control.screenshot().then(function (result) { scope.control.screenshot().then(function(result) {
location.href = result.body.href + '?download' location.href = result.body.href + '?download'
}) })
} }

View file

@ -1,15 +1,15 @@
describe('deviceContextMenu', function () { describe('deviceContextMenu', function() {
beforeEach(angular.mock.module(require('./').name)) beforeEach(angular.mock.module(require('./').name))
var scope, compile var scope, compile
beforeEach(inject(function ($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new() scope = $rootScope.$new()
compile = $compile compile = $compile
})) }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, To test your directive, you need to create some html that would use your directive,

View file

@ -1,78 +1,78 @@
module.exports = angular.module('stf.device-status', []) module.exports = angular.module('stf.device-status', [])
.filter('statusNameAction', function (gettext) { .filter('statusNameAction', function(gettext) {
return function (text) { return function(text) {
return { return {
'absent': gettext('Disconnected'), absent: gettext('Disconnected'),
'present': gettext('Connected'), present: gettext('Connected'),
'offline': gettext('Offline'), offline: gettext('Offline'),
'unauthorized': gettext('Unauthorized'), unauthorized: gettext('Unauthorized'),
'preparing': gettext('Preparing'), preparing: gettext('Preparing'),
'ready': gettext('Ready'), ready: gettext('Ready'),
'using': gettext('Stop Using'), using: gettext('Stop Using'),
'busy': gettext('Busy'), busy: gettext('Busy'),
'available': gettext('Use') available: gettext('Use')
}[text] || gettext('Unknown') }[text] || gettext('Unknown')
} }
}) })
.filter('statusNamePassive', function (gettext) { .filter('statusNamePassive', function(gettext) {
return function (text) { return function(text) {
return { return {
'absent': gettext('Disconnected'), absent: gettext('Disconnected'),
'present': gettext('Connected'), present: gettext('Connected'),
'offline': gettext('Offline'), offline: gettext('Offline'),
'unauthorized': gettext('Unauthorized'), unauthorized: gettext('Unauthorized'),
'preparing': gettext('Preparing'), preparing: gettext('Preparing'),
'ready': gettext('Ready'), ready: gettext('Ready'),
'using': gettext('Using'), using: gettext('Using'),
'busy': gettext('Busy'), busy: gettext('Busy'),
'available': gettext('Available') available: gettext('Available')
}[text] || gettext('Unknown') }[text] || gettext('Unknown')
} }
}) })
.filter('likelyLeaveReason', function (gettext) { .filter('likelyLeaveReason', function(gettext) {
return function (text) { return function(text) {
return { return {
'ungroup_request': gettext('You (or someone else) kicked the device.'), ungroup_request: gettext('You (or someone else) kicked the device.'),
'owner_change': gettext('Someone stole your device.'), owner_change: gettext('Someone stole your device.'),
'automatic_timeout': gettext('Device was kicked by automatic timeout. '), automatic_timeout: gettext('Device was kicked by automatic timeout. '),
'device_absent': gettext('Device is not present anymore for some reason.'), device_absent: gettext('Device is not present anymore for some reason.'),
'status_change': gettext('Device is present but offline.') status_change: gettext('Device is present but offline.')
}[text] || gettext('Unknown reason.') }[text] || gettext('Unknown reason.')
} }
}) })
.filter('batteryHealth', function (gettext) { .filter('batteryHealth', function(gettext) {
return function (text) { return function(text) {
return { return {
'cold': gettext('Cold'), cold: gettext('Cold'),
'good': gettext('Good'), good: gettext('Good'),
'dead': gettext('Dead'), dead: gettext('Dead'),
'over_voltage': gettext('Over Voltage'), over_voltage: gettext('Over Voltage'),
'overheat': gettext('Overheat'), overheat: gettext('Overheat'),
'unspecified_failure': gettext('Unspecified Failure') unspecified_failure: gettext('Unspecified Failure')
}[text] || gettext('-') }[text] || gettext('-')
} }
}) })
.filter('batterySource', function (gettext) { .filter('batterySource', function(gettext) {
return function (text) { return function(text) {
return { return {
'ac': gettext('AC'), ac: gettext('AC'),
'usb': gettext('USB'), usb: gettext('USB'),
'wireless': gettext('Wireless') wireless: gettext('Wireless')
}[text] || gettext('-') }[text] || gettext('-')
} }
}) })
.filter('batteryStatus', function (gettext) { .filter('batteryStatus', function(gettext) {
return function (text) { return function(text) {
return { return {
'charging': gettext('Charging'), charging: gettext('Charging'),
'discharging': gettext('Discharging'), discharging: gettext('Discharging'),
'full': gettext('Full'), full: gettext('Full'),
'not_charging': gettext('Not Charging') not_charging: gettext('Not Charging')
}[text] || gettext('-') }[text] || gettext('-')
} }
}) })
.filter('displayDensity', function () { .filter('displayDensity', function() {
return function (text) { return function(text) {
return { return {
'0.5': 'LDPI', // (120 dpi) '0.5': 'LDPI', // (120 dpi)
'1': 'MDPI', // (160 dpi) '1': 'MDPI', // (160 dpi)
@ -83,38 +83,36 @@ module.exports = angular.module('stf.device-status', [])
}[text] || text }[text] || text
} }
}) })
.filter('networkType', function (gettext) { .filter('networkType', function(gettext) {
return function (text) { return function(text) {
return { return {
'bluetooth': gettext('Bluetooth'), bluetooth: gettext('Bluetooth'),
'dummy': gettext('Dummy'), dummy: gettext('Dummy'),
'ethernet': gettext('Ethernet'), ethernet: gettext('Ethernet'),
'mobile': gettext('Mobile'), mobile: gettext('Mobile'),
'mobile_dun': gettext('Mobile DUN'), mobile_dun: gettext('Mobile DUN'),
'mobile_hipri': gettext('Mobile High Priority'), mobile_hipri: gettext('Mobile High Priority'),
'mobile_mms': gettext('Mobile MMS'), mobile_mms: gettext('Mobile MMS'),
'mobile_supl': gettext('Mobile SUPL'), mobile_supl: gettext('Mobile SUPL'),
'mobile_wifi': gettext('WiFi'), mobile_wifi: gettext('WiFi'),
'wimax': gettext('WiMAX') wimax: gettext('WiMAX')
}[text] || text }[text] || text
} }
}) })
.filter('networkSubType', function (gettext) { .filter('networkSubType', function(gettext) {
return function (text) { return function(text) {
return { return {
'mobile_wifi': gettext('WiFi') mobile_wifi: gettext('WiFi')
}[text] || text }[text] || text
} }
}) })
.filter('humanizedBool', function (gettext) { .filter('humanizedBool', function(gettext) {
return function (text) { return function(text) {
switch (text) { switch (text) {
case true: case true:
return gettext('Yes') return gettext('Yes')
break;
case false: case false:
return gettext('No') return gettext('No')
break;
default: default:
return gettext('-') return gettext('-')
} }

View file

@ -7,10 +7,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
function Tracker($scope, options) { function Tracker($scope, options) {
var devices = [] var devices = []
, devicesBySerial = Object.create(null) var devicesBySerial = Object.create(null)
, scopedSocket = socket.scoped($scope) var scopedSocket = socket.scoped($scope)
, digestTimer var digestTimer, lastDigest
, lastDigest
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
clearTimeout(digestTimer) clearTimeout(digestTimer)
@ -81,7 +80,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
var modify = function modify(data, newData) { var modify = function modify(data, newData) {
_.merge(data, newData, function(a, b) { _.merge(data, newData, function(a, b) {
// New Arrays overwrite old Arrays // New Arrays overwrite old Arrays
return _.isArray(b) ? b : undefined if (_.isArray(b)) {
return b
}
}) })
sync(data) sync(data)
this.emit('change', data) this.emit('change', data)
@ -156,7 +157,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
Tracker.prototype = new EventEmitter() Tracker.prototype = new EventEmitter()
deviceService.trackAll = function ($scope) { deviceService.trackAll = function($scope) {
var tracker = new Tracker($scope, { var tracker = new Tracker($scope, {
filter: function() { filter: function() {
return true return true
@ -165,14 +166,14 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
}) })
oboe('/app/api/v1/devices') oboe('/app/api/v1/devices')
.node('devices[*]', function (device) { .node('devices[*]', function(device) {
tracker.add(device) tracker.add(device)
}) })
return tracker return tracker
} }
deviceService.trackGroup = function ($scope) { deviceService.trackGroup = function($scope) {
var tracker = new Tracker($scope, { var tracker = new Tracker($scope, {
filter: function(device) { filter: function(device) {
return device.using return device.using
@ -181,7 +182,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
}) })
oboe('/app/api/v1/group') oboe('/app/api/v1/group')
.node('devices[*]', function (device) { .node('devices[*]', function(device) {
tracker.add(device) tracker.add(device)
}) })
@ -190,12 +191,12 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
deviceService.load = function(serial) { deviceService.load = function(serial) {
return $http.get('/app/api/v1/devices/' + serial) return $http.get('/app/api/v1/devices/' + serial)
.then(function (response) { .then(function(response) {
return response.data.device return response.data.device
}) })
} }
deviceService.get = function (serial, $scope) { deviceService.get = function(serial, $scope) {
var tracker = new Tracker($scope, { var tracker = new Tracker($scope, {
filter: function(device) { filter: function(device) {
return device.serial === serial 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', { socket.emit('device.note', {
serial: serial, serial: serial,
note: note note: note

View file

@ -55,13 +55,13 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
if (device.owner) { if (device.owner) {
device.enhancedUserProfileUrl = enhanceUserProfileUrl(device.owner.email) device.enhancedUserProfileUrl = enhanceUserProfileUrl(device.owner.email)
device.enhancedUserName = device.owner.name || "No name" device.enhancedUserName = device.owner.name || 'No name'
} }
} }
function enhanceUserProfileUrl(email) { function enhanceUserProfileUrl(email) {
var url var url
var userProfileUrl = (function () { var userProfileUrl = (function() {
if (AppState && AppState.config && AppState.config.userProfileUrl) { if (AppState && AppState.config && AppState.config.userProfileUrl) {
return AppState.config.userProfileUrl return AppState.config.userProfileUrl
} }
@ -73,7 +73,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
if (userProfileUrl && email) { if (userProfileUrl && email) {
url = userProfileUrl.indexOf('{user}') !== -1 ? url = userProfileUrl.indexOf('{user}') !== -1 ?
userProfileUrl.replace('{user}', email) : userProfileUrl.replace('{user}', email) :
userProfileUrl + email; userProfileUrl + email
} }
} else if (email.indexOf('@') !== -1) { } else if (email.indexOf('@') !== -1) {
url = 'mailto:' + email url = 'mailto:' + email
@ -83,7 +83,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
return url return url
} }
service.enhance = function (device) { service.enhance = function(device) {
setState(device) setState(device)
enhanceDevice(device) enhanceDevice(device)
enhanceDeviceDetails(device) enhanceDeviceDetails(device)

View file

@ -1,7 +1,7 @@
module.exports = function StateClassesService() { module.exports = function StateClassesService() {
var service = {} var service = {}
service.stateButton = function (state) { service.stateButton = function(state) {
var stateClasses = { var stateClasses = {
using: 'state-using btn-primary', using: 'state-using btn-primary',
busy: 'state-busy btn-warning', busy: 'state-busy btn-warning',
@ -18,7 +18,7 @@ module.exports = function StateClassesService() {
return stateClasses return stateClasses
} }
service.stateColor = function (state) { service.stateColor = function(state) {
var stateClasses = { var stateClasses = {
using: 'state-using', using: 'state-using',
busy: 'state-busy', busy: 'state-busy',

View file

@ -6,11 +6,11 @@ module.exports = function FilterStringServiceFactory() {
/** /**
* Filters integer * Filters integer
* *
* @param searchValue * @param {string} searchValue Value to search
* @param str * @param {string} str Value to compare
* @returns {boolean} true if matched * @returns {boolean} true if matched
*/ */
service.filterInteger = function (searchValue, str) { service.filterInteger = function(searchValue, str) {
var matched = true var matched = true
matched = service.filterString(searchValue + '', str + '') matched = service.filterString(searchValue + '', str + '')
return matched return matched
@ -19,11 +19,11 @@ module.exports = function FilterStringServiceFactory() {
/** /**
* Filters string * Filters string
* *
* @param searchValue * @param {string} searchValue Value to search
* @param str * @param {string} str Value to compare
* @returns {boolean} true if matched * @returns {boolean} true if matched
*/ */
service.filterString = function (searchValue, str) { service.filterString = function(searchValue, str) {
var matched = true var matched = true
var searchLowerCase = searchValue.toLowerCase() var searchLowerCase = searchValue.toLowerCase()
var searchContent = searchValue.slice(1) var searchContent = searchValue.slice(1)

View file

@ -1,9 +1,9 @@
module.exports = function imageOnloadAnimateDirective($parse, $animate) { module.exports = function imageOnloadAnimateDirective($parse, $animate) {
return { return {
restrict: 'A', restrict: 'A',
link: function (scope, element) { link: function(scope, element) {
$animate.addClass(element, 'ng-image-not-loaded') $animate.addClass(element, 'ng-image-not-loaded')
element.bind('load', function () { element.bind('load', function() {
$animate.removeClass(element, 'ng-image-not-loaded') $animate.removeClass(element, 'ng-image-not-loaded')
//if(!scope.$$phase) { //if(!scope.$$phase) {

View file

@ -1,7 +1,7 @@
module.exports = function imageOnloadDirective() { module.exports = function imageOnloadDirective() {
return { return {
restrict: 'A', restrict: 'A',
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
element.bind('load', function() { element.bind('load', function() {
scope.$eval(attrs.imageOnload) scope.$eval(attrs.imageOnload)
// console.log('image is loaded') // console.log('image is loaded')

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,10 +1,10 @@
module.exports = function installErrorFilter(gettext) { module.exports = function installErrorFilter(gettext) {
/*jshint maxlen:200*/ /* eslint max-len:0 */
return function (text) { return function(text) {
switch (text) { switch (text) {
// Our error codes. // Our error codes.
case "INSTALL_SUCCEEDED": case 'INSTALL_SUCCEEDED':
return gettext("Installation succeeded.") return gettext('Installation succeeded.')
case 'INSTALL_ERROR_UNKNOWN': case 'INSTALL_ERROR_UNKNOWN':
return gettext('Installation failed due to an unknown error.') return gettext('Installation failed due to an unknown error.')
case 'INSTALL_ERROR_TIMEOUT': case 'INSTALL_ERROR_TIMEOUT':
@ -14,80 +14,80 @@ module.exports = function installErrorFilter(gettext) {
// Android PackageManager error codes from [1]. // Android PackageManager error codes from [1].
// [1] https://github.com/android/platform_frameworks_base/blob/ // [1] https://github.com/android/platform_frameworks_base/blob/
// master/core/java/android/content/pm/PackageManager.java // master/core/java/android/content/pm/PackageManager.java
case "INSTALL_FAILED_ALREADY_EXISTS": case 'INSTALL_FAILED_ALREADY_EXISTS':
return gettext("The package is already installed.") return gettext('The package is already installed.')
case "INSTALL_FAILED_INVALID_APK": case 'INSTALL_FAILED_INVALID_APK':
return gettext("The package archive file is invalid.") return gettext('The package archive file is invalid.')
case "INSTALL_FAILED_INVALID_URI": case 'INSTALL_FAILED_INVALID_URI':
return gettext("The URI passed in is invalid.") return gettext('The URI passed in is invalid.')
case "INSTALL_FAILED_INSUFFICIENT_STORAGE": 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.") 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": case 'INSTALL_FAILED_DUPLICATE_PACKAGE':
return gettext("A package is already installed with the same name.") return gettext('A package is already installed with the same name.')
case "INSTALL_FAILED_NO_SHARED_USER": case 'INSTALL_FAILED_NO_SHARED_USER':
return gettext("The requested shared user does not exist.") return gettext('The requested shared user does not exist.')
case "INSTALL_FAILED_UPDATE_INCOMPATIBLE": 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).") 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": case 'INSTALL_FAILED_MISSING_SHARED_LIBRARY':
return gettext("The new package uses a shared library that is not available.") return gettext('The new package uses a shared library that is not available.')
case "INSTALL_FAILED_REPLACE_COULDNT_DELETE": case 'INSTALL_FAILED_REPLACE_COULDNT_DELETE':
return gettext("The existing package could not be deleted.") return gettext('The existing package could not be deleted.')
case "INSTALL_FAILED_DEXOPT": 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.") 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": case 'INSTALL_FAILED_OLDER_SDK':
return gettext("The new package failed because the current SDK version is older than that required by the package.") return gettext('The new package failed because the current SDK version is older than that required by the package.')
case "INSTALL_FAILED_CONFLICTING_PROVIDER": 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.") 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": case 'INSTALL_FAILED_NEWER_SDK':
return gettext("The new package failed because the current SDK version is newer than that required by the package.") return gettext('The new package failed because the current SDK version is newer than that required by the package.')
case "INSTALL_FAILED_TEST_ONLY": 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.") 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_CPU_ABI_INCOMPATIBLE':
return gettext("The package being installed contains native code, but none that is compatible with the device's CPU_ABI.") 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": case 'INSTALL_FAILED_MISSING_FEATURE':
return gettext("The new package uses a feature that is not available.") return gettext('The new package uses a feature that is not available.')
case "INSTALL_FAILED_CONTAINER_ERROR": case 'INSTALL_FAILED_CONTAINER_ERROR':
return gettext("A secure container mount point couldn't be accessed on external media.") 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.") 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.") 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.") 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.") return gettext("The new package couldn't be installed because the verification did not succeed.")
case "INSTALL_FAILED_PACKAGE_CHANGED": case 'INSTALL_FAILED_PACKAGE_CHANGED':
return gettext("The package changed from what the calling program expected.") return gettext('The package changed from what the calling program expected.')
case "INSTALL_FAILED_UID_CHANGED": case 'INSTALL_FAILED_UID_CHANGED':
return gettext("The new package is assigned a different UID than it previously held.") return gettext('The new package is assigned a different UID than it previously held.')
case "INSTALL_FAILED_VERSION_DOWNGRADE": case 'INSTALL_FAILED_VERSION_DOWNGRADE':
return gettext("The new package has an older version code than the currently installed package.") return gettext('The new package has an older version code than the currently installed package.')
case "INSTALL_PARSE_FAILED_NOT_APK": 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.") 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": case 'INSTALL_PARSE_FAILED_BAD_MANIFEST':
return gettext("The parser was unable to retrieve the AndroidManifest.xml file.") return gettext('The parser was unable to retrieve the AndroidManifest.xml file.')
case "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION": case 'INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION':
return gettext("The parser encountered an unexpected exception.") return gettext('The parser encountered an unexpected exception.')
case "INSTALL_PARSE_FAILED_NO_CERTIFICATES": case 'INSTALL_PARSE_FAILED_NO_CERTIFICATES':
return gettext("The parser did not find any certificates in the .apk.") return gettext('The parser did not find any certificates in the .apk.')
case "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES": case 'INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES':
return gettext("The parser found inconsistent certificates on the files in the .apk.") return gettext('The parser found inconsistent certificates on the files in the .apk.')
case "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING": case 'INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING':
return gettext("The parser encountered a CertificateEncodingException in one of the files in the .apk.") return gettext('The parser encountered a CertificateEncodingException in one of the files in the .apk.')
case "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME": case 'INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME':
return gettext("The parser encountered a bad or missing package name in the manifest.") return gettext('The parser encountered a bad or missing package name in the manifest.')
case "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID": case 'INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID':
return gettext("The parser encountered a bad shared user id name in the manifest.") return gettext('The parser encountered a bad shared user id name in the manifest.')
case "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED": case 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED':
return gettext("The parser encountered some structural problem in the manifest.") return gettext('The parser encountered some structural problem in the manifest.')
case "INSTALL_PARSE_FAILED_MANIFEST_EMPTY": case 'INSTALL_PARSE_FAILED_MANIFEST_EMPTY':
return gettext("The parser did not find any actionable tags (instrumentation or application) in the manifest.") return gettext('The parser did not find any actionable tags (instrumentation or application) in the manifest.')
case "INSTALL_FAILED_INTERNAL_ERROR": case 'INSTALL_FAILED_INTERNAL_ERROR':
return gettext("The system failed to install the package because of system issues.") return gettext('The system failed to install the package because of system issues.')
case "INSTALL_FAILED_USER_RESTRICTED": case 'INSTALL_FAILED_USER_RESTRICTED':
return gettext("The system failed to install the package because the user is restricted from installing apps.") return gettext('The system failed to install the package because the user is restricted from installing apps.')
case "INSTALL_FAILED_NO_MATCHING_ABIS": 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.") 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: default:
return gettext(text) return gettext(text)
} }

View file

@ -60,14 +60,14 @@ module.exports = function InstallService(
this.emit('change') this.emit('change')
} }
installService.installUrl = function (control, url) { installService.installUrl = function(control, url) {
var installation = new Installation('downloading') var installation = new Installation('downloading')
$rootScope.$broadcast('installation', installation) $rootScope.$broadcast('installation', installation)
return control.uploadUrl(url) return control.uploadUrl(url)
.progressed(function (uploadResult) { .progressed(function(uploadResult) {
installation.update(uploadResult.progress / 2, uploadResult.lastData) installation.update(uploadResult.progress / 2, uploadResult.lastData)
}) })
.then(function (uploadResult) { .then(function(uploadResult) {
installation.update(uploadResult.progress / 2, uploadResult.lastData) installation.update(uploadResult.progress / 2, uploadResult.lastData)
installation.manifest = uploadResult.body installation.manifest = uploadResult.body
return control.install({ return control.install({
@ -75,7 +75,7 @@ module.exports = function InstallService(
, manifest: installation.manifest , manifest: installation.manifest
, launch: installation.launch , launch: installation.launch
}) })
.progressed(function (result) { .progressed(function(result) {
installation.update(50 + result.progress / 2, result.lastData) 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') var installation = new Installation('uploading')
$rootScope.$broadcast('installation', installation) $rootScope.$broadcast('installation', installation)
return StorageService.storeFile('apk', $files, { return StorageService.storeFile('apk', $files, {
@ -112,7 +112,7 @@ module.exports = function InstallService(
, manifest: installation.manifest , manifest: installation.manifest
, launch: installation.launch , launch: installation.launch
}) })
.progressed(function (result) { .progressed(function(result) {
installation.update(50 + result.progress / 2, result.lastData) installation.update(50 + result.progress / 2, result.lastData)
}) })
} }

View file

@ -1,7 +1,7 @@
module.exports = angular.module('stf.keycodes', [ module.exports = angular.module('stf.keycodes', [
]) ])
.factory('KeycodesMapped', function () { .factory('KeycodesMapped', function() {
return require('./mapped/index.json') return require('./mapped/index.json')
}) })

View file

@ -57,11 +57,11 @@ module.exports = function KeycodesServiceFactory(KeycodesAndroid, KeycodesJS) {
[j.SINGLE_QUOTE, a.KEYCODE_APOSTROPHE] [j.SINGLE_QUOTE, a.KEYCODE_APOSTROPHE]
] ]
service.mapToDevice = function (keyCode) { service.mapToDevice = function(keyCode) {
return service.mapToAndroid(keyCode) return service.mapToAndroid(keyCode)
} }
service.mapToAndroid = function (key) { service.mapToAndroid = function(key) {
// All special keys // All special keys
for (var i = 0; i < androidMap.length; ++i) { for (var i = 0; i < androidMap.length; ++i) {
if (androidMap[i][0] === key) { if (androidMap[i][0] === key) {

View file

@ -1,7 +1,7 @@
module.exports = function AdbKeysServiceFactory() { module.exports = function AdbKeysServiceFactory() {
var service = {} var service = {}
service.commentFromKey = function (key) { service.commentFromKey = function(key) {
if (key.match(/.+= (.+)/)) { if (key.match(/.+= (.+)/)) {
return key.replace(/.+= (.+)/g, '$1') return key.replace(/.+= (.+)/g, '$1')
} }

View file

@ -13,7 +13,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
, key: '' , key: ''
} }
$scope.addKey = function () { $scope.addKey = function() {
UserService.addAdbKey({ UserService.addAdbKey({
title: $scope.addForm.title title: $scope.addForm.title
, key: $scope.addForm.key , key: $scope.addForm.key
@ -21,7 +21,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
$scope.closeAddKey() $scope.closeAddKey()
} }
$scope.closeAddKey = function () { $scope.closeAddKey = function() {
$scope.addForm.title = '' $scope.addForm.title = ''
$scope.addForm.key = '' $scope.addForm.key = ''
// TODO: cannot access to the form by name inside a directive? // TODO: cannot access to the form by name inside a directive?
@ -29,8 +29,8 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
$scope.showAdd = false $scope.showAdd = false
} }
}, },
link: function (scope) { link: function(scope) {
scope.$watch('addForm.key', function (newValue) { scope.$watch('addForm.key', function(newValue) {
if (newValue && !scope.addForm.title) { if (newValue && !scope.addForm.title) {
// By default sets the title to the ADB key comment because // By default sets the title to the ADB key comment because
// usually it happens to be username@hostname. // usually it happens to be username@hostname.

View file

@ -1,15 +1,15 @@
describe('addAdbKey', function () { describe('addAdbKey', function() {
beforeEach(angular.mock.module(require('./index').name)) beforeEach(angular.mock.module(require('./index').name))
var scope, compile var scope, compile
beforeEach(inject(function ($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new() scope = $rootScope.$new()
compile = $compile compile = $compile
})) }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, To test your directive, you need to create some html that would use your directive,

View file

@ -2,7 +2,7 @@ module.exports =
function landscapeDirective(BrowserInfo, $document, $window) { function landscapeDirective(BrowserInfo, $document, $window) {
return { return {
restrict: 'A', restrict: 'A',
link: function (scope) { link: function(scope) {
var body = angular.element($document[0].body) var body = angular.element($document[0].body)
if (typeof $window.orientation !== 'undefined') { if (typeof $window.orientation !== 'undefined') {

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -12,7 +12,7 @@ module.exports = function LanguageProvider(AppStateProvider) {
} }
return { return {
$get: function () { $get: function() {
return provider return provider
} }
} }

View file

@ -6,7 +6,7 @@ module.exports =
restrict: 'E', restrict: 'E',
replace: true, replace: true,
template: require('./logcat-table.jade'), template: require('./logcat-table.jade'),
link: function (scope, element) { link: function(scope, element) {
var autoScroll = true var autoScroll = true
var autoScrollDependingOnScrollPosition = true var autoScrollDependingOnScrollPosition = true
var scrollPosition = 0 var scrollPosition = 0
@ -23,15 +23,15 @@ module.exports =
} }
} }
LogcatService.addEntryListener = function (entry) { LogcatService.addEntryListener = function(entry) {
incrementNumberEntry() incrementNumberEntry()
addRow(body, entry) addRow(body, entry)
} }
LogcatService.addFilteredEntriesListener = function (entries) { LogcatService.addFilteredEntriesListener = function(entries) {
clearTable() clearTable()
//var fragment = document.createDocumentFragment() //var fragment = document.createDocumentFragment()
_.each(entries, function (entry) { _.each(entries, function(entry) {
// TODO: This is not adding all the entries after first scope creation // TODO: This is not adding all the entries after first scope creation
incrementNumberEntry() incrementNumberEntry()
addRow(body, entry, true) addRow(body, entry, true)
@ -56,7 +56,7 @@ module.exports =
function scrollToBottom() { function scrollToBottom() {
parent.scrollTop = parent.scrollHeight + 20 parent.scrollTop = parent.scrollHeight + 20
$timeout(function () { $timeout(function() {
parent.scrollTop = parent.scrollHeight parent.scrollTop = parent.scrollHeight
}, 10) }, 10)
} }
@ -99,13 +99,13 @@ module.exports =
body = newBody body = newBody
} }
scope.clearTable = function () { scope.clearTable = function() {
LogcatService.clear() LogcatService.clear()
numberOfEntries = 0 numberOfEntries = 0
clearTable() clearTable()
} }
scope.$on('$destroy', function () { scope.$on('$destroy', function() {
parent.removeEventListener('scroll', throttledScrollListener) parent.removeEventListener('scroll', throttledScrollListener)
}) })
} }

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your directive, 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -23,14 +23,14 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
var _filters = {} var _filters = {}
function defineFilterProperties(properties) { function defineFilterProperties(properties) {
_.forEach(properties, function (prop) { _.forEach(properties, function(prop) {
Object.defineProperty(service.filters, prop, { Object.defineProperty(service.filters, prop, {
get: function () { get: function() {
return _filters[prop] return _filters[prop]
}, },
set: function (value) { set: function(value) {
_filters[prop] = value ? value : null _filters[prop] = value || null
service.serverFilters[0][prop] = value ? value : undefined service.serverFilters[0][prop] = value || undefined
service.filters.filterLines() service.filters.filterLines()
} }
}) })
@ -63,11 +63,11 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
'SILENT' 'SILENT'
] ]
var logLevelsLowerCase = _.map(service.logLevels, function (level) { var logLevelsLowerCase = _.map(service.logLevels, function(level) {
return level.toLowerCase() return level.toLowerCase()
}) })
var logLevelsCapitalized = _.map(logLevelsLowerCase, function (level) { var logLevelsCapitalized = _.map(logLevelsLowerCase, function(level) {
return _s.capitalize(level) return _s.capitalize(level)
}) })
@ -90,26 +90,26 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
return data return data
} }
socket.on('logcat.entry', function (rawData) { socket.on('logcat.entry', function(rawData) {
service.numberOfEntries++ service.numberOfEntries++
service.entries.push(enhanceEntry(rawData)) service.entries.push(enhanceEntry(rawData))
if (typeof(service.addEntryListener) === 'function') { if (typeof (service.addEntryListener) === 'function') {
if (filterLine(rawData)) { if (filterLine(rawData)) {
service.addEntryListener(rawData) service.addEntryListener(rawData)
} }
} }
}) })
service.clear = function () { service.clear = function() {
service.numberOfEntries = 0 service.numberOfEntries = 0
service.entries = [] service.entries = []
} }
service.filters.filterLines = function () { service.filters.filterLines = function() {
service.filters.entries = _.filter(service.entries, filterLine) service.filters.entries = _.filter(service.entries, filterLine)
if (typeof(service.addFilteredEntriesListener) === 'function') { if (typeof (service.addFilteredEntriesListener) === 'function') {
service.addFilteredEntriesListener(service.filters.entries) service.addFilteredEntriesListener(service.filters.entries)
} }
} }

View file

@ -25,31 +25,31 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
// TODO: use a central on-blur event // TODO: use a central on-blur event
var cachedWindowOnBlur = $window.onblur var cachedWindowOnBlur = $window.onblur
service.open = function (options) { service.open = function(options) {
switch (fallbackMethod) { switch (fallbackMethod) {
case 'USE_NEW_WINDOW': case 'USE_NEW_WINDOW':
// Doesn't work well on Chrome // Doesn't work well on Chrome
windowOpened = $window.open(options.nativeUrl) windowOpened = $window.open(options.nativeUrl)
$timeout(function () { $timeout(function() {
if (windowOpened) { if (windowOpened) {
windowOpened.close() windowOpened.close()
} }
}, 500) }, 500)
$window.location.href = options.webUrl $window.location.href = options.webUrl
break; break
case 'USE_ON_BLUR': case 'USE_ON_BLUR':
// Doesn't work on Safari // Doesn't work on Safari
$window.onblur = function () { $window.onblur = function() {
wasBlured = true wasBlured = true
} }
$window.location.href = options.nativeUrl $window.location.href = options.nativeUrl
$timeout(function () { $timeout(function() {
if (wasBlured) { if (wasBlured) {
wasBlured = false wasBlured = false
} else { } else {
@ -59,14 +59,14 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
$window.onblur = cachedWindowOnBlur $window.onblur = cachedWindowOnBlur
}, 250) }, 250)
break; break
case 'USE_TIME_ELAPSED': case 'USE_TIME_ELAPSED':
// Doesn't work on Chrome // Doesn't work on Chrome
var start, end, elapsed var start, end, elapsed
start = new Date().getTime() 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 // This depends on the fact that JS is single-thread
document.location = options.nativeUrl document.location = options.nativeUrl
@ -79,7 +79,7 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
document.location = options.webUrl document.location = options.webUrl
} }
break; break
default: default:
} }

View file

@ -1,17 +1,15 @@
/* Based on https://ryankaskel.com/blog/2013/05/27/ /* Based on https://ryankaskel.com/blog/2013/05/27/
a-different-approach-to-angularjs-navigation-menus */ a-different-approach-to-angularjs-navigation-menus */
module.exports = function ($location) { module.exports = function($location) {
return { return {
restrict: 'EA', restrict: 'EA',
scope: {}, scope: {},
link: function (scope, element, attrs) { link: function(scope, element, attrs) {
var links = element.find('a') var links = element.find('a')
var onClass = attrs.navMenu || 'current' var onClass = attrs.navMenu || 'current'
var routePattern
var link
var url
var urlMap = [] var urlMap = []
var routePattern, link, url
if (!$location.$$html5) { if (!$location.$$html5) {
routePattern = /\/#[^/]*/ routePattern = /\/#[^/]*/

View file

@ -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) { beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new(); scope = $rootScope.$new()
compile = $compile; compile = $compile
})); }))
it('should ...', function () { it('should ...', function() {
/* /*
To test your directive, you need to create some html that would use your 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'); expect(element.text()).toBe('hello, world');
*/ */
}); })
}); })

View file

@ -1,4 +1,4 @@
module.exports = function () { module.exports = function() {
var service = {} var service = {}

View file

@ -1,12 +1,12 @@
module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) { module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) {
return function (scope, hotkeySet) { return function(scope, hotkeySet) {
function hotkeyAdd(combo, desc, callback, preventDefault) { function hotkeyAdd(combo, desc, callback, preventDefault) {
hotkeys.add({ hotkeys.add({
combo: combo, combo: combo,
description: $filter('translate')(desc), description: $filter('translate')(desc),
allowIn: ['textarea', 'input'], allowIn: ['textarea', 'input'],
callback: function (event) { callback: function(event) {
if (preventDefault || typeof preventDefault === 'undefined') { if (preventDefault || typeof preventDefault === 'undefined') {
event.preventDefault() 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]) hotkeyAdd(value[0], value[1], value[2], value[3])
}) })
scope.$on('$destroy', function () { scope.$on('$destroy', function() {
angular.forEach(hotkeySet, function (value) { angular.forEach(hotkeySet, function(value) {
hotkeys.del(value[0]) hotkeys.del(value[0])
}) })
}) })

View file

@ -26,11 +26,11 @@ function CanvasRender(canvasElement, options) {
} }
} }
CanvasRender.prototype.draw = function (image) { CanvasRender.prototype.draw = function(image) {
this.context.drawImage(image, 0, 0) 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.clearRect(0, 0, this.context.canvas.width,
this.context.canvas.height) this.context.canvas.height)
} }

View file

@ -9,7 +9,7 @@ function FastImageRender(canvasElement, options) {
this.timeoutId = null this.timeoutId = null
if (that.options.raf) { if (that.options.raf) {
that.animLoop = function () { that.animLoop = function() {
that.raf = window.requireAnimationFrame(that.animLoop) that.raf = window.requireAnimationFrame(that.animLoop)
// separate render from drawing // separate render from drawing
@ -19,19 +19,19 @@ function FastImageRender(canvasElement, options) {
// Loader // Loader
this.loader = new Image() this.loader = new Image()
this.loader.onload = function () { this.loader.onload = function() {
if (that.options.timeout) { if (that.options.timeout) {
clearTimeout(that.timeoutId) clearTimeout(that.timeoutId)
} }
if (typeof(that.onLoad) === 'function') { if (typeof (that.onLoad) === 'function') {
that.onLoad(this) that.onLoad(this)
} }
} }
this.loader.onerror = function () { this.loader.onerror = function() {
if (that.options.timeout) { if (that.options.timeout) {
clearTimeout(that.timeoutId) clearTimeout(that.timeoutId)
} }
if (typeof(that.onError) === 'function') { if (typeof (that.onError) === 'function') {
that.onError(this) that.onError(this)
} }
} }
@ -47,19 +47,19 @@ function FastImageRender(canvasElement, options) {
} }
FastImageRender.prototype.destroy = function () { FastImageRender.prototype.destroy = function() {
window.cancelAnimationFrame(this.raf) window.cancelAnimationFrame(this.raf)
// delete onLoad & onError // delete onLoad & onError
} }
FastImageRender.prototype.load = function (url, type) { FastImageRender.prototype.load = function(url, type) {
var that = this var that = this
if (that.options.timeout) { if (that.options.timeout) {
that.timeoutId = setTimeout(function () { that.timeoutId = setTimeout(function() {
if (typeof(that.onError) === 'function') { if (typeof (that.onError) === 'function') {
that.onError('timeout') that.onError('timeout')
} }
}, that.options.timeout) }, that.options.timeout)
@ -72,14 +72,14 @@ FastImageRender.prototype.load = function (url, type) {
var texture = null var texture = null
if (type) { if (type) {
texture = this.render.ctx.createTexture() texture = this.render.ctx.createTexture()
this.textureLoader.loadEx(url, texture, true, function () { this.textureLoader.loadEx(url, texture, true, function() {
if (typeof(that.onLoad) === 'function') { if (typeof (that.onLoad) === 'function') {
that.onLoad(texture) that.onLoad(texture)
} }
}, type) }, type)
} else { } else {
this.textureLoader.load(url, function (texture) { this.textureLoader.load(url, function(texture) {
if (typeof(that.onLoad) === 'function') { if (typeof (that.onLoad) === 'function') {
that.onLoad(texture) 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) this.render.draw(image)
} }
FastImageRender.prototype.clear = function () { FastImageRender.prototype.clear = function() {
this.render.clear() this.render.clear()
} }
Object.defineProperty(FastImageRender.prototype, 'canvasWidth', { Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
get: function () { get: function() {
return this.canvasElement.width return this.canvasElement.width
}, },
set: function (width) { set: function(width) {
if (width) { if (width) {
if (width !== this.canvasElement.width) { if (width !== this.canvasElement.width) {
this.canvasElement.width = width this.canvasElement.width = width
@ -113,10 +113,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
}) })
Object.defineProperty(FastImageRender.prototype, 'canvasHeight', { Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
get: function () { get: function() {
return this.canvasElement.height return this.canvasElement.height
}, },
set: function (height) { set: function(height) {
if (height) { if (height) {
if (height !== this.canvasElement.height) { if (height !== this.canvasElement.height) {
this.canvasElement.height = height this.canvasElement.height = height
@ -126,10 +126,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
}) })
Object.defineProperty(FastImageRender.prototype, 'displayWidth', { Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
get: function () { get: function() {
return this.canvasElement.width return this.canvasElement.width
}, },
set: function (width) { set: function(width) {
if (width) { if (width) {
if (width !== this.canvasElement.width) { if (width !== this.canvasElement.width) {
this.canvasElement.width = width this.canvasElement.width = width
@ -139,10 +139,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
}) })
Object.defineProperty(FastImageRender.prototype, 'displayHeight', { Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
get: function () { get: function() {
return this.canvasElement.height return this.canvasElement.height
}, },
set: function (height) { set: function(height) {
if (height) { if (height) {
if (height !== this.canvasElement.height) { if (height !== this.canvasElement.height) {
this.canvasElement.height = height this.canvasElement.height = height
@ -152,10 +152,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
}) })
Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', { Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
get: function () { get: function() {
return parseInt(this.canvasElement.style.width, 10) return parseInt(this.canvasElement.style.width, 10)
}, },
set: function (width) { set: function(width) {
if (width) { if (width) {
var styleWidth = width + 'px' var styleWidth = width + 'px'
if (styleWidth !== this.canvasElement.style.width) { if (styleWidth !== this.canvasElement.style.width) {
@ -166,10 +166,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
}) })
Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', { Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', {
get: function () { get: function() {
return parseInt(this.canvasElement.style.height, 10) return parseInt(this.canvasElement.style.height, 10)
}, },
set: function (height) { set: function(height) {
if (height) { if (height) {
var styleHeight = height + 'px' var styleHeight = height + 'px'
if (styleHeight !== this.canvasElement.style.height) { if (styleHeight !== this.canvasElement.style.height) {

View file

@ -1,3 +1,5 @@
/* eslint no-console: 0 */
var canvasElement = document.querySelector('canvas') var canvasElement = document.querySelector('canvas')
var frameNumberElement = document.querySelector('#frame-number') var frameNumberElement = document.querySelector('#frame-number')
var totalTimeElement = document.querySelector('#total-time') var totalTimeElement = document.querySelector('#total-time')
@ -7,7 +9,7 @@ var frame = {
current: 0 current: 0
} }
function FastImageRender () { function FastImageRender() {
} }
@ -35,7 +37,7 @@ var startTime = new Date().getTime()
loadNext() loadNext()
imageRender.onLoad = function (image) { imageRender.onLoad = function(image) {
console.timeEnd('load') console.timeEnd('load')
console.time('draw') console.time('draw')
imageRender.draw(image) imageRender.draw(image)

View file

@ -7,7 +7,7 @@
* @param {WebGLRenderingContext} gl The GL context. * @param {WebGLRenderingContext} gl The GL context.
* @constructor * @constructor
*/ */
var Renderer = function (gl) { var Renderer = function(gl) {
/** /**
* The GL context. * The GL context.
* @type {WebGLRenderingContext} * @type {WebGLRenderingContext}
@ -92,13 +92,13 @@ var Renderer = function (gl) {
} }
Renderer.prototype.finishInit = function () { Renderer.prototype.finishInit = function() {
this.draw() this.draw()
} }
Renderer.prototype.createDxtTexture = Renderer.prototype.createDxtTexture =
function (dxtData, width, height, format) { function(dxtData, width, height, format) {
var gl = this.gl_ var gl = this.gl_
var tex = gl.createTexture() var tex = gl.createTexture()
gl.bindTexture(gl.TEXTURE_2D, tex) 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 gl = this.gl_
var tex = gl.createTexture() var tex = gl.createTexture()
gl.bindTexture(gl.TEXTURE_2D, tex) 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_ var gl = this.gl_
// draw scene // draw scene
gl.clearColor(0, 0, 0, 1) gl.clearColor(0, 0, 0, 1)
@ -171,7 +171,7 @@ Renderer.prototype.drawTexture = function (texture, width, height) {
* @return {WebGLShader} The new WebGLShader. * @return {WebGLShader} The new WebGLShader.
* @private * @private
*/ */
Renderer.prototype.compileShader_ = function (shaderSource, type) { Renderer.prototype.compileShader_ = function(shaderSource, type) {
var gl = this.gl_ var gl = this.gl_
var shader = gl.createShader(type) var shader = gl.createShader(type)
gl.shaderSource(shader, shaderSource) gl.shaderSource(shader, shaderSource)
@ -247,7 +247,7 @@ function WebGLRender(canvasElement) {
//this.setup() //this.setup()
} }
WebGLRender.prototype.setup = function () { WebGLRender.prototype.setup = function() {
// create shaders // create shaders
var vertexShaderSrc = var vertexShaderSrc =
'attribute vec2 aVertex;' + '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, image.width, image.height)
this.renderer.drawTexture(image, 643, 1149) this.renderer.drawTexture(image, 643, 1149)
} }
WebGLRender.prototype.drawOld = function (image) { WebGLRender.prototype.drawOld = function(image) {
var tex = this.ctx.createTexture() var tex = this.ctx.createTexture()
this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex) this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex)
this.ctx.texParameteri( this.ctx.texParameteri(
@ -354,7 +354,7 @@ WebGLRender.prototype.drawOld = function (image) {
this.ctx.vertexAttribPointer(this.tloc, 2, this.ctx.FLOAT, false, 0, 0) this.ctx.vertexAttribPointer(this.tloc, 2, this.ctx.FLOAT, false, 0, 0)
} }
WebGLRender.prototype.clear = function () { WebGLRender.prototype.clear = function() {
} }

View file

@ -1,3 +1,4 @@
/* eslint no-console: 0 */
var rotator = require('./rotator') var rotator = require('./rotator')
var tests = [ var tests = [

View file

@ -27,7 +27,7 @@ var mapping = {
module.exports = function rotator(oldRotation, newRotation) { module.exports = function rotator(oldRotation, newRotation) {
var r1 = oldRotation < 0 ? 360 + oldRotation % 360 : oldRotation % 360 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] return mapping[r1][r2]
} }

View file

@ -1,2 +1,2 @@
module.exports = angular.module('stf/scaling', []) module.exports = angular.module('stf/scaling', [])
.factory('ScalingService', require('./scaling-service')) .factory('ScalingService', require('./scaling-service'))

View file

@ -2,7 +2,7 @@ module.exports = function ScalingServiceFactory() {
var scalingService = { var scalingService = {
} }
scalingService.coordinator = function (realWidth, realHeight) { scalingService.coordinator = function(realWidth, realHeight) {
var realRatio = realWidth / realHeight var realRatio = realWidth / realHeight
/** /**
@ -48,7 +48,7 @@ module.exports = function ScalingServiceFactory() {
* |--------------|------|---------|---------|---------| * |--------------|------|---------|---------|---------|
*/ */
return { return {
coords: function (boundingW, boundingH, relX, relY, rotation) { coords: function(boundingW, boundingH, relX, relY, rotation) {
var w, h, x, y, ratio, scaledValue var w, h, x, y, ratio, scaledValue
switch (rotation) { switch (rotation) {
@ -138,7 +138,9 @@ module.exports = function ScalingServiceFactory() {
, yP: y / h , yP: y / h
} }
} }
, size: function (width, height) { , size: function(sizeWidth, sizeHeight) {
var width = sizeWidth
var height = sizeHeight
var ratio = width / height var ratio = width / height
if (realRatio > ratio) { if (realRatio > ratio) {
@ -171,7 +173,7 @@ module.exports = function ScalingServiceFactory() {
, height: height , height: height
} }
} }
, projectedSize: function (boundingW, boundingH, rotation) { , projectedSize: function(boundingW, boundingH, rotation) {
var w, h var w, h
switch (rotation) { switch (rotation) {

View file

@ -7,7 +7,7 @@ module.exports = function DeviceScreenCtrl(
$scope.displayError = false $scope.displayError = false
$scope.ScalingService = ScalingService $scope.ScalingService = ScalingService
$scope.installFile = function ($files) { $scope.installFile = function($files) {
return InstallService.installFile($scope.control, $files) return InstallService.installFile($scope.control, $files)
} }
} }

Some files were not shown because too many files have changed in this diff Show more