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

View file

@ -1,9 +1,29 @@
// TODO: Some day use eslint-plugin-angular
// https://github.com/Gillespie59/eslint-plugin-angular
{
"env": {
"commonjs": true,
"mocha": true,
"browser": true
"browser": true,
"node": false,
"jasmine": true,
"protractor": true
},
"rules": {
// TODO: for now lets just mute them
"comma-style": 0,
"padded-blocks": 0,
"no-unused-vars": 0,
"lines-around-comment": 0,
"no-use-before-define": 0,
"brace-style": 0,
"new-cap": 0,
"spaced-comment": 0,
"quote-props": 0,
"operator-linebreak": 0
},
"globals": {
"angular": 1,
"inject": 1,
"waitUrl": 1
}
}

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('angular')
require('angular-route')
require('angular-touch')

View file

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

View file

@ -11,7 +11,7 @@ module.exports =
var options = angular.extend({
}, parsedAttrs)
/* jshint unused: false */
/* eslint no-unused-vars: 0 */
var draggie = new DraggabillyService(element[0], options)
}
}

View file

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

View file

@ -1,13 +1,13 @@
describe('angularPackery', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('angularPackery', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

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

View file

@ -1,13 +1,13 @@
describe('basicMode', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('basicMode', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -39,9 +39,11 @@ module.exports = function BrowserInfoServiceFactory() {
var ua = navigator.userAgent
if (ua.match(/Android/i)) {
return 'android'
} else if (ua.match(/iPhone|iPad|iPod/i)) {
}
else if (ua.match(/iPhone|iPad|iPod/i)) {
return 'ios'
} else {
}
else {
return 'pc'
}
})

View file

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

View file

@ -1,13 +1,13 @@
describe('badgeIcon', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('badgeIcon', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('blurElement', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('blurElement', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -10,7 +10,7 @@ module.exports = function counterDirective($timeout) {
refreshInterval = 32
step = 0
scope.timoutId = null
countTo = parseInt(attrs.countTo) || 0
countTo = parseInt(attrs.countTo, 10) || 0
scope.value = parseInt(attrs.countFrom, 10) || 0
duration = parseFloat(attrs.duration) || 0
@ -28,7 +28,8 @@ module.exports = function counterDirective($timeout) {
$timeout.cancel(scope.timoutId)
num = countTo
el.innerText = countTo
} else {
}
else {
el.innerText = Math.round(num)
tick()
}
@ -50,7 +51,7 @@ module.exports = function counterDirective($timeout) {
}
})
attrs.$observe('countFrom', function (/*val*/) {
attrs.$observe('countFrom', function() {
start()
})

View file

@ -1,13 +1,13 @@
describe('counter', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('counter', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -15,7 +15,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) {
tElement.attr('method', 'post')
} else {
if (!tAttrs.method.match(/post/i)) {
console.error('Auto-fill only works with form POST method')
throw new Error('Auto-fill only works with form POST method')
}
}

View file

@ -1,13 +1,13 @@
describe('enableAutofill', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('enableAutofill', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('fallbackImage', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('fallbackImage', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('filterButton', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('filterButton', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('focusElement', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('focusElement', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('iconInsideInput', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('iconInsideInput', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('includeCached', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('includeCached', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,13 +1,13 @@
describe('ngEnter', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('ngEnter', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('niceTabs', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('niceTabs', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('refreshPage', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('refreshPage', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -5,7 +5,7 @@ module.exports = angular.module('stf.safe-apply', [])
'$delegate', function($delegate) {
$delegate.safeApply = function(fn) {
var phase = $delegate.$$phase
if (phase === "$apply" || phase === "$digest") {
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn()
}

View file

@ -1,13 +1,13 @@
describe('textFocusSelect', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('textFocusSelect', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('tooltips', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('tooltips', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -167,16 +167,16 @@ module.exports = function ControlServiceFactory(
this.testForward = function(forward) {
return sendTwoWay('forward.test', {
targetHost: forward.targetHost
, targetPort: +forward.targetPort
, targetPort: Number(forward.targetPort)
})
}
this.createForward = function(forward) {
return sendTwoWay('forward.create', {
id: forward.id
, devicePort: +forward.devicePort
, devicePort: Number(forward.devicePort)
, targetHost: forward.targetHost
, targetPort: +forward.targetPort
, targetPort: Number(forward.targetPort)
})
}
@ -227,13 +227,13 @@ module.exports = function ControlServiceFactory(
this.fsretrieve = function(file) {
return sendTwoWay('fs.retrieve', {
file: file,
file: file
})
}
this.fslist = function(dir) {
return sendTwoWay('fs.list', {
dir: dir,
dir: dir
})
}

View file

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

View file

@ -7,10 +7,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
function Tracker($scope, options) {
var devices = []
, devicesBySerial = Object.create(null)
, scopedSocket = socket.scoped($scope)
, digestTimer
, lastDigest
var devicesBySerial = Object.create(null)
var scopedSocket = socket.scoped($scope)
var digestTimer, lastDigest
$scope.$on('$destroy', function() {
clearTimeout(digestTimer)
@ -81,7 +80,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
var modify = function modify(data, newData) {
_.merge(data, newData, function(a, b) {
// New Arrays overwrite old Arrays
return _.isArray(b) ? b : undefined
if (_.isArray(b)) {
return b
}
})
sync(data)
this.emit('change', data)

View file

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

View file

@ -6,8 +6,8 @@ module.exports = function FilterStringServiceFactory() {
/**
* Filters integer
*
* @param searchValue
* @param str
* @param {string} searchValue Value to search
* @param {string} str Value to compare
* @returns {boolean} true if matched
*/
service.filterInteger = function(searchValue, str) {
@ -19,8 +19,8 @@ module.exports = function FilterStringServiceFactory() {
/**
* Filters string
*
* @param searchValue
* @param str
* @param {string} searchValue Value to search
* @param {string} str Value to compare
* @returns {boolean} true if matched
*/
service.filterString = function(searchValue, str) {

View file

@ -1,13 +1,13 @@
describe('imageOnload', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('imageOnload', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,10 +1,10 @@
module.exports = function installErrorFilter(gettext) {
/*jshint maxlen:200*/
/* eslint max-len:0 */
return function(text) {
switch (text) {
// Our error codes.
case "INSTALL_SUCCEEDED":
return gettext("Installation succeeded.")
case 'INSTALL_SUCCEEDED':
return gettext('Installation succeeded.')
case 'INSTALL_ERROR_UNKNOWN':
return gettext('Installation failed due to an unknown error.')
case 'INSTALL_ERROR_TIMEOUT':
@ -14,80 +14,80 @@ module.exports = function installErrorFilter(gettext) {
// Android PackageManager error codes from [1].
// [1] https://github.com/android/platform_frameworks_base/blob/
// master/core/java/android/content/pm/PackageManager.java
case "INSTALL_FAILED_ALREADY_EXISTS":
return gettext("The package is already installed.")
case "INSTALL_FAILED_INVALID_APK":
return gettext("The package archive file is invalid.")
case "INSTALL_FAILED_INVALID_URI":
return gettext("The URI passed in is invalid.")
case "INSTALL_FAILED_INSUFFICIENT_STORAGE":
case 'INSTALL_FAILED_ALREADY_EXISTS':
return gettext('The package is already installed.')
case 'INSTALL_FAILED_INVALID_APK':
return gettext('The package archive file is invalid.')
case 'INSTALL_FAILED_INVALID_URI':
return gettext('The URI passed in is invalid.')
case 'INSTALL_FAILED_INSUFFICIENT_STORAGE':
return gettext("The package manager service found that the device didn't have enough storage space to install the app.")
case "INSTALL_FAILED_DUPLICATE_PACKAGE":
return gettext("A package is already installed with the same name.")
case "INSTALL_FAILED_NO_SHARED_USER":
return gettext("The requested shared user does not exist.")
case "INSTALL_FAILED_UPDATE_INCOMPATIBLE":
case 'INSTALL_FAILED_DUPLICATE_PACKAGE':
return gettext('A package is already installed with the same name.')
case 'INSTALL_FAILED_NO_SHARED_USER':
return gettext('The requested shared user does not exist.')
case 'INSTALL_FAILED_UPDATE_INCOMPATIBLE':
return gettext("A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed).")
case "INSTALL_FAILED_MISSING_SHARED_LIBRARY":
return gettext("The new package uses a shared library that is not available.")
case "INSTALL_FAILED_REPLACE_COULDNT_DELETE":
return gettext("The existing package could not be deleted.")
case "INSTALL_FAILED_DEXOPT":
return gettext("The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.")
case "INSTALL_FAILED_OLDER_SDK":
return gettext("The new package failed because the current SDK version is older than that required by the package.")
case "INSTALL_FAILED_CONFLICTING_PROVIDER":
return gettext("The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.")
case "INSTALL_FAILED_NEWER_SDK":
return gettext("The new package failed because the current SDK version is newer than that required by the package.")
case "INSTALL_FAILED_TEST_ONLY":
return gettext("The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.")
case "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE":
case 'INSTALL_FAILED_MISSING_SHARED_LIBRARY':
return gettext('The new package uses a shared library that is not available.')
case 'INSTALL_FAILED_REPLACE_COULDNT_DELETE':
return gettext('The existing package could not be deleted.')
case 'INSTALL_FAILED_DEXOPT':
return gettext('The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.')
case 'INSTALL_FAILED_OLDER_SDK':
return gettext('The new package failed because the current SDK version is older than that required by the package.')
case 'INSTALL_FAILED_CONFLICTING_PROVIDER':
return gettext('The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.')
case 'INSTALL_FAILED_NEWER_SDK':
return gettext('The new package failed because the current SDK version is newer than that required by the package.')
case 'INSTALL_FAILED_TEST_ONLY':
return gettext('The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.')
case 'INSTALL_FAILED_CPU_ABI_INCOMPATIBLE':
return gettext("The package being installed contains native code, but none that is compatible with the device's CPU_ABI.")
case "INSTALL_FAILED_MISSING_FEATURE":
return gettext("The new package uses a feature that is not available.")
case "INSTALL_FAILED_CONTAINER_ERROR":
case 'INSTALL_FAILED_MISSING_FEATURE':
return gettext('The new package uses a feature that is not available.')
case 'INSTALL_FAILED_CONTAINER_ERROR':
return gettext("A secure container mount point couldn't be accessed on external media.")
case "INSTALL_FAILED_INVALID_INSTALL_LOCATION":
case 'INSTALL_FAILED_INVALID_INSTALL_LOCATION':
return gettext("The new package couldn't be installed in the specified install location.")
case "INSTALL_FAILED_MEDIA_UNAVAILABLE":
case 'INSTALL_FAILED_MEDIA_UNAVAILABLE':
return gettext("The new package couldn't be installed in the specified install location because the media is not available.")
case "INSTALL_FAILED_VERIFICATION_TIMEOUT":
case 'INSTALL_FAILED_VERIFICATION_TIMEOUT':
return gettext("The new package couldn't be installed because the verification timed out.")
case "INSTALL_FAILED_VERIFICATION_FAILURE":
case 'INSTALL_FAILED_VERIFICATION_FAILURE':
return gettext("The new package couldn't be installed because the verification did not succeed.")
case "INSTALL_FAILED_PACKAGE_CHANGED":
return gettext("The package changed from what the calling program expected.")
case "INSTALL_FAILED_UID_CHANGED":
return gettext("The new package is assigned a different UID than it previously held.")
case "INSTALL_FAILED_VERSION_DOWNGRADE":
return gettext("The new package has an older version code than the currently installed package.")
case "INSTALL_PARSE_FAILED_NOT_APK":
case 'INSTALL_FAILED_PACKAGE_CHANGED':
return gettext('The package changed from what the calling program expected.')
case 'INSTALL_FAILED_UID_CHANGED':
return gettext('The new package is assigned a different UID than it previously held.')
case 'INSTALL_FAILED_VERSION_DOWNGRADE':
return gettext('The new package has an older version code than the currently installed package.')
case 'INSTALL_PARSE_FAILED_NOT_APK':
return gettext("The parser was given a path that is not a file, or does not end with the expected '.apk' extension.")
case "INSTALL_PARSE_FAILED_BAD_MANIFEST":
return gettext("The parser was unable to retrieve the AndroidManifest.xml file.")
case "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION":
return gettext("The parser encountered an unexpected exception.")
case "INSTALL_PARSE_FAILED_NO_CERTIFICATES":
return gettext("The parser did not find any certificates in the .apk.")
case "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES":
return gettext("The parser found inconsistent certificates on the files in the .apk.")
case "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING":
return gettext("The parser encountered a CertificateEncodingException in one of the files in the .apk.")
case "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME":
return gettext("The parser encountered a bad or missing package name in the manifest.")
case "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID":
return gettext("The parser encountered a bad shared user id name in the manifest.")
case "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED":
return gettext("The parser encountered some structural problem in the manifest.")
case "INSTALL_PARSE_FAILED_MANIFEST_EMPTY":
return gettext("The parser did not find any actionable tags (instrumentation or application) in the manifest.")
case "INSTALL_FAILED_INTERNAL_ERROR":
return gettext("The system failed to install the package because of system issues.")
case "INSTALL_FAILED_USER_RESTRICTED":
return gettext("The system failed to install the package because the user is restricted from installing apps.")
case "INSTALL_FAILED_NO_MATCHING_ABIS":
return gettext("The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.")
case 'INSTALL_PARSE_FAILED_BAD_MANIFEST':
return gettext('The parser was unable to retrieve the AndroidManifest.xml file.')
case 'INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION':
return gettext('The parser encountered an unexpected exception.')
case 'INSTALL_PARSE_FAILED_NO_CERTIFICATES':
return gettext('The parser did not find any certificates in the .apk.')
case 'INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES':
return gettext('The parser found inconsistent certificates on the files in the .apk.')
case 'INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING':
return gettext('The parser encountered a CertificateEncodingException in one of the files in the .apk.')
case 'INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME':
return gettext('The parser encountered a bad or missing package name in the manifest.')
case 'INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID':
return gettext('The parser encountered a bad shared user id name in the manifest.')
case 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED':
return gettext('The parser encountered some structural problem in the manifest.')
case 'INSTALL_PARSE_FAILED_MANIFEST_EMPTY':
return gettext('The parser did not find any actionable tags (instrumentation or application) in the manifest.')
case 'INSTALL_FAILED_INTERNAL_ERROR':
return gettext('The system failed to install the package because of system issues.')
case 'INSTALL_FAILED_USER_RESTRICTED':
return gettext('The system failed to install the package because the user is restricted from installing apps.')
case 'INSTALL_FAILED_NO_MATCHING_ABIS':
return gettext('The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.')
default:
return gettext(text)
}

View file

@ -1,13 +1,13 @@
describe('landscape', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('landscape', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('logcatTable', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('logcatTable', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -29,8 +29,8 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
return _filters[prop]
},
set: function(value) {
_filters[prop] = value ? value : null
service.serverFilters[0][prop] = value ? value : undefined
_filters[prop] = value || null
service.serverFilters[0][prop] = value || undefined
service.filters.filterLines()
}
})

View file

@ -39,7 +39,7 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
}, 500)
$window.location.href = options.webUrl
break;
break
case 'USE_ON_BLUR':
// Doesn't work on Safari
@ -59,14 +59,14 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
$window.onblur = cachedWindowOnBlur
}, 250)
break;
break
case 'USE_TIME_ELAPSED':
// Doesn't work on Chrome
var start, end, elapsed
start = new Date().getTime()
console.log(' window.performance.webkitNow()', window.performance.now())
// console.log(' window.performance.webkitNow()', window.performance.now())
// This depends on the fact that JS is single-thread
document.location = options.nativeUrl
@ -79,7 +79,7 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
document.location = options.webUrl
}
break;
break
default:
}

View file

@ -8,10 +8,8 @@ module.exports = function ($location) {
link: function(scope, element, attrs) {
var links = element.find('a')
var onClass = attrs.navMenu || 'current'
var routePattern
var link
var url
var urlMap = []
var routePattern, link, url
if (!$location.$$html5) {
routePattern = /\/#[^/]*/

View file

@ -1,13 +1,13 @@
describe('navMenu', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('navMenu', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,3 +1,5 @@
/* eslint no-console: 0 */
var canvasElement = document.querySelector('canvas')
var frameNumberElement = document.querySelector('#frame-number')
var totalTimeElement = document.querySelector('#total-time')

View file

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

View file

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

View file

@ -138,7 +138,9 @@ module.exports = function ScalingServiceFactory() {
, yP: y / h
}
}
, size: function (width, height) {
, size: function(sizeWidth, sizeHeight) {
var width = sizeWidth
var height = sizeHeight
var ratio = width / height
if (realRatio > ratio) {

View file

@ -24,7 +24,7 @@ module.exports = function DeviceScreenDirective(
var cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
var device = scope.device()
, control = scope.control()
var control = scope.control()
var input = element.find('input')
@ -74,8 +74,8 @@ module.exports = function DeviceScreenDirective(
}
var canvas = element.find('canvas')[0]
, g = canvas.getContext('2d')
, positioner = element.find('div')[0]
var g = canvas.getContext('2d')
var positioner = element.find('div')[0]
function vendorBackingStorePixelRatio(g) {
return g.webkitBackingStorePixelRatio ||
@ -86,8 +86,8 @@ module.exports = function DeviceScreenDirective(
}
var devicePixelRatio = window.devicePixelRatio || 1
, backingStoreRatio = vendorBackingStorePixelRatio(g)
, frontBackRatio = devicePixelRatio / backingStoreRatio
var backingStoreRatio = vendorBackingStorePixelRatio(g)
var frontBackRatio = devicePixelRatio / backingStoreRatio
var options = {
autoScaleForRetina: true
@ -101,8 +101,8 @@ module.exports = function DeviceScreenDirective(
function updateBounds() {
function adjustBoundedSize(w, h) {
var sw = w * options.density
, sh = h * options.density
, f
var sh = h * options.density
var f
if (sw < (f = device.display.width * options.minscale)) {
sw *= f / sw
@ -122,7 +122,7 @@ module.exports = function DeviceScreenDirective(
// FIXME: element is an object HTMLUnknownElement in IE9
var w = screen.bounds.w = element[0].offsetWidth
, h = screen.bounds.h = element[0].offsetHeight
var h = screen.bounds.h = element[0].offsetHeight
// Developer error, let's try to reduce debug time
if (!w || !h) {
@ -144,9 +144,9 @@ module.exports = function DeviceScreenDirective(
}
})()
if (!adjustedBoundSize
|| newAdjustedBoundSize.w !== adjustedBoundSize.w
|| newAdjustedBoundSize.h !== adjustedBoundSize.h) {
if (!adjustedBoundSize ||
newAdjustedBoundSize.w !== adjustedBoundSize.w ||
newAdjustedBoundSize.h !== adjustedBoundSize.h) {
adjustedBoundSize = newAdjustedBoundSize
onScreenInterestAreaChanged()
}
@ -215,10 +215,10 @@ module.exports = function DeviceScreenDirective(
}
var cachedImageWidth = 0
, cachedImageHeight = 0
, cssRotation = 0
, alwaysUpright = false
, imagePool = new ImagePool(10)
var cachedImageHeight = 0
var cssRotation = 0
var alwaysUpright = false
var imagePool = new ImagePool(10)
function applyQuirks(banner) {
element[0].classList.toggle(
@ -371,7 +371,7 @@ module.exports = function DeviceScreenDirective(
})
var canvasAspect = 1
, parentAspect = 1
var parentAspect = 1
function resizeListener() {
parentAspect = element[0].offsetWidth / element[0].offsetHeight
@ -513,12 +513,12 @@ module.exports = function DeviceScreenDirective(
*/
;(function() {
var slots = []
, slotted = Object.create(null)
, fingers = []
, seq = -1
, cycle = 100
, fakePinch = false
, lastPossiblyBuggyMouseUpEvent = 0
var slotted = Object.create(null)
var fingers = []
var seq = -1
var cycle = 100
var fakePinch = false
var lastPossiblyBuggyMouseUpEvent = 0
function nextSeq() {
return ++seq >= cycle ? (seq = 0) : seq
@ -575,7 +575,8 @@ module.exports = function DeviceScreenDirective(
}
}
function mouseDownListener(e) {
function mouseDownListener(event) {
var e = event
if (e.originalEvent) {
e = e.originalEvent
}
@ -593,9 +594,9 @@ module.exports = function DeviceScreenDirective(
startMousing()
var x = e.pageX - screen.bounds.x
, y = e.pageY - screen.bounds.y
, pressure = 0.5
, scaled = scaler.coords(
var y = e.pageY - screen.bounds.y
var pressure = 0.5
var scaled = scaler.coords(
screen.bounds.w
, screen.bounds.h
, x
@ -634,7 +635,8 @@ module.exports = function DeviceScreenDirective(
}
}
function mouseMoveListener(e) {
function mouseMoveListener(event) {
var e = event
if (e.originalEvent) {
e = e.originalEvent
}
@ -651,9 +653,9 @@ module.exports = function DeviceScreenDirective(
fakePinch = e.altKey
var x = e.pageX - screen.bounds.x
, y = e.pageY - screen.bounds.y
, pressure = 0.5
, scaled = scaler.coords(
var y = e.pageY - screen.bounds.y
var pressure = 0.5
var scaled = scaler.coords(
screen.bounds.w
, screen.bounds.h
, x
@ -686,7 +688,8 @@ module.exports = function DeviceScreenDirective(
}
}
function mouseUpListener(e) {
function mouseUpListener(event) {
var e = event
if (e.originalEvent) {
e = e.originalEvent
}
@ -782,7 +785,8 @@ module.exports = function DeviceScreenDirective(
control.gestureStop(nextSeq())
}
function touchStartListener(e) {
function touchStartListener(event) {
var e = event
e.preventDefault()
//Make it jQuery compatible also
@ -800,7 +804,7 @@ module.exports = function DeviceScreenDirective(
var i, l
for (i = 0, l = e.touches.length; i < l; ++i) {
currentTouches[e.touches[i].identifier] = 1;
currentTouches[e.touches[i].identifier] = 1
}
function maybeLostTouchEnd(id) {
@ -827,11 +831,11 @@ module.exports = function DeviceScreenDirective(
for (i = 0, l = e.changedTouches.length; i < l; ++i) {
var touch = e.changedTouches[i]
, slot = slots.pop()
, x = touch.pageX - screen.bounds.x
, y = touch.pageY - screen.bounds.y
, pressure = touch.force || 0.5
, scaled = scaler.coords(
var slot = slots.pop()
var x = touch.pageX - screen.bounds.x
var y = touch.pageY - screen.bounds.y
var pressure = touch.force || 0.5
var scaled = scaler.coords(
screen.bounds.w
, screen.bounds.h
, x
@ -851,7 +855,8 @@ module.exports = function DeviceScreenDirective(
control.touchCommit(nextSeq())
}
function touchMoveListener(e) {
function touchMoveListener(event) {
var e = event
e.preventDefault()
if (e.originalEvent) {
@ -860,11 +865,11 @@ module.exports = function DeviceScreenDirective(
for (var i = 0, l = e.changedTouches.length; i < l; ++i) {
var touch = e.changedTouches[i]
, slot = slotted[touch.identifier]
, x = touch.pageX - screen.bounds.x
, y = touch.pageY - screen.bounds.y
, pressure = touch.force || 0.5
, scaled = scaler.coords(
var slot = slotted[touch.identifier]
var x = touch.pageX - screen.bounds.x
var y = touch.pageY - screen.bounds.y
var pressure = touch.force || 0.5
var scaled = scaler.coords(
screen.bounds.w
, screen.bounds.h
, x
@ -879,7 +884,8 @@ module.exports = function DeviceScreenDirective(
control.touchCommit(nextSeq())
}
function touchEndListener(e) {
function touchEndListener(event) {
var e = event
if (e.originalEvent) {
e = e.originalEvent
}
@ -888,8 +894,8 @@ module.exports = function DeviceScreenDirective(
for (var i = 0, l = e.changedTouches.length; i < l; ++i) {
var touch = e.changedTouches[i]
, slot = slotted[touch.identifier]
if (slot === void 0) {
var slot = slotted[touch.identifier]
if (typeof slot === 'undefined') {
// We've already disposed of the contact. We may have gotten a
// touchend event for the same contact twice.
continue

View file

@ -1,13 +1,13 @@
describe('screenKeyboard', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('screenKeyboard', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -1,13 +1,13 @@
describe('screenTouch', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('screenTouch', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -8,14 +8,14 @@ module.exports = function SettingsServiceFactory(
var SettingsService = {}
var settings = UserService.currentUser.settings || {}
, syncListeners = []
var syncListeners = []
function createListener(object, options, monitor) {
var source = options.source || options.target
return function() {
var value = object[options.target] = (source in settings)
? settings[source]
: options.defaultValue
var value = object[options.target] = (source in settings) ?
settings[source] :
options.defaultValue
if (monitor) {
monitor(value)
@ -28,7 +28,9 @@ module.exports = function SettingsServiceFactory(
$rootScope.safeApply(function() {
_.merge(settings, delta, function(a, b) {
// New Arrays overwrite old Arrays
return _.isArray(b) ? b : undefined
if (_.isArray(b)) {
return b
}
})
for (var i = 0, l = syncListeners.length; i < l; ++i) {
@ -60,11 +62,11 @@ module.exports = function SettingsServiceFactory(
SettingsService.bind = function(scope, options) {
function value(possibleValue, defaultValue) {
return (possibleValue !== void 0) ? possibleValue : defaultValue
return (typeof possibleValue !== 'undefined') ? possibleValue : defaultValue
}
var source = options.source || options.target
, defaultValue = value(options.defaultValue, scope[options.target])
var defaultValue = value(options.defaultValue, scope[options.target])
scope.$watch(
options.target

View file

@ -12,7 +12,7 @@ module.exports = angular.module('stf/socket/socket-state', [
'$delegate', function($delegate) {
$delegate.safeApply = function(fn) {
var phase = $delegate.$$phase
if (phase === "$apply" || phase === "$digest") {
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn()
}

View file

@ -46,30 +46,30 @@ module.exports = function SocketStateDirectiveFactory(
}
var socketListeners = {
'connect': function () {
connect: function() {
setState('connect')
}
, 'disconnect': function () {
, disconnect: function() {
setState('disconnect')
hasFailedOnce = true
}
, 'error': function () {
, error: function() {
setState('error')
hasFailedOnce = true
}
, 'connect_error': function () {
, connect_error: function() {
setState('connect_error')
hasFailedOnce = true
}
, 'reconnect_error': function () {
, reconnect_error: function() {
setState('reconnect_error')
hasFailedOnce = true
}
, 'reconnect_failed': function () {
, reconnect_failed: function() {
setState('reconnect_failed')
hasFailedOnce = true
}
, 'reconnect': function () {
, reconnect: function() {
setState('reconnect')
hasFailedOnce = true
}

View file

@ -7,7 +7,7 @@ module.exports = angular.module('device-control.standalone', [
require('stf/settings').name,
require('stf/screen/scaling').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/device-control/standalone/standalone.jade',
require('./standalone.jade')
)

View file

@ -1,13 +1,13 @@
describe('textHistory', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('textHistory', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

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

View file

@ -19,7 +19,7 @@ module.exports = function timelineMessageDirective(Timelines, $sce, $interpolate
var e,
html,
interpolateFn,
safeHtml;
safeHtml
// Create temporary wrapper element so we can grab the inner html
e = angular.element(document.createElement('div'))

View file

@ -1,13 +1,13 @@
describe('timelineMessage', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('timelineMessage', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -5,8 +5,8 @@ module.exports = function timelinesDirective(Timelines) {
scope: {},
template: require('./timelines.jade'),
link: function(scope) {
scope.cssPrefix = Timelines.options.cssPrefix;
scope.notifications = Timelines.notifications;
scope.cssPrefix = Timelines.options.cssPrefix
scope.notifications = Timelines.notifications
}
}
}

View file

@ -1,13 +1,13 @@
describe('timelines', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function() {
@ -19,5 +19,5 @@ describe('timelines', function () {
expect(element.text()).toBe('hello, world');
*/
});
});
})
})

View file

@ -3,7 +3,7 @@ module.exports = function generateAccessTokenDirective() {
restrict: 'EA',
replace: true,
scope: {
showGenerate: '=',
showGenerate: '='
},
template: require('./generate-access-token.jade'),
controller: function($scope, AccessTokenService) {

View file

@ -1,4 +1,4 @@
module.exports = angular.module('stf.tokens', [
require('./generate-access-token').name,
require('./generate-access-token').name
])
.factory('AccessTokenService', require('./access-token-service'))

View file

@ -4,7 +4,7 @@ function TransactionError(result) {
Error.captureStackTrace(this, TransactionError)
}
TransactionError.prototype = Object.create(Error.prototype);
TransactionError.prototype.constructor = TransactionError;
TransactionError.prototype = Object.create(Error.prototype)
TransactionError.prototype.constructor = TransactionError
module.exports = TransactionError

View file

@ -10,8 +10,8 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) {
function MultiTargetTransaction(targets, options) {
var pending = Object.create(null)
, results = []
, channel = createChannel()
var results = []
var channel = createChannel()
function doneListener(someChannel, data) {
if (someChannel === channel) {
@ -62,8 +62,8 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) {
function SingleTargetTransaction(target, options) {
var result = new options.result(target)
, pending = new PendingTransactionResult(result)
, channel = createChannel()
var pending = new PendingTransactionResult(result)
var channel = createChannel()
function doneListener(someChannel, data) {
if (someChannel === channel) {
@ -107,16 +107,16 @@ module.exports = function TransactionServiceFactory(socket, TransactionError) {
function PendingTransactionResult(result) {
var resolver = Promise.defer()
, seq = 0
, last = Infinity
, unplaced = []
var seq = 0
var last = Infinity
var unplaced = []
function readQueue() {
var message
, foundAny = false
var foundAny = false
while (seq <= last && (message = unplaced[seq])) {
unplaced[seq] = void 0
unplaced[seq] = undefined
if (seq === last) {
result.success = message.success

View file

@ -1,10 +1,10 @@
module.exports = function uploadErrorFilter(gettext) {
return function(text) {
return {
'fail_invalid_app_file': gettext('Uploaded file is not valid'),
'fail_download': gettext('Failed to download file'),
'fail_invalid_url': gettext('Cannot access specified URL'),
'fail': gettext('Upload failed')
fail_invalid_app_file: gettext('Uploaded file is not valid'),
fail_download: gettext('Failed to download file'),
fail_invalid_url: gettext('Cannot access specified URL'),
fail: gettext('Upload failed')
}[text] || gettext('Upload unknown error')
}
}

View file

@ -4,7 +4,7 @@ module.exports = function VendorUtilFactory() {
vendorUtil.style = function(props) {
var testee = document.createElement('span')
for (var i = 0, l = props.length; i < l; ++i) {
if (testee.style[props[i]] !== void 0) {
if (typeof testee.style[props[i]] !== 'undefined') {
return props[i]
}
}

View file

@ -1,17 +1,17 @@
describe('ActivityCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('ActivityCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('ActivityCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -5,7 +5,7 @@ module.exports = angular.module('stf.activity', [
require('stf/common-ui').name,
require('stf/timeline').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/activity/activity.jade',
require('./activity.jade')
)

View file

@ -1,17 +1,17 @@
describe('AdvancedCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('AdvancedCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('AdvancedCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -8,7 +8,7 @@ module.exports = angular.module('stf.advanced', [
require('./port-forwarding').name,
require('./maintenance').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/advanced/advanced.jade',
require('./advanced.jade')
)

View file

@ -2,7 +2,7 @@ require('./input.css')
module.exports = angular.module('stf.advanced.input', [
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/advanced/input/input.jade',
require('./input.jade')
)

View file

@ -1,17 +1,17 @@
describe('InputAdvancedCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('InputAdvancedCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('InputAdvancedCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -1,7 +1,7 @@
module.exports = angular.module('stf.advanced.maintenance', [
require('gettext').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/advanced/maintenance/maintenance.jade',
require('./maintenance.jade')
)

View file

@ -5,6 +5,7 @@ module.exports = function ($scope, gettext, $filter) {
rebootEnabled: true
}
/* eslint no-console: 0 */
if (config.rebootEnabled) {
var line1 = $filter('translate')(gettext('Are you sure you want to reboot this device?'))
var line2 = $filter('translate')(gettext('The device will be unavailable for a moment.'))

View file

@ -1,17 +1,17 @@
describe('MaintenanceCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('MaintenanceCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('MaintenanceCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -5,7 +5,7 @@ module.exports = angular.module('stf.port-forwarding', [
require('stf/settings').name,
require('gettext').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put(
'control-panes/advanced/port-forwarding/port-forwarding.jade',
require('./port-forwarding.jade')

View file

@ -34,14 +34,14 @@ module.exports = function PortForwardingCtrl(
$scope.reversePortForwards.forEach(function(forward) {
var deviceForward = map[forward.id]
forward.enabled = !!(deviceForward && deviceForward.id === forward.id &&
deviceForward.devicePort == forward.devicePort)
deviceForward.devicePort === forward.devicePort)
})
})
$scope.applyForward = function(forward) {
return forward.enabled
? $scope.control.createForward(forward)
: $scope.control.removeForward(forward)
return forward.enabled ?
$scope.control.createForward(forward) :
$scope.control.removeForward(forward)
}
$scope.enableForward = function(forward) {

View file

@ -1,17 +1,17 @@
describe('PortForwardingCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('PortForwardingCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('PortForwardingCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -3,7 +3,7 @@ require('./run-js.css')
module.exports = angular.module('stf.run-js', [
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/advanced/run-js/run-js.jade',
require('./run-js.jade')
)

View file

@ -1,17 +1,17 @@
describe('RunJsCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('RunJsCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('RunJsCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -3,7 +3,7 @@ require('./usb.css')
module.exports = angular.module('stf.usb', [
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/advanced/usb/usb.jade',
require('./usb.jade')
)

View file

@ -1,17 +1,17 @@
describe('UsbCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('UsbCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('UsbCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -3,7 +3,7 @@ require('./vnc.css')
module.exports = angular.module('stf.vnc', [
require('gettext').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put(
'control-panes/advanced/vnc/vnc.jade',
require('./vnc.jade')

View file

@ -1,17 +1,17 @@
describe('VNCCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('VNCCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('VNCCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -1,17 +1,17 @@
describe('DeviceSettingsCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('DeviceSettingsCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('DeviceSettingsCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -3,7 +3,7 @@ require('./device-settings.css')
module.exports = angular.module('stf.device-settings', [
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/automation/device-settings/device-settings.jade',
require('./device-settings.jade')
)

View file

@ -2,7 +2,7 @@ module.exports = angular.module('stf.automation', [
require('./store-account').name,
require('./device-settings').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put(
'control-panes/automation/automation.jade'
, require('./automation.jade')

View file

@ -5,7 +5,7 @@ module.exports = angular.module('stf.store-account', [
'angular-ladda',
require('stf/common-ui/table').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/automation/store-account/store-account.jade',
require('./store-account.jade')
)

View file

@ -2,10 +2,10 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) {
// TODO: This should come from the DB
$scope.currentAppStore = 'google-play-store'
$scope.deviceAppStores = {
"google-play-store": {
"type": 'google-play-store',
"name": 'Google Play Store',
"package": 'com.google'
'google-play-store': {
type: 'google-play-store',
name: 'Google Play Store',
package: 'com.google'
}
}
@ -18,7 +18,7 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) {
$scope.control.addAccount(user, pass).then(function() {
}).catch(function(result) {
console.log('Adding account failed', result)
throw new Error('Adding account failed', result)
}).finally(function() {
$scope.addingAccount = false
$timeout(function() {
@ -34,7 +34,7 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) {
getAccounts()
})
.catch(function(result) {
console.log('Removing account failed', result)
throw new Error('Removing account failed', result)
})
}

View file

@ -1,17 +1,17 @@
describe('StoreAccountCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('StoreAccountCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('StoreAccountCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -6,10 +6,10 @@ module.exports =
var actions = {
previousDevice: function() {
console.log('prev')
// console.log('prev')
},
nextDevice: function() {
console.log('next')
// console.log('next')
},
deviceList: function() {
$location.path('/devices/')
@ -53,7 +53,7 @@ module.exports =
},
focusUrlBar: function() {
// TODO: Switch tab and focus
console.log('focus')
// console.log('focus')
},
takeScreenShot: function() {
// TODO: Switch tab and take screenshot

View file

@ -1,17 +1,17 @@
describe('CpuCtrl', function() {
beforeEach(angular.mock.module(require('./').name));
beforeEach(angular.mock.module(require('./').name))
var scope, ctrl;
var scope, ctrl
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('CpuCtrl', {$scope: scope});
}));
scope = $rootScope.$new()
ctrl = $controller('CpuCtrl', {$scope: scope})
}))
it('should ...', inject(function() {
expect(1).toEqual(1);
expect(1).toEqual(1)
}));
}))
});
})

View file

@ -3,7 +3,7 @@ require('./cpu.css')
module.exports = angular.module('stf.cpu', [
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/cpu/cpu.jade',
require('./cpu.jade')
)

View file

@ -3,12 +3,13 @@
module.exports = function ShellCtrl($scope) {
$scope.result = null
var run = function (command) {
var run = function(cmd) {
var command = cmd
// Force run activity
command += ' --activity-clear-top'
return $scope.control.shell(command)
.then(function(result) {
console.log(result)
// console.log(result)
})
}

View file

@ -3,7 +3,7 @@ require('./apps.css')
module.exports = angular.module('stf.apps', [
require('stf/common-ui').name
])
.run(["$templateCache", function ($templateCache) {
.run(['$templateCache', function($templateCache) {
$templateCache.put('control-panes/dashboard/apps/apps.jade',
require('./apps.jade')
)

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