mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Fix all res/ files with ESLint rules with 0 errors.
This commit is contained in:
parent
1006564ae7
commit
a3f815c118
258 changed files with 1634 additions and 1634 deletions
|
@ -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}],
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
require.ensure([], function (require) {
|
||||
|
||||
require.ensure([], function(require) {
|
||||
require('angular')
|
||||
require('angular-route')
|
||||
require('angular-touch')
|
||||
|
@ -19,7 +18,7 @@ require.ensure([], function (require) {
|
|||
require('./../common/lang').name,
|
||||
require('stf/standalone').name
|
||||
])
|
||||
.config(function ($routeProvider, $locationProvider) {
|
||||
.config(function($routeProvider, $locationProvider) {
|
||||
$locationProvider.hashPrefix('!')
|
||||
$routeProvider
|
||||
.otherwise({
|
||||
|
@ -27,7 +26,7 @@ require.ensure([], function (require) {
|
|||
})
|
||||
})
|
||||
|
||||
.config(function (hotkeysProvider) {
|
||||
.config(function(hotkeysProvider) {
|
||||
hotkeysProvider.templateTitle = 'Keyboard Shortcuts:'
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function adminModeDirective($rootScope, SettingsService) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
link: function () {
|
||||
link: function() {
|
||||
SettingsService.bind($rootScope, {
|
||||
target: 'adminMode',
|
||||
defaultValue: false
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
describe('AdminModeService', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports =
|
|||
function angularDraggabillyDirective(DraggabillyService, $parse) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var parsedAttrs = $parse(attrs.angularDraggabilly)()
|
||||
if (typeof parsedAttrs !== 'object') {
|
||||
parsedAttrs = {}
|
||||
|
@ -11,7 +11,7 @@ module.exports =
|
|||
var options = angular.extend({
|
||||
}, parsedAttrs)
|
||||
|
||||
/* jshint unused: false */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
var draggie = new DraggabillyService(element[0], options)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
describe('angularDraggabilly', function () {
|
||||
describe('angularDraggabilly', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
|
||||
it('should ...', function () {
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function() {
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
send that through compile() then compare the results.
|
||||
|
||||
var element = compile('<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')
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@ var draggabilly = require('draggabilly')
|
|||
module.exports = angular.module('stf.angular-draggabilly', [
|
||||
|
||||
])
|
||||
.factory('DraggabillyService', function () {
|
||||
.factory('DraggabillyService', function() {
|
||||
return draggabilly
|
||||
})
|
||||
.directive('angularDraggabilly', require('./angular-draggabilly-directive'))
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function angularPackeryDirective(PackeryService,
|
|||
|
||||
return {
|
||||
restrict: 'AE',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var container = element[0]
|
||||
var parsedAttrs = $parse(attrs.angularPackery)()
|
||||
if (typeof parsedAttrs !== 'object') {
|
||||
|
@ -24,10 +24,10 @@ module.exports = function angularPackeryDirective(PackeryService,
|
|||
pckry.bindResize()
|
||||
bindDraggable()
|
||||
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
pckry.layout()
|
||||
}, 0)
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
pckry.layout()
|
||||
}, 100)
|
||||
|
||||
|
@ -56,7 +56,7 @@ module.exports = function angularPackeryDirective(PackeryService,
|
|||
|
||||
scope.$on('panelsResized', _.throttle(onPanelsResized, 300))
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
scope.$on('$destroy', function() {
|
||||
pckry.unbindResize()
|
||||
pckry.off('layoutComplete', onLayoutComplete)
|
||||
pckry.destroy()
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('angularPackery', function () {
|
||||
describe('angularPackery', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('angularPackery', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@ var packery = require('packery/js/packery.js')
|
|||
module.exports = angular.module('stf.angular-packery', [
|
||||
require('stf/angular-draggabilly').name
|
||||
])
|
||||
.factory('PackeryService', function () {
|
||||
.factory('PackeryService', function() {
|
||||
return packery
|
||||
})
|
||||
.directive('angularPackery', require('./angular-packery-directive'))
|
||||
|
|
|
@ -8,16 +8,16 @@ module.exports = function AppStateProvider() {
|
|||
}
|
||||
}
|
||||
|
||||
/*globals GLOBAL_APPSTATE:false*/
|
||||
/* global GLOBAL_APPSTATE:false */
|
||||
if (typeof GLOBAL_APPSTATE !== 'undefined') {
|
||||
values = angular.extend(values, GLOBAL_APPSTATE)
|
||||
}
|
||||
|
||||
return {
|
||||
set: function (constants) {
|
||||
set: function(constants) {
|
||||
angular.extend(values, constants)
|
||||
},
|
||||
$get: function () {
|
||||
$get: function() {
|
||||
return values
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function basicModeDirective($rootScope, BrowserInfo) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
link: function (scope, element) {
|
||||
link: function(scope, element) {
|
||||
$rootScope.basicMode = !!BrowserInfo.mobile
|
||||
if ($rootScope.basicMode) {
|
||||
element.addClass('basic-mode')
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('basicMode', function () {
|
||||
describe('basicMode', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('basicMode', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -10,12 +10,12 @@ module.exports = function BrowserInfoServiceFactory() {
|
|||
service[key] = (typeof test == 'function') ? test() : test
|
||||
}
|
||||
|
||||
addTest('touch', function () {
|
||||
addTest('touch', function() {
|
||||
return ('ontouchstart' in window) || window.DocumentTouch &&
|
||||
document instanceof window.DocumentTouch
|
||||
})
|
||||
|
||||
addTest('retina', function () {
|
||||
addTest('retina', function() {
|
||||
var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), ' +
|
||||
'(min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), ' +
|
||||
'(min-resolution: 1.5dppx)'
|
||||
|
@ -25,28 +25,30 @@ module.exports = function BrowserInfoServiceFactory() {
|
|||
return !!(window.matchMedia && window.matchMedia(mediaQuery).matches)
|
||||
})
|
||||
|
||||
addTest('small', function () {
|
||||
addTest('small', function() {
|
||||
var windowWidth = window.screen.width < window.outerWidth ?
|
||||
window.screen.width : window.outerWidth
|
||||
return windowWidth < 800
|
||||
})
|
||||
|
||||
addTest('mobile', function () {
|
||||
addTest('mobile', function() {
|
||||
return !!(service.small && service.touch)
|
||||
})
|
||||
|
||||
addTest('os', function () {
|
||||
addTest('os', function() {
|
||||
var ua = navigator.userAgent
|
||||
if (ua.match(/Android/i)) {
|
||||
return 'android'
|
||||
} else if (ua.match(/iPhone|iPad|iPod/i)) {
|
||||
}
|
||||
else if (ua.match(/iPhone|iPad|iPod/i)) {
|
||||
return 'ios'
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return 'pc'
|
||||
}
|
||||
})
|
||||
|
||||
addTest('webgl', function () {
|
||||
addTest('webgl', function() {
|
||||
var canvas = createElement('canvas')
|
||||
if ('supportsContext' in canvas) {
|
||||
return canvas.supportsContext('webgl') ||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('BrowserInfo', function() {
|
|||
|
||||
it('should ...', inject(function() {
|
||||
|
||||
//expect(BrowserInfo.doSomething()).toEqual('something');
|
||||
// expect(BrowserInfo.doSomething()).toEqual('something')
|
||||
|
||||
}))
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function badgeIconDirective() {
|
|||
scope: {
|
||||
},
|
||||
template: require('./badge-icon.jade'),
|
||||
link: function () {
|
||||
link: function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('badgeIcon', function () {
|
||||
describe('badgeIcon', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('badgeIcon', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
module.exports = function blurElementDirective($parse, $timeout) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var model = $parse(attrs.blurElement)
|
||||
|
||||
scope.$watch(model, function (value) {
|
||||
scope.$watch(model, function(value) {
|
||||
if (value === true) {
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
element[0].blur()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
element.bind('blur', function () {
|
||||
element.bind('blur', function() {
|
||||
scope.$apply(model.assign(scope, false))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('blurElement', function () {
|
||||
describe('blurElement', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('blurElement', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
describe('clearButton', function () {
|
||||
describe('clearButton', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should display a text label', function () {
|
||||
it('should display a text label', function() {
|
||||
var element = compile('<clear-button />')(scope)
|
||||
expect(element.find('span').text()).toBe('Clear')
|
||||
})
|
||||
|
||||
it('should display a trash icon', function () {
|
||||
it('should display a trash icon', function() {
|
||||
var element = compile('<clear-button />')(scope)
|
||||
expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o')
|
||||
})
|
||||
|
|
|
@ -2,15 +2,15 @@ module.exports = function counterDirective($timeout) {
|
|||
return {
|
||||
replace: false,
|
||||
scope: true,
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var el = element[0]
|
||||
var num, refreshInterval, duration, steps, step, countTo, increment
|
||||
|
||||
var calculate = function () {
|
||||
var calculate = function() {
|
||||
refreshInterval = 32
|
||||
step = 0
|
||||
scope.timoutId = null
|
||||
countTo = parseInt(attrs.countTo) || 0
|
||||
countTo = parseInt(attrs.countTo, 10) || 0
|
||||
scope.value = parseInt(attrs.countFrom, 10) || 0
|
||||
duration = parseFloat(attrs.duration) || 0
|
||||
|
||||
|
@ -20,15 +20,16 @@ module.exports = function counterDirective($timeout) {
|
|||
num = scope.value
|
||||
}
|
||||
|
||||
var tick = function () {
|
||||
scope.timoutId = $timeout(function () {
|
||||
var tick = function() {
|
||||
scope.timoutId = $timeout(function() {
|
||||
num += increment
|
||||
step++
|
||||
if (step >= steps) {
|
||||
$timeout.cancel(scope.timoutId)
|
||||
num = countTo
|
||||
el.innerText = countTo
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
el.innerText = Math.round(num)
|
||||
tick()
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ module.exports = function counterDirective($timeout) {
|
|||
|
||||
}
|
||||
|
||||
var start = function () {
|
||||
var start = function() {
|
||||
if (scope.timoutId) {
|
||||
$timeout.cancel(scope.timoutId)
|
||||
}
|
||||
|
@ -44,13 +45,13 @@ module.exports = function counterDirective($timeout) {
|
|||
tick()
|
||||
}
|
||||
|
||||
attrs.$observe('countTo', function (val) {
|
||||
attrs.$observe('countTo', function(val) {
|
||||
if (val) {
|
||||
start()
|
||||
}
|
||||
})
|
||||
|
||||
attrs.$observe('countFrom', function (/*val*/) {
|
||||
attrs.$observe('countFrom', function() {
|
||||
start()
|
||||
})
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('counter', function () {
|
||||
describe('counter', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('counter', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) {
|
|||
tElement.attr('method', 'post')
|
||||
} else {
|
||||
if (!tAttrs.method.match(/post/i)) {
|
||||
console.error('Auto-fill only works with form POST method')
|
||||
throw new Error('Auto-fill only works with form POST method')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ module.exports = function enableAutofillDirective($rootElement, $cookies) {
|
|||
}
|
||||
|
||||
return {
|
||||
pre: function (scope, element, attrs) {
|
||||
pre: function(scope, element, attrs) {
|
||||
// Angular needs this so the form action doesn't get removed
|
||||
// Also, trying to set a url at this time doesn't work neither
|
||||
attrs.action = ''
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('enableAutofill', function () {
|
||||
describe('enableAutofill', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('enableAutofill', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = function errorMessageDirective() {
|
|||
message: '@'
|
||||
},
|
||||
template: require('./error-message.jade'),
|
||||
link: function (scope) {
|
||||
scope.closeMessage = function () {
|
||||
link: function(scope) {
|
||||
scope.closeMessage = function() {
|
||||
scope.message = ''
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('errorMessage', function () {
|
||||
describe('errorMessage', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./index').name))
|
||||
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('fallbackImage', function () {
|
||||
describe('fallbackImage', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('fallbackImage', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('filterButton', function () {
|
||||
describe('filterButton', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your
|
||||
|
@ -19,5 +19,5 @@ describe('filterButton', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
module.exports = function focusElementDirective($parse, $timeout) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var model = $parse(attrs.focusElement)
|
||||
|
||||
scope.$watch(model, function (value) {
|
||||
scope.$watch(model, function(value) {
|
||||
if (value === true) {
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
element[0].focus()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
element.bind('blur', function () {
|
||||
element.bind('blur', function() {
|
||||
if (model && model.assign) {
|
||||
scope.$apply(model.assign(scope, false))
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('focusElement', function () {
|
||||
describe('focusElement', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('focusElement', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function iconInsideInputDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
// NOTE: this doesn't work on Chrome with auto-fill, known Chrome bug
|
||||
element.css({
|
||||
'background-repeat': 'no-repeat',
|
||||
|
@ -11,7 +11,7 @@ module.exports = function iconInsideInputDirective() {
|
|||
|
||||
attrs.$observe('iconInsideInput', function(value) {
|
||||
element.css({
|
||||
'background-image': 'url(' + value +')'
|
||||
'background-image': 'url(' + value + ')'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('iconInsideInput', function () {
|
||||
describe('iconInsideInput', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('iconInsideInput', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
module.exports = function ($http, $templateCache, $compile) {
|
||||
module.exports = function($http, $templateCache, $compile) {
|
||||
var cache = {}
|
||||
|
||||
return function (src, scope, cloneAttachFn) {
|
||||
return function(src, scope, cloneAttachFn) {
|
||||
var compileFn = cache[src]
|
||||
if (compileFn) {
|
||||
compileFn(scope, cloneAttachFn)
|
||||
} else {
|
||||
$http.get(src, { cache: $templateCache }).success(function (response) {
|
||||
$http.get(src, {cache: $templateCache}).success(function(response) {
|
||||
var responseContents = angular.element('<div></div>').html(response).contents()
|
||||
compileFn = cache[src] = $compile(responseContents)
|
||||
compileFn(scope, cloneAttachFn)
|
||||
|
|
|
@ -2,13 +2,13 @@ module.exports = function includeCachedDirective(CompileCacheService) {
|
|||
return {
|
||||
restrict: 'ECA',
|
||||
terminal: true,
|
||||
compile: function (element, attrs) {
|
||||
compile: function(element, attrs) {
|
||||
var srcExp = attrs.ngIncludeCached || attrs.src
|
||||
|
||||
return function (scope, element) {
|
||||
return function(scope, element) {
|
||||
var src = scope.$eval(srcExp)
|
||||
var newScope = scope.$new()
|
||||
CompileCacheService(src, newScope, function (compiledElm) {
|
||||
CompileCacheService(src, newScope, function(compiledElm) {
|
||||
element.append(compiledElm)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('includeCached', function () {
|
||||
describe('includeCached', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('includeCached', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -2,33 +2,33 @@ module.exports =
|
|||
function AddAdbKeyModalServiceFactory($uibModal) {
|
||||
var service = {}
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance, data) {
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance, data) {
|
||||
$scope.modal = {}
|
||||
$scope.modal.showAdd = true
|
||||
$scope.modal.fingerprint = data.fingerprint
|
||||
$scope.modal.title = data.title
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
}
|
||||
|
||||
$scope.$watch('modal.showAdd', function (newValue) {
|
||||
$scope.$watch('modal.showAdd', function(newValue) {
|
||||
if (newValue === false) {
|
||||
$scope.ok()
|
||||
}
|
||||
})
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
}
|
||||
|
||||
service.open = function (data) {
|
||||
service.open = function(data) {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./add-adb-key-modal.jade'),
|
||||
controller: ModalInstanceCtrl,
|
||||
resolve: {
|
||||
data: function () {
|
||||
data: function() {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
}));
|
||||
}))
|
||||
|
||||
})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module.exports = function ServiceFactory($uibModal, $sce) {
|
||||
var service = {}
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance, url, title, icon) {
|
||||
$scope.ok = function () {
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance, url, title, icon) {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,12 @@ module.exports = function ServiceFactory($uibModal, $sce) {
|
|||
$scope.title = title
|
||||
$scope.icon = icon
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
}
|
||||
|
||||
service.open = function (url, title, icon) {
|
||||
service.open = function(url, title, icon) {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./external-url-modal.jade'),
|
||||
controller: ModalInstanceCtrl,
|
||||
|
@ -24,17 +24,17 @@ module.exports = function ServiceFactory($uibModal, $sce) {
|
|||
title: function() {
|
||||
return title
|
||||
},
|
||||
url: function () {
|
||||
url: function() {
|
||||
return url
|
||||
},
|
||||
icon: function () {
|
||||
icon: function() {
|
||||
return icon
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
modalInstance.result.then(function () {
|
||||
}, function () {
|
||||
modalInstance.result.then(function() {
|
||||
}, function() {
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
}));
|
||||
}))
|
||||
|
||||
})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// TODO: Test this
|
||||
module.exports = function () {
|
||||
return function (scope, element, attrs) {
|
||||
scope.$watch(attrs.pageVisible, function () {
|
||||
element.bind('load', function () {
|
||||
module.exports = function() {
|
||||
return function(scope, element, attrs) {
|
||||
scope.$watch(attrs.pageVisible, function() {
|
||||
element.bind('load', function() {
|
||||
scope.$apply(attrs.pageLoad)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,9 +5,9 @@ module.exports =
|
|||
|
||||
var intervalDeviceInfo
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance, device,
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance, device,
|
||||
tryToReconnect) {
|
||||
$scope.ok = function () {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
$route.reload()
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ module.exports =
|
|||
|
||||
if (tryToReconnect) {
|
||||
// TODO: this is ugly, find why its not updated correctly (also on the device list)
|
||||
intervalDeviceInfo = $interval(function () {
|
||||
intervalDeviceInfo = $interval(function() {
|
||||
update()
|
||||
|
||||
if (device.usable) {
|
||||
|
@ -34,43 +34,43 @@ module.exports =
|
|||
}, 1000, 500)
|
||||
}
|
||||
|
||||
$scope.second = function () {
|
||||
$scope.second = function() {
|
||||
$uibModalInstance.dismiss()
|
||||
$location.path('/devices/')
|
||||
}
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
|
||||
var destroyInterval = function () {
|
||||
var destroyInterval = function() {
|
||||
if (angular.isDefined(intervalDeviceInfo)) {
|
||||
$interval.cancel(intervalDeviceInfo)
|
||||
intervalDeviceInfo = undefined
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.$on('$destroy', function() {
|
||||
destroyInterval()
|
||||
})
|
||||
}
|
||||
|
||||
FatalMessageService.open = function (device, tryToReconnect) {
|
||||
FatalMessageService.open = function(device, tryToReconnect) {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./fatal-message.jade'),
|
||||
controller: ModalInstanceCtrl,
|
||||
resolve: {
|
||||
device: function () {
|
||||
device: function() {
|
||||
return device
|
||||
},
|
||||
tryToReconnect: function () {
|
||||
tryToReconnect: function() {
|
||||
return tryToReconnect
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
modalInstance.result.then(function () {
|
||||
}, function () {
|
||||
modalInstance.result.then(function() {
|
||||
}, function() {
|
||||
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
}));
|
||||
}))
|
||||
|
||||
})
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
module.exports = function ServiceFactory($uibModal) {
|
||||
var service = {}
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance, title, imageUrl) {
|
||||
$scope.ok = function () {
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance, title, imageUrl) {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
}
|
||||
|
||||
$scope.title = title
|
||||
$scope.imageUrl = imageUrl
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
}
|
||||
|
||||
service.open = function (title, imageUrl) {
|
||||
service.open = function(title, imageUrl) {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./lightbox-image.jade'),
|
||||
controller: ModalInstanceCtrl,
|
||||
|
@ -23,14 +23,14 @@ module.exports = function ServiceFactory($uibModal) {
|
|||
title: function() {
|
||||
return title
|
||||
},
|
||||
imageUrl: function () {
|
||||
imageUrl: function() {
|
||||
return imageUrl
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
modalInstance.result.then(function () {
|
||||
}, function () {
|
||||
modalInstance.result.then(function() {
|
||||
}, function() {
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
}));
|
||||
}))
|
||||
|
||||
})
|
||||
|
|
|
@ -2,33 +2,33 @@ module.exports =
|
|||
function SocketDisconnectedServiceFactory($uibModal, $location, $window) {
|
||||
var service = {}
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance, message) {
|
||||
$scope.ok = function () {
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance, message) {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
$window.location.reload()
|
||||
}
|
||||
|
||||
$scope.message = message
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
service.open = function (message) {
|
||||
service.open = function(message) {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./socket-disconnected.jade'),
|
||||
controller: ModalInstanceCtrl,
|
||||
resolve: {
|
||||
message: function () {
|
||||
message: function() {
|
||||
return message
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
modalInstance.result.then(function () {
|
||||
}, function () {
|
||||
modalInstance.result.then(function() {
|
||||
}, function() {
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
module.exports = function ServiceFactory($uibModal, $location) {
|
||||
var service = {}
|
||||
|
||||
var ModalInstanceCtrl = function ($scope, $uibModalInstance) {
|
||||
$scope.ok = function () {
|
||||
var ModalInstanceCtrl = function($scope, $uibModalInstance) {
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close(true)
|
||||
$location.path('/')
|
||||
}
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.cancel = function() {
|
||||
$uibModalInstance.dismiss('cancel')
|
||||
}
|
||||
}
|
||||
|
||||
service.open = function () {
|
||||
service.open = function() {
|
||||
var modalInstance = $uibModal.open({
|
||||
template: require('./version-update.jade'),
|
||||
controller: ModalInstanceCtrl
|
||||
})
|
||||
|
||||
modalInstance.result.then(function (/*selectedItem*/) {
|
||||
}, function () {
|
||||
modalInstance.result.then(function(/*selectedItem*/) {
|
||||
}, function() {
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
}));
|
||||
}))
|
||||
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = function ngEnterDirective() {
|
||||
return function (scope, element, attrs) {
|
||||
element.bind("keydown keypress", function (event) {
|
||||
return function(scope, element, attrs) {
|
||||
element.bind('keydown keypress', function(event) {
|
||||
if (event.which === 13) {
|
||||
scope.$apply(function () {
|
||||
scope.$eval(attrs.ngEnter, {'event': event})
|
||||
scope.$apply(function() {
|
||||
scope.$eval(attrs.ngEnter, {event: event})
|
||||
})
|
||||
event.preventDefault()
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('ngEnter', function () {
|
||||
describe('ngEnter', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('ngEnter', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = function niceTabDirective() {
|
|||
scope: {
|
||||
},
|
||||
template: require('./nice-tab.jade'),
|
||||
link: function () {
|
||||
link: function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,25 +3,25 @@ module.exports = function niceTabsDirective() {
|
|||
restrict: 'EA',
|
||||
replace: true,
|
||||
template: require('./nice-tabs.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
// TODO: add support for 'key' for saving in Settings
|
||||
// TODO: add support for 'direction=below' for below tabs
|
||||
|
||||
scope.$watch(attrs.tabs, function (newValue) {
|
||||
scope.$watch(attrs.tabs, function(newValue) {
|
||||
scope.tabs = newValue
|
||||
})
|
||||
|
||||
scope.$watch(attrs.filter, function (newValue) {
|
||||
scope.$watch(attrs.filter, function(newValue) {
|
||||
scope.filter = newValue
|
||||
})
|
||||
|
||||
scope.tabFound = function (tab) {
|
||||
scope.tabFound = function(tab) {
|
||||
if (!tab.filters) {
|
||||
return true
|
||||
}
|
||||
var found = false
|
||||
|
||||
angular.forEach(tab.filters, function (value) {
|
||||
angular.forEach(tab.filters, function(value) {
|
||||
if (value === scope.filter) {
|
||||
found = true
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('niceTabs', function () {
|
||||
describe('niceTabs', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('niceTabs', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function () {
|
||||
module.exports = function() {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
transclude: true,
|
||||
|
@ -7,7 +7,7 @@ module.exports = function () {
|
|||
message: '@'
|
||||
},
|
||||
template: require('./nothing-to-show.html'),
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
scope.icon = attrs.icon
|
||||
scope.message = attrs.message
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ module.exports = function refreshPageDirective($window) {
|
|||
scope: {
|
||||
},
|
||||
template: require('./refresh-page.jade'),
|
||||
link: function (scope) {
|
||||
scope.reloadWindow = function () {
|
||||
link: function(scope) {
|
||||
scope.reloadWindow = function() {
|
||||
$window.location.reload()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('refreshPage', function () {
|
||||
describe('refreshPage', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your
|
||||
|
@ -19,5 +19,5 @@ describe('refreshPage', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module.exports = angular.module('stf.safe-apply', [])
|
||||
.config([
|
||||
'$provide', function ($provide) {
|
||||
'$provide', function($provide) {
|
||||
return $provide.decorator('$rootScope', [
|
||||
'$delegate', function ($delegate) {
|
||||
$delegate.safeApply = function (fn) {
|
||||
'$delegate', function($delegate) {
|
||||
$delegate.safeApply = function(fn) {
|
||||
var phase = $delegate.$$phase
|
||||
if (phase === "$apply" || phase === "$digest") {
|
||||
if (phase === '$apply' || phase === '$digest') {
|
||||
if (fn && typeof fn === 'function') {
|
||||
fn()
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = function textFocusSelectDirective() {
|
||||
return {
|
||||
restrict: 'AC',
|
||||
link: function (scope, element) {
|
||||
link: function(scope, element) {
|
||||
// TODO: try with focus event
|
||||
element.bind('click', function () {
|
||||
element.bind('click', function() {
|
||||
this.select()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('textFocusSelect', function () {
|
||||
describe('textFocusSelect', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('textFocusSelect', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function tooltipsDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function () {
|
||||
link: function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('tooltips', function () {
|
||||
describe('tooltips', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('tooltips', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -71,28 +71,28 @@ module.exports = function ControlServiceFactory(
|
|||
})
|
||||
}
|
||||
|
||||
this.touchUp = function(seq, contact) {
|
||||
this.touchUp = function(seq, contact) {
|
||||
sendOneWay('input.touchUp', {
|
||||
seq: seq
|
||||
, contact: contact
|
||||
})
|
||||
}
|
||||
|
||||
this.touchCommit = function(seq) {
|
||||
this.touchCommit = function(seq) {
|
||||
sendOneWay('input.touchCommit', {
|
||||
seq: seq
|
||||
})
|
||||
}
|
||||
|
||||
this.touchReset = function(seq) {
|
||||
this.touchReset = function(seq) {
|
||||
sendOneWay('input.touchReset', {
|
||||
seq: seq
|
||||
})
|
||||
}
|
||||
|
||||
this.keyDown = keySender('input.keyDown')
|
||||
this.keyUp = keySender('input.keyUp')
|
||||
this.keyPress = keySender('input.keyPress')
|
||||
this.keyDown = keySender('input.keyDown')
|
||||
this.keyUp = keySender('input.keyUp')
|
||||
this.keyPress = keySender('input.keyPress')
|
||||
|
||||
this.home = keySender('input.keyPress', 'home')
|
||||
this.menu = keySender('input.keyPress', 'menu')
|
||||
|
@ -116,9 +116,9 @@ module.exports = function ControlServiceFactory(
|
|||
|
||||
//@TODO: Refactor this please
|
||||
var that = this
|
||||
this.getClipboardContent = function () {
|
||||
that.copy().then(function (result) {
|
||||
$rootScope.$apply(function () {
|
||||
this.getClipboardContent = function() {
|
||||
that.copy().then(function(result) {
|
||||
$rootScope.$apply(function() {
|
||||
if (result.success) {
|
||||
if (result.lastData) {
|
||||
that.clipboardContent = result.lastData
|
||||
|
@ -167,16 +167,16 @@ module.exports = function ControlServiceFactory(
|
|||
this.testForward = function(forward) {
|
||||
return sendTwoWay('forward.test', {
|
||||
targetHost: forward.targetHost
|
||||
, targetPort: +forward.targetPort
|
||||
, targetPort: Number(forward.targetPort)
|
||||
})
|
||||
}
|
||||
|
||||
this.createForward = function(forward) {
|
||||
return sendTwoWay('forward.create', {
|
||||
id: forward.id
|
||||
, devicePort: +forward.devicePort
|
||||
, devicePort: Number(forward.devicePort)
|
||||
, targetHost: forward.targetHost
|
||||
, targetPort: +forward.targetPort
|
||||
, targetPort: Number(forward.targetPort)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -225,15 +225,15 @@ module.exports = function ControlServiceFactory(
|
|||
return sendTwoWay('screen.capture')
|
||||
}
|
||||
|
||||
this.fsretrieve = function(file){
|
||||
this.fsretrieve = function(file) {
|
||||
return sendTwoWay('fs.retrieve', {
|
||||
file: file,
|
||||
file: file
|
||||
})
|
||||
}
|
||||
|
||||
this.fslist = function(dir){
|
||||
this.fslist = function(dir) {
|
||||
return sendTwoWay('fs.list', {
|
||||
dir: dir,
|
||||
dir: dir
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -8,15 +8,15 @@ module.exports = function deviceContextMenuDirective($window) {
|
|||
//},
|
||||
transclude: true,
|
||||
template: require('./device-context-menu.jade'),
|
||||
link: function (scope) {
|
||||
link: function(scope) {
|
||||
//var device = scope.device()
|
||||
//var control = scope.control()
|
||||
scope.windowClose = function () {
|
||||
scope.windowClose = function() {
|
||||
$window.close()
|
||||
}
|
||||
|
||||
scope.saveScreenShot = function () {
|
||||
scope.control.screenshot().then(function (result) {
|
||||
scope.saveScreenShot = function() {
|
||||
scope.control.screenshot().then(function(result) {
|
||||
location.href = result.body.href + '?download'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('deviceContextMenu', function () {
|
||||
describe('deviceContextMenu', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
module.exports = angular.module('stf.device-status', [])
|
||||
.filter('statusNameAction', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('statusNameAction', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'absent': gettext('Disconnected'),
|
||||
'present': gettext('Connected'),
|
||||
'offline': gettext('Offline'),
|
||||
'unauthorized': gettext('Unauthorized'),
|
||||
'preparing': gettext('Preparing'),
|
||||
'ready': gettext('Ready'),
|
||||
'using': gettext('Stop Using'),
|
||||
'busy': gettext('Busy'),
|
||||
'available': gettext('Use')
|
||||
absent: gettext('Disconnected'),
|
||||
present: gettext('Connected'),
|
||||
offline: gettext('Offline'),
|
||||
unauthorized: gettext('Unauthorized'),
|
||||
preparing: gettext('Preparing'),
|
||||
ready: gettext('Ready'),
|
||||
using: gettext('Stop Using'),
|
||||
busy: gettext('Busy'),
|
||||
available: gettext('Use')
|
||||
}[text] || gettext('Unknown')
|
||||
}
|
||||
})
|
||||
.filter('statusNamePassive', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('statusNamePassive', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'absent': gettext('Disconnected'),
|
||||
'present': gettext('Connected'),
|
||||
'offline': gettext('Offline'),
|
||||
'unauthorized': gettext('Unauthorized'),
|
||||
'preparing': gettext('Preparing'),
|
||||
'ready': gettext('Ready'),
|
||||
'using': gettext('Using'),
|
||||
'busy': gettext('Busy'),
|
||||
'available': gettext('Available')
|
||||
absent: gettext('Disconnected'),
|
||||
present: gettext('Connected'),
|
||||
offline: gettext('Offline'),
|
||||
unauthorized: gettext('Unauthorized'),
|
||||
preparing: gettext('Preparing'),
|
||||
ready: gettext('Ready'),
|
||||
using: gettext('Using'),
|
||||
busy: gettext('Busy'),
|
||||
available: gettext('Available')
|
||||
}[text] || gettext('Unknown')
|
||||
}
|
||||
})
|
||||
.filter('likelyLeaveReason', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('likelyLeaveReason', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'ungroup_request': gettext('You (or someone else) kicked the device.'),
|
||||
'owner_change': gettext('Someone stole your device.'),
|
||||
'automatic_timeout': gettext('Device was kicked by automatic timeout. '),
|
||||
'device_absent': gettext('Device is not present anymore for some reason.'),
|
||||
'status_change': gettext('Device is present but offline.')
|
||||
ungroup_request: gettext('You (or someone else) kicked the device.'),
|
||||
owner_change: gettext('Someone stole your device.'),
|
||||
automatic_timeout: gettext('Device was kicked by automatic timeout. '),
|
||||
device_absent: gettext('Device is not present anymore for some reason.'),
|
||||
status_change: gettext('Device is present but offline.')
|
||||
}[text] || gettext('Unknown reason.')
|
||||
}
|
||||
})
|
||||
.filter('batteryHealth', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('batteryHealth', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'cold': gettext('Cold'),
|
||||
'good': gettext('Good'),
|
||||
'dead': gettext('Dead'),
|
||||
'over_voltage': gettext('Over Voltage'),
|
||||
'overheat': gettext('Overheat'),
|
||||
'unspecified_failure': gettext('Unspecified Failure')
|
||||
cold: gettext('Cold'),
|
||||
good: gettext('Good'),
|
||||
dead: gettext('Dead'),
|
||||
over_voltage: gettext('Over Voltage'),
|
||||
overheat: gettext('Overheat'),
|
||||
unspecified_failure: gettext('Unspecified Failure')
|
||||
}[text] || gettext('-')
|
||||
}
|
||||
})
|
||||
.filter('batterySource', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('batterySource', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'ac': gettext('AC'),
|
||||
'usb': gettext('USB'),
|
||||
'wireless': gettext('Wireless')
|
||||
ac: gettext('AC'),
|
||||
usb: gettext('USB'),
|
||||
wireless: gettext('Wireless')
|
||||
}[text] || gettext('-')
|
||||
}
|
||||
})
|
||||
.filter('batteryStatus', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('batteryStatus', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'charging': gettext('Charging'),
|
||||
'discharging': gettext('Discharging'),
|
||||
'full': gettext('Full'),
|
||||
'not_charging': gettext('Not Charging')
|
||||
charging: gettext('Charging'),
|
||||
discharging: gettext('Discharging'),
|
||||
full: gettext('Full'),
|
||||
not_charging: gettext('Not Charging')
|
||||
}[text] || gettext('-')
|
||||
}
|
||||
})
|
||||
.filter('displayDensity', function () {
|
||||
return function (text) {
|
||||
.filter('displayDensity', function() {
|
||||
return function(text) {
|
||||
return {
|
||||
'0.5': 'LDPI', // (120 dpi)
|
||||
'1': 'MDPI', // (160 dpi)
|
||||
|
@ -83,38 +83,36 @@ module.exports = angular.module('stf.device-status', [])
|
|||
}[text] || text
|
||||
}
|
||||
})
|
||||
.filter('networkType', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('networkType', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'bluetooth': gettext('Bluetooth'),
|
||||
'dummy': gettext('Dummy'),
|
||||
'ethernet': gettext('Ethernet'),
|
||||
'mobile': gettext('Mobile'),
|
||||
'mobile_dun': gettext('Mobile DUN'),
|
||||
'mobile_hipri': gettext('Mobile High Priority'),
|
||||
'mobile_mms': gettext('Mobile MMS'),
|
||||
'mobile_supl': gettext('Mobile SUPL'),
|
||||
'mobile_wifi': gettext('WiFi'),
|
||||
'wimax': gettext('WiMAX')
|
||||
bluetooth: gettext('Bluetooth'),
|
||||
dummy: gettext('Dummy'),
|
||||
ethernet: gettext('Ethernet'),
|
||||
mobile: gettext('Mobile'),
|
||||
mobile_dun: gettext('Mobile DUN'),
|
||||
mobile_hipri: gettext('Mobile High Priority'),
|
||||
mobile_mms: gettext('Mobile MMS'),
|
||||
mobile_supl: gettext('Mobile SUPL'),
|
||||
mobile_wifi: gettext('WiFi'),
|
||||
wimax: gettext('WiMAX')
|
||||
}[text] || text
|
||||
}
|
||||
})
|
||||
.filter('networkSubType', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('networkSubType', function(gettext) {
|
||||
return function(text) {
|
||||
return {
|
||||
'mobile_wifi': gettext('WiFi')
|
||||
mobile_wifi: gettext('WiFi')
|
||||
}[text] || text
|
||||
}
|
||||
})
|
||||
.filter('humanizedBool', function (gettext) {
|
||||
return function (text) {
|
||||
.filter('humanizedBool', function(gettext) {
|
||||
return function(text) {
|
||||
switch (text) {
|
||||
case true:
|
||||
return gettext('Yes')
|
||||
break;
|
||||
case false:
|
||||
return gettext('No')
|
||||
break;
|
||||
default:
|
||||
return gettext('-')
|
||||
}
|
||||
|
|
|
@ -7,10 +7,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
|
||||
function Tracker($scope, options) {
|
||||
var devices = []
|
||||
, devicesBySerial = Object.create(null)
|
||||
, scopedSocket = socket.scoped($scope)
|
||||
, digestTimer
|
||||
, lastDigest
|
||||
var devicesBySerial = Object.create(null)
|
||||
var scopedSocket = socket.scoped($scope)
|
||||
var digestTimer, lastDigest
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
clearTimeout(digestTimer)
|
||||
|
@ -81,7 +80,9 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
var modify = function modify(data, newData) {
|
||||
_.merge(data, newData, function(a, b) {
|
||||
// New Arrays overwrite old Arrays
|
||||
return _.isArray(b) ? b : undefined
|
||||
if (_.isArray(b)) {
|
||||
return b
|
||||
}
|
||||
})
|
||||
sync(data)
|
||||
this.emit('change', data)
|
||||
|
@ -156,7 +157,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
|
||||
Tracker.prototype = new EventEmitter()
|
||||
|
||||
deviceService.trackAll = function ($scope) {
|
||||
deviceService.trackAll = function($scope) {
|
||||
var tracker = new Tracker($scope, {
|
||||
filter: function() {
|
||||
return true
|
||||
|
@ -165,14 +166,14 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
})
|
||||
|
||||
oboe('/app/api/v1/devices')
|
||||
.node('devices[*]', function (device) {
|
||||
.node('devices[*]', function(device) {
|
||||
tracker.add(device)
|
||||
})
|
||||
|
||||
return tracker
|
||||
}
|
||||
|
||||
deviceService.trackGroup = function ($scope) {
|
||||
deviceService.trackGroup = function($scope) {
|
||||
var tracker = new Tracker($scope, {
|
||||
filter: function(device) {
|
||||
return device.using
|
||||
|
@ -181,7 +182,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
})
|
||||
|
||||
oboe('/app/api/v1/group')
|
||||
.node('devices[*]', function (device) {
|
||||
.node('devices[*]', function(device) {
|
||||
tracker.add(device)
|
||||
})
|
||||
|
||||
|
@ -190,12 +191,12 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
|
||||
deviceService.load = function(serial) {
|
||||
return $http.get('/app/api/v1/devices/' + serial)
|
||||
.then(function (response) {
|
||||
.then(function(response) {
|
||||
return response.data.device
|
||||
})
|
||||
}
|
||||
|
||||
deviceService.get = function (serial, $scope) {
|
||||
deviceService.get = function(serial, $scope) {
|
||||
var tracker = new Tracker($scope, {
|
||||
filter: function(device) {
|
||||
return device.serial === serial
|
||||
|
@ -210,7 +211,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
})
|
||||
}
|
||||
|
||||
deviceService.updateNote = function (serial, note) {
|
||||
deviceService.updateNote = function(serial, note) {
|
||||
socket.emit('device.note', {
|
||||
serial: serial,
|
||||
note: note
|
||||
|
|
|
@ -55,13 +55,13 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
|
|||
|
||||
if (device.owner) {
|
||||
device.enhancedUserProfileUrl = enhanceUserProfileUrl(device.owner.email)
|
||||
device.enhancedUserName = device.owner.name || "No name"
|
||||
device.enhancedUserName = device.owner.name || 'No name'
|
||||
}
|
||||
}
|
||||
|
||||
function enhanceUserProfileUrl(email) {
|
||||
var url
|
||||
var userProfileUrl = (function () {
|
||||
var userProfileUrl = (function() {
|
||||
if (AppState && AppState.config && AppState.config.userProfileUrl) {
|
||||
return AppState.config.userProfileUrl
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
|
|||
if (userProfileUrl && email) {
|
||||
url = userProfileUrl.indexOf('{user}') !== -1 ?
|
||||
userProfileUrl.replace('{user}', email) :
|
||||
userProfileUrl + email;
|
||||
userProfileUrl + email
|
||||
}
|
||||
} else if (email.indexOf('@') !== -1) {
|
||||
url = 'mailto:' + email
|
||||
|
@ -83,7 +83,7 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
|
|||
return url
|
||||
}
|
||||
|
||||
service.enhance = function (device) {
|
||||
service.enhance = function(device) {
|
||||
setState(device)
|
||||
enhanceDevice(device)
|
||||
enhanceDeviceDetails(device)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function StateClassesService() {
|
||||
var service = {}
|
||||
|
||||
service.stateButton = function (state) {
|
||||
service.stateButton = function(state) {
|
||||
var stateClasses = {
|
||||
using: 'state-using btn-primary',
|
||||
busy: 'state-busy btn-warning',
|
||||
|
@ -18,7 +18,7 @@ module.exports = function StateClassesService() {
|
|||
return stateClasses
|
||||
}
|
||||
|
||||
service.stateColor = function (state) {
|
||||
service.stateColor = function(state) {
|
||||
var stateClasses = {
|
||||
using: 'state-using',
|
||||
busy: 'state-busy',
|
||||
|
|
|
@ -6,11 +6,11 @@ module.exports = function FilterStringServiceFactory() {
|
|||
/**
|
||||
* Filters integer
|
||||
*
|
||||
* @param searchValue
|
||||
* @param str
|
||||
* @param {string} searchValue Value to search
|
||||
* @param {string} str Value to compare
|
||||
* @returns {boolean} true if matched
|
||||
*/
|
||||
service.filterInteger = function (searchValue, str) {
|
||||
service.filterInteger = function(searchValue, str) {
|
||||
var matched = true
|
||||
matched = service.filterString(searchValue + '', str + '')
|
||||
return matched
|
||||
|
@ -19,11 +19,11 @@ module.exports = function FilterStringServiceFactory() {
|
|||
/**
|
||||
* Filters string
|
||||
*
|
||||
* @param searchValue
|
||||
* @param str
|
||||
* @param {string} searchValue Value to search
|
||||
* @param {string} str Value to compare
|
||||
* @returns {boolean} true if matched
|
||||
*/
|
||||
service.filterString = function (searchValue, str) {
|
||||
service.filterString = function(searchValue, str) {
|
||||
var matched = true
|
||||
var searchLowerCase = searchValue.toLowerCase()
|
||||
var searchContent = searchValue.slice(1)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = function imageOnloadAnimateDirective($parse, $animate) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element) {
|
||||
link: function(scope, element) {
|
||||
$animate.addClass(element, 'ng-image-not-loaded')
|
||||
element.bind('load', function () {
|
||||
element.bind('load', function() {
|
||||
$animate.removeClass(element, 'ng-image-not-loaded')
|
||||
|
||||
//if(!scope.$$phase) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function imageOnloadDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
element.bind('load', function() {
|
||||
scope.$eval(attrs.imageOnload)
|
||||
// console.log('image is loaded')
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('imageOnload', function () {
|
||||
describe('imageOnload', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('imageOnload', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module.exports = function installErrorFilter(gettext) {
|
||||
/*jshint maxlen:200*/
|
||||
return function (text) {
|
||||
/* eslint max-len:0 */
|
||||
return function(text) {
|
||||
switch (text) {
|
||||
// Our error codes.
|
||||
case "INSTALL_SUCCEEDED":
|
||||
return gettext("Installation succeeded.")
|
||||
case 'INSTALL_SUCCEEDED':
|
||||
return gettext('Installation succeeded.')
|
||||
case 'INSTALL_ERROR_UNKNOWN':
|
||||
return gettext('Installation failed due to an unknown error.')
|
||||
case 'INSTALL_ERROR_TIMEOUT':
|
||||
|
@ -14,80 +14,80 @@ module.exports = function installErrorFilter(gettext) {
|
|||
// Android PackageManager error codes from [1].
|
||||
// [1] https://github.com/android/platform_frameworks_base/blob/
|
||||
// master/core/java/android/content/pm/PackageManager.java
|
||||
case "INSTALL_FAILED_ALREADY_EXISTS":
|
||||
return gettext("The package is already installed.")
|
||||
case "INSTALL_FAILED_INVALID_APK":
|
||||
return gettext("The package archive file is invalid.")
|
||||
case "INSTALL_FAILED_INVALID_URI":
|
||||
return gettext("The URI passed in is invalid.")
|
||||
case "INSTALL_FAILED_INSUFFICIENT_STORAGE":
|
||||
case 'INSTALL_FAILED_ALREADY_EXISTS':
|
||||
return gettext('The package is already installed.')
|
||||
case 'INSTALL_FAILED_INVALID_APK':
|
||||
return gettext('The package archive file is invalid.')
|
||||
case 'INSTALL_FAILED_INVALID_URI':
|
||||
return gettext('The URI passed in is invalid.')
|
||||
case 'INSTALL_FAILED_INSUFFICIENT_STORAGE':
|
||||
return gettext("The package manager service found that the device didn't have enough storage space to install the app.")
|
||||
case "INSTALL_FAILED_DUPLICATE_PACKAGE":
|
||||
return gettext("A package is already installed with the same name.")
|
||||
case "INSTALL_FAILED_NO_SHARED_USER":
|
||||
return gettext("The requested shared user does not exist.")
|
||||
case "INSTALL_FAILED_UPDATE_INCOMPATIBLE":
|
||||
case 'INSTALL_FAILED_DUPLICATE_PACKAGE':
|
||||
return gettext('A package is already installed with the same name.')
|
||||
case 'INSTALL_FAILED_NO_SHARED_USER':
|
||||
return gettext('The requested shared user does not exist.')
|
||||
case 'INSTALL_FAILED_UPDATE_INCOMPATIBLE':
|
||||
return gettext("A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed).")
|
||||
case "INSTALL_FAILED_MISSING_SHARED_LIBRARY":
|
||||
return gettext("The new package uses a shared library that is not available.")
|
||||
case "INSTALL_FAILED_REPLACE_COULDNT_DELETE":
|
||||
return gettext("The existing package could not be deleted.")
|
||||
case "INSTALL_FAILED_DEXOPT":
|
||||
return gettext("The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.")
|
||||
case "INSTALL_FAILED_OLDER_SDK":
|
||||
return gettext("The new package failed because the current SDK version is older than that required by the package.")
|
||||
case "INSTALL_FAILED_CONFLICTING_PROVIDER":
|
||||
return gettext("The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.")
|
||||
case "INSTALL_FAILED_NEWER_SDK":
|
||||
return gettext("The new package failed because the current SDK version is newer than that required by the package.")
|
||||
case "INSTALL_FAILED_TEST_ONLY":
|
||||
return gettext("The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.")
|
||||
case "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE":
|
||||
case 'INSTALL_FAILED_MISSING_SHARED_LIBRARY':
|
||||
return gettext('The new package uses a shared library that is not available.')
|
||||
case 'INSTALL_FAILED_REPLACE_COULDNT_DELETE':
|
||||
return gettext('The existing package could not be deleted.')
|
||||
case 'INSTALL_FAILED_DEXOPT':
|
||||
return gettext('The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.')
|
||||
case 'INSTALL_FAILED_OLDER_SDK':
|
||||
return gettext('The new package failed because the current SDK version is older than that required by the package.')
|
||||
case 'INSTALL_FAILED_CONFLICTING_PROVIDER':
|
||||
return gettext('The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.')
|
||||
case 'INSTALL_FAILED_NEWER_SDK':
|
||||
return gettext('The new package failed because the current SDK version is newer than that required by the package.')
|
||||
case 'INSTALL_FAILED_TEST_ONLY':
|
||||
return gettext('The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.')
|
||||
case 'INSTALL_FAILED_CPU_ABI_INCOMPATIBLE':
|
||||
return gettext("The package being installed contains native code, but none that is compatible with the device's CPU_ABI.")
|
||||
case "INSTALL_FAILED_MISSING_FEATURE":
|
||||
return gettext("The new package uses a feature that is not available.")
|
||||
case "INSTALL_FAILED_CONTAINER_ERROR":
|
||||
case 'INSTALL_FAILED_MISSING_FEATURE':
|
||||
return gettext('The new package uses a feature that is not available.')
|
||||
case 'INSTALL_FAILED_CONTAINER_ERROR':
|
||||
return gettext("A secure container mount point couldn't be accessed on external media.")
|
||||
case "INSTALL_FAILED_INVALID_INSTALL_LOCATION":
|
||||
case 'INSTALL_FAILED_INVALID_INSTALL_LOCATION':
|
||||
return gettext("The new package couldn't be installed in the specified install location.")
|
||||
case "INSTALL_FAILED_MEDIA_UNAVAILABLE":
|
||||
case 'INSTALL_FAILED_MEDIA_UNAVAILABLE':
|
||||
return gettext("The new package couldn't be installed in the specified install location because the media is not available.")
|
||||
case "INSTALL_FAILED_VERIFICATION_TIMEOUT":
|
||||
case 'INSTALL_FAILED_VERIFICATION_TIMEOUT':
|
||||
return gettext("The new package couldn't be installed because the verification timed out.")
|
||||
case "INSTALL_FAILED_VERIFICATION_FAILURE":
|
||||
case 'INSTALL_FAILED_VERIFICATION_FAILURE':
|
||||
return gettext("The new package couldn't be installed because the verification did not succeed.")
|
||||
case "INSTALL_FAILED_PACKAGE_CHANGED":
|
||||
return gettext("The package changed from what the calling program expected.")
|
||||
case "INSTALL_FAILED_UID_CHANGED":
|
||||
return gettext("The new package is assigned a different UID than it previously held.")
|
||||
case "INSTALL_FAILED_VERSION_DOWNGRADE":
|
||||
return gettext("The new package has an older version code than the currently installed package.")
|
||||
case "INSTALL_PARSE_FAILED_NOT_APK":
|
||||
case 'INSTALL_FAILED_PACKAGE_CHANGED':
|
||||
return gettext('The package changed from what the calling program expected.')
|
||||
case 'INSTALL_FAILED_UID_CHANGED':
|
||||
return gettext('The new package is assigned a different UID than it previously held.')
|
||||
case 'INSTALL_FAILED_VERSION_DOWNGRADE':
|
||||
return gettext('The new package has an older version code than the currently installed package.')
|
||||
case 'INSTALL_PARSE_FAILED_NOT_APK':
|
||||
return gettext("The parser was given a path that is not a file, or does not end with the expected '.apk' extension.")
|
||||
case "INSTALL_PARSE_FAILED_BAD_MANIFEST":
|
||||
return gettext("The parser was unable to retrieve the AndroidManifest.xml file.")
|
||||
case "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION":
|
||||
return gettext("The parser encountered an unexpected exception.")
|
||||
case "INSTALL_PARSE_FAILED_NO_CERTIFICATES":
|
||||
return gettext("The parser did not find any certificates in the .apk.")
|
||||
case "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES":
|
||||
return gettext("The parser found inconsistent certificates on the files in the .apk.")
|
||||
case "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING":
|
||||
return gettext("The parser encountered a CertificateEncodingException in one of the files in the .apk.")
|
||||
case "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME":
|
||||
return gettext("The parser encountered a bad or missing package name in the manifest.")
|
||||
case "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID":
|
||||
return gettext("The parser encountered a bad shared user id name in the manifest.")
|
||||
case "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED":
|
||||
return gettext("The parser encountered some structural problem in the manifest.")
|
||||
case "INSTALL_PARSE_FAILED_MANIFEST_EMPTY":
|
||||
return gettext("The parser did not find any actionable tags (instrumentation or application) in the manifest.")
|
||||
case "INSTALL_FAILED_INTERNAL_ERROR":
|
||||
return gettext("The system failed to install the package because of system issues.")
|
||||
case "INSTALL_FAILED_USER_RESTRICTED":
|
||||
return gettext("The system failed to install the package because the user is restricted from installing apps.")
|
||||
case "INSTALL_FAILED_NO_MATCHING_ABIS":
|
||||
return gettext("The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.")
|
||||
case 'INSTALL_PARSE_FAILED_BAD_MANIFEST':
|
||||
return gettext('The parser was unable to retrieve the AndroidManifest.xml file.')
|
||||
case 'INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION':
|
||||
return gettext('The parser encountered an unexpected exception.')
|
||||
case 'INSTALL_PARSE_FAILED_NO_CERTIFICATES':
|
||||
return gettext('The parser did not find any certificates in the .apk.')
|
||||
case 'INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES':
|
||||
return gettext('The parser found inconsistent certificates on the files in the .apk.')
|
||||
case 'INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING':
|
||||
return gettext('The parser encountered a CertificateEncodingException in one of the files in the .apk.')
|
||||
case 'INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME':
|
||||
return gettext('The parser encountered a bad or missing package name in the manifest.')
|
||||
case 'INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID':
|
||||
return gettext('The parser encountered a bad shared user id name in the manifest.')
|
||||
case 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED':
|
||||
return gettext('The parser encountered some structural problem in the manifest.')
|
||||
case 'INSTALL_PARSE_FAILED_MANIFEST_EMPTY':
|
||||
return gettext('The parser did not find any actionable tags (instrumentation or application) in the manifest.')
|
||||
case 'INSTALL_FAILED_INTERNAL_ERROR':
|
||||
return gettext('The system failed to install the package because of system issues.')
|
||||
case 'INSTALL_FAILED_USER_RESTRICTED':
|
||||
return gettext('The system failed to install the package because the user is restricted from installing apps.')
|
||||
case 'INSTALL_FAILED_NO_MATCHING_ABIS':
|
||||
return gettext('The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.')
|
||||
default:
|
||||
return gettext(text)
|
||||
}
|
||||
|
|
|
@ -60,14 +60,14 @@ module.exports = function InstallService(
|
|||
this.emit('change')
|
||||
}
|
||||
|
||||
installService.installUrl = function (control, url) {
|
||||
installService.installUrl = function(control, url) {
|
||||
var installation = new Installation('downloading')
|
||||
$rootScope.$broadcast('installation', installation)
|
||||
return control.uploadUrl(url)
|
||||
.progressed(function (uploadResult) {
|
||||
.progressed(function(uploadResult) {
|
||||
installation.update(uploadResult.progress / 2, uploadResult.lastData)
|
||||
})
|
||||
.then(function (uploadResult) {
|
||||
.then(function(uploadResult) {
|
||||
installation.update(uploadResult.progress / 2, uploadResult.lastData)
|
||||
installation.manifest = uploadResult.body
|
||||
return control.install({
|
||||
|
@ -75,7 +75,7 @@ module.exports = function InstallService(
|
|||
, manifest: installation.manifest
|
||||
, launch: installation.launch
|
||||
})
|
||||
.progressed(function (result) {
|
||||
.progressed(function(result) {
|
||||
installation.update(50 + result.progress / 2, result.lastData)
|
||||
})
|
||||
})
|
||||
|
@ -87,7 +87,7 @@ module.exports = function InstallService(
|
|||
})
|
||||
}
|
||||
|
||||
installService.installFile = function (control, $files) {
|
||||
installService.installFile = function(control, $files) {
|
||||
var installation = new Installation('uploading')
|
||||
$rootScope.$broadcast('installation', installation)
|
||||
return StorageService.storeFile('apk', $files, {
|
||||
|
@ -112,7 +112,7 @@ module.exports = function InstallService(
|
|||
, manifest: installation.manifest
|
||||
, launch: installation.launch
|
||||
})
|
||||
.progressed(function (result) {
|
||||
.progressed(function(result) {
|
||||
installation.update(50 + result.progress / 2, result.lastData)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = angular.module('stf.keycodes', [
|
||||
|
||||
])
|
||||
.factory('KeycodesMapped', function () {
|
||||
.factory('KeycodesMapped', function() {
|
||||
return require('./mapped/index.json')
|
||||
})
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ module.exports = function KeycodesServiceFactory(KeycodesAndroid, KeycodesJS) {
|
|||
[j.SINGLE_QUOTE, a.KEYCODE_APOSTROPHE]
|
||||
]
|
||||
|
||||
service.mapToDevice = function (keyCode) {
|
||||
service.mapToDevice = function(keyCode) {
|
||||
return service.mapToAndroid(keyCode)
|
||||
}
|
||||
|
||||
service.mapToAndroid = function (key) {
|
||||
service.mapToAndroid = function(key) {
|
||||
// All special keys
|
||||
for (var i = 0; i < androidMap.length; ++i) {
|
||||
if (androidMap[i][0] === key) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function AdbKeysServiceFactory() {
|
||||
var service = {}
|
||||
|
||||
service.commentFromKey = function (key) {
|
||||
service.commentFromKey = function(key) {
|
||||
if (key.match(/.+= (.+)/)) {
|
||||
return key.replace(/.+= (.+)/g, '$1')
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
|||
, key: ''
|
||||
}
|
||||
|
||||
$scope.addKey = function () {
|
||||
$scope.addKey = function() {
|
||||
UserService.addAdbKey({
|
||||
title: $scope.addForm.title
|
||||
, key: $scope.addForm.key
|
||||
|
@ -21,7 +21,7 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
|||
$scope.closeAddKey()
|
||||
}
|
||||
|
||||
$scope.closeAddKey = function () {
|
||||
$scope.closeAddKey = function() {
|
||||
$scope.addForm.title = ''
|
||||
$scope.addForm.key = ''
|
||||
// TODO: cannot access to the form by name inside a directive?
|
||||
|
@ -29,8 +29,8 @@ module.exports = function addAdbKeyDirective(AdbKeysService) {
|
|||
$scope.showAdd = false
|
||||
}
|
||||
},
|
||||
link: function (scope) {
|
||||
scope.$watch('addForm.key', function (newValue) {
|
||||
link: function(scope) {
|
||||
scope.$watch('addForm.key', function(newValue) {
|
||||
if (newValue && !scope.addForm.title) {
|
||||
// By default sets the title to the ADB key comment because
|
||||
// usually it happens to be username@hostname.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('addAdbKey', function () {
|
||||
describe('addAdbKey', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./index').name))
|
||||
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports =
|
|||
function landscapeDirective(BrowserInfo, $document, $window) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope) {
|
||||
link: function(scope) {
|
||||
var body = angular.element($document[0].body)
|
||||
|
||||
if (typeof $window.orientation !== 'undefined') {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('landscape', function () {
|
||||
describe('landscape', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('landscape', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = function LanguageProvider(AppStateProvider) {
|
|||
}
|
||||
|
||||
return {
|
||||
$get: function () {
|
||||
$get: function() {
|
||||
return provider
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports =
|
|||
restrict: 'E',
|
||||
replace: true,
|
||||
template: require('./logcat-table.jade'),
|
||||
link: function (scope, element) {
|
||||
link: function(scope, element) {
|
||||
var autoScroll = true
|
||||
var autoScrollDependingOnScrollPosition = true
|
||||
var scrollPosition = 0
|
||||
|
@ -23,15 +23,15 @@ module.exports =
|
|||
}
|
||||
}
|
||||
|
||||
LogcatService.addEntryListener = function (entry) {
|
||||
LogcatService.addEntryListener = function(entry) {
|
||||
incrementNumberEntry()
|
||||
addRow(body, entry)
|
||||
}
|
||||
|
||||
LogcatService.addFilteredEntriesListener = function (entries) {
|
||||
LogcatService.addFilteredEntriesListener = function(entries) {
|
||||
clearTable()
|
||||
//var fragment = document.createDocumentFragment()
|
||||
_.each(entries, function (entry) {
|
||||
_.each(entries, function(entry) {
|
||||
// TODO: This is not adding all the entries after first scope creation
|
||||
incrementNumberEntry()
|
||||
addRow(body, entry, true)
|
||||
|
@ -56,7 +56,7 @@ module.exports =
|
|||
|
||||
function scrollToBottom() {
|
||||
parent.scrollTop = parent.scrollHeight + 20
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
parent.scrollTop = parent.scrollHeight
|
||||
}, 10)
|
||||
}
|
||||
|
@ -99,13 +99,13 @@ module.exports =
|
|||
body = newBody
|
||||
}
|
||||
|
||||
scope.clearTable = function () {
|
||||
scope.clearTable = function() {
|
||||
LogcatService.clear()
|
||||
numberOfEntries = 0
|
||||
clearTable()
|
||||
}
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
scope.$on('$destroy', function() {
|
||||
parent.removeEventListener('scroll', throttledScrollListener)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('logcatTable', function () {
|
||||
describe('logcatTable', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your directive,
|
||||
|
@ -19,5 +19,5 @@ describe('logcatTable', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -23,14 +23,14 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
|
|||
var _filters = {}
|
||||
|
||||
function defineFilterProperties(properties) {
|
||||
_.forEach(properties, function (prop) {
|
||||
_.forEach(properties, function(prop) {
|
||||
Object.defineProperty(service.filters, prop, {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return _filters[prop]
|
||||
},
|
||||
set: function (value) {
|
||||
_filters[prop] = value ? value : null
|
||||
service.serverFilters[0][prop] = value ? value : undefined
|
||||
set: function(value) {
|
||||
_filters[prop] = value || null
|
||||
service.serverFilters[0][prop] = value || undefined
|
||||
service.filters.filterLines()
|
||||
}
|
||||
})
|
||||
|
@ -63,11 +63,11 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
|
|||
'SILENT'
|
||||
]
|
||||
|
||||
var logLevelsLowerCase = _.map(service.logLevels, function (level) {
|
||||
var logLevelsLowerCase = _.map(service.logLevels, function(level) {
|
||||
return level.toLowerCase()
|
||||
})
|
||||
|
||||
var logLevelsCapitalized = _.map(logLevelsLowerCase, function (level) {
|
||||
var logLevelsCapitalized = _.map(logLevelsLowerCase, function(level) {
|
||||
return _s.capitalize(level)
|
||||
})
|
||||
|
||||
|
@ -90,26 +90,26 @@ module.exports = function LogcatServiceFactory(socket, FilterStringService) {
|
|||
return data
|
||||
}
|
||||
|
||||
socket.on('logcat.entry', function (rawData) {
|
||||
socket.on('logcat.entry', function(rawData) {
|
||||
service.numberOfEntries++
|
||||
service.entries.push(enhanceEntry(rawData))
|
||||
|
||||
if (typeof(service.addEntryListener) === 'function') {
|
||||
if (typeof (service.addEntryListener) === 'function') {
|
||||
if (filterLine(rawData)) {
|
||||
service.addEntryListener(rawData)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
service.clear = function () {
|
||||
service.clear = function() {
|
||||
service.numberOfEntries = 0
|
||||
service.entries = []
|
||||
}
|
||||
|
||||
service.filters.filterLines = function () {
|
||||
service.filters.filterLines = function() {
|
||||
service.filters.entries = _.filter(service.entries, filterLine)
|
||||
|
||||
if (typeof(service.addFilteredEntriesListener) === 'function') {
|
||||
if (typeof (service.addFilteredEntriesListener) === 'function') {
|
||||
service.addFilteredEntriesListener(service.filters.entries)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,31 +25,31 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
|
|||
// TODO: use a central on-blur event
|
||||
var cachedWindowOnBlur = $window.onblur
|
||||
|
||||
service.open = function (options) {
|
||||
service.open = function(options) {
|
||||
|
||||
switch (fallbackMethod) {
|
||||
case 'USE_NEW_WINDOW':
|
||||
// Doesn't work well on Chrome
|
||||
windowOpened = $window.open(options.nativeUrl)
|
||||
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
if (windowOpened) {
|
||||
windowOpened.close()
|
||||
}
|
||||
}, 500)
|
||||
|
||||
$window.location.href = options.webUrl
|
||||
break;
|
||||
break
|
||||
case 'USE_ON_BLUR':
|
||||
// Doesn't work on Safari
|
||||
|
||||
$window.onblur = function () {
|
||||
$window.onblur = function() {
|
||||
wasBlured = true
|
||||
}
|
||||
|
||||
$window.location.href = options.nativeUrl
|
||||
|
||||
$timeout(function () {
|
||||
$timeout(function() {
|
||||
if (wasBlured) {
|
||||
wasBlured = false
|
||||
} else {
|
||||
|
@ -59,14 +59,14 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
|
|||
$window.onblur = cachedWindowOnBlur
|
||||
}, 250)
|
||||
|
||||
break;
|
||||
break
|
||||
case 'USE_TIME_ELAPSED':
|
||||
// Doesn't work on Chrome
|
||||
|
||||
var start, end, elapsed
|
||||
start = new Date().getTime()
|
||||
|
||||
console.log(' window.performance.webkitNow()', window.performance.now())
|
||||
// console.log(' window.performance.webkitNow()', window.performance.now())
|
||||
|
||||
// This depends on the fact that JS is single-thread
|
||||
document.location = options.nativeUrl
|
||||
|
@ -79,7 +79,7 @@ module.exports = function NativeUrlServiceFactory($window, $timeout) {
|
|||
document.location = options.webUrl
|
||||
}
|
||||
|
||||
break;
|
||||
break
|
||||
default:
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
/* Based on https://ryankaskel.com/blog/2013/05/27/
|
||||
a-different-approach-to-angularjs-navigation-menus */
|
||||
|
||||
module.exports = function ($location) {
|
||||
module.exports = function($location) {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
scope: {},
|
||||
link: function (scope, element, attrs) {
|
||||
link: function(scope, element, attrs) {
|
||||
var links = element.find('a')
|
||||
var onClass = attrs.navMenu || 'current'
|
||||
var routePattern
|
||||
var link
|
||||
var url
|
||||
var urlMap = []
|
||||
var routePattern, link, url
|
||||
|
||||
if (!$location.$$html5) {
|
||||
routePattern = /\/#[^/]*/
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
describe('navMenu', function () {
|
||||
describe('navMenu', function() {
|
||||
|
||||
beforeEach(angular.mock.module(require('./').name));
|
||||
beforeEach(angular.mock.module(require('./').name))
|
||||
|
||||
var scope, compile;
|
||||
var scope, compile
|
||||
|
||||
beforeEach(inject(function ($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
compile = $compile;
|
||||
}));
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new()
|
||||
compile = $compile
|
||||
}))
|
||||
|
||||
it('should ...', function () {
|
||||
it('should ...', function() {
|
||||
|
||||
/*
|
||||
To test your directive, you need to create some html that would use your
|
||||
|
@ -19,5 +19,5 @@ describe('navMenu', function () {
|
|||
expect(element.text()).toBe('hello, world');
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function () {
|
||||
module.exports = function() {
|
||||
var service = {}
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) {
|
||||
return function (scope, hotkeySet) {
|
||||
return function(scope, hotkeySet) {
|
||||
|
||||
function hotkeyAdd(combo, desc, callback, preventDefault) {
|
||||
hotkeys.add({
|
||||
combo: combo,
|
||||
description: $filter('translate')(desc),
|
||||
allowIn: ['textarea', 'input'],
|
||||
callback: function (event) {
|
||||
callback: function(event) {
|
||||
if (preventDefault || typeof preventDefault === 'undefined') {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ module.exports = function ScopedHotkeysServiceFactory(hotkeys, $filter) {
|
|||
})
|
||||
}
|
||||
|
||||
angular.forEach(hotkeySet, function (value) {
|
||||
angular.forEach(hotkeySet, function(value) {
|
||||
hotkeyAdd(value[0], value[1], value[2], value[3])
|
||||
})
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
angular.forEach(hotkeySet, function (value) {
|
||||
scope.$on('$destroy', function() {
|
||||
angular.forEach(hotkeySet, function(value) {
|
||||
hotkeys.del(value[0])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -26,11 +26,11 @@ function CanvasRender(canvasElement, options) {
|
|||
}
|
||||
}
|
||||
|
||||
CanvasRender.prototype.draw = function (image) {
|
||||
CanvasRender.prototype.draw = function(image) {
|
||||
this.context.drawImage(image, 0, 0)
|
||||
}
|
||||
|
||||
CanvasRender.prototype.clear = function () {
|
||||
CanvasRender.prototype.clear = function() {
|
||||
this.context.clearRect(0, 0, this.context.canvas.width,
|
||||
this.context.canvas.height)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ function FastImageRender(canvasElement, options) {
|
|||
this.timeoutId = null
|
||||
|
||||
if (that.options.raf) {
|
||||
that.animLoop = function () {
|
||||
that.animLoop = function() {
|
||||
that.raf = window.requireAnimationFrame(that.animLoop)
|
||||
|
||||
// separate render from drawing
|
||||
|
@ -19,19 +19,19 @@ function FastImageRender(canvasElement, options) {
|
|||
|
||||
// Loader
|
||||
this.loader = new Image()
|
||||
this.loader.onload = function () {
|
||||
this.loader.onload = function() {
|
||||
if (that.options.timeout) {
|
||||
clearTimeout(that.timeoutId)
|
||||
}
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(this)
|
||||
}
|
||||
}
|
||||
this.loader.onerror = function () {
|
||||
this.loader.onerror = function() {
|
||||
if (that.options.timeout) {
|
||||
clearTimeout(that.timeoutId)
|
||||
}
|
||||
if (typeof(that.onError) === 'function') {
|
||||
if (typeof (that.onError) === 'function') {
|
||||
that.onError(this)
|
||||
}
|
||||
}
|
||||
|
@ -47,19 +47,19 @@ function FastImageRender(canvasElement, options) {
|
|||
|
||||
}
|
||||
|
||||
FastImageRender.prototype.destroy = function () {
|
||||
FastImageRender.prototype.destroy = function() {
|
||||
|
||||
window.cancelAnimationFrame(this.raf)
|
||||
|
||||
// delete onLoad & onError
|
||||
}
|
||||
|
||||
FastImageRender.prototype.load = function (url, type) {
|
||||
FastImageRender.prototype.load = function(url, type) {
|
||||
var that = this
|
||||
|
||||
if (that.options.timeout) {
|
||||
that.timeoutId = setTimeout(function () {
|
||||
if (typeof(that.onError) === 'function') {
|
||||
that.timeoutId = setTimeout(function() {
|
||||
if (typeof (that.onError) === 'function') {
|
||||
that.onError('timeout')
|
||||
}
|
||||
}, that.options.timeout)
|
||||
|
@ -72,14 +72,14 @@ FastImageRender.prototype.load = function (url, type) {
|
|||
var texture = null
|
||||
if (type) {
|
||||
texture = this.render.ctx.createTexture()
|
||||
this.textureLoader.loadEx(url, texture, true, function () {
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
this.textureLoader.loadEx(url, texture, true, function() {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(texture)
|
||||
}
|
||||
}, type)
|
||||
} else {
|
||||
this.textureLoader.load(url, function (texture) {
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
this.textureLoader.load(url, function(texture) {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(texture)
|
||||
}
|
||||
})
|
||||
|
@ -91,19 +91,19 @@ FastImageRender.prototype.load = function (url, type) {
|
|||
}
|
||||
}
|
||||
|
||||
FastImageRender.prototype.draw = function (image) {
|
||||
FastImageRender.prototype.draw = function(image) {
|
||||
this.render.draw(image)
|
||||
}
|
||||
|
||||
FastImageRender.prototype.clear = function () {
|
||||
FastImageRender.prototype.clear = function() {
|
||||
this.render.clear()
|
||||
}
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.width
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width
|
||||
|
@ -113,10 +113,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
|
|||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.height
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height
|
||||
|
@ -126,10 +126,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
|
|||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.width
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width
|
||||
|
@ -139,10 +139,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
|
|||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.height
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height
|
||||
|
@ -152,10 +152,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
|
|||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return parseInt(this.canvasElement.style.width, 10)
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
var styleWidth = width + 'px'
|
||||
if (styleWidth !== this.canvasElement.style.width) {
|
||||
|
@ -166,10 +166,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
|
|||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return parseInt(this.canvasElement.style.height, 10)
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
var styleHeight = height + 'px'
|
||||
if (styleHeight !== this.canvasElement.style.height) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint no-console: 0 */
|
||||
|
||||
var canvasElement = document.querySelector('canvas')
|
||||
var frameNumberElement = document.querySelector('#frame-number')
|
||||
var totalTimeElement = document.querySelector('#total-time')
|
||||
|
@ -7,7 +9,7 @@ var frame = {
|
|||
current: 0
|
||||
}
|
||||
|
||||
function FastImageRender () {
|
||||
function FastImageRender() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,7 +37,7 @@ var startTime = new Date().getTime()
|
|||
|
||||
loadNext()
|
||||
|
||||
imageRender.onLoad = function (image) {
|
||||
imageRender.onLoad = function(image) {
|
||||
console.timeEnd('load')
|
||||
console.time('draw')
|
||||
imageRender.draw(image)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @param {WebGLRenderingContext} gl The GL context.
|
||||
* @constructor
|
||||
*/
|
||||
var Renderer = function (gl) {
|
||||
var Renderer = function(gl) {
|
||||
/**
|
||||
* The GL context.
|
||||
* @type {WebGLRenderingContext}
|
||||
|
@ -92,13 +92,13 @@ var Renderer = function (gl) {
|
|||
}
|
||||
|
||||
|
||||
Renderer.prototype.finishInit = function () {
|
||||
Renderer.prototype.finishInit = function() {
|
||||
this.draw()
|
||||
}
|
||||
|
||||
|
||||
Renderer.prototype.createDxtTexture =
|
||||
function (dxtData, width, height, format) {
|
||||
function(dxtData, width, height, format) {
|
||||
var gl = this.gl_
|
||||
var tex = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex)
|
||||
|
@ -120,7 +120,7 @@ Renderer.prototype.createDxtTexture =
|
|||
}
|
||||
|
||||
|
||||
Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) {
|
||||
Renderer.prototype.createRgb565Texture = function(rgb565Data, width, height) {
|
||||
var gl = this.gl_
|
||||
var tex = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex)
|
||||
|
@ -144,7 +144,7 @@ Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) {
|
|||
}
|
||||
|
||||
|
||||
Renderer.prototype.drawTexture = function (texture, width, height) {
|
||||
Renderer.prototype.drawTexture = function(texture, width, height) {
|
||||
var gl = this.gl_
|
||||
// draw scene
|
||||
gl.clearColor(0, 0, 0, 1)
|
||||
|
@ -171,7 +171,7 @@ Renderer.prototype.drawTexture = function (texture, width, height) {
|
|||
* @return {WebGLShader} The new WebGLShader.
|
||||
* @private
|
||||
*/
|
||||
Renderer.prototype.compileShader_ = function (shaderSource, type) {
|
||||
Renderer.prototype.compileShader_ = function(shaderSource, type) {
|
||||
var gl = this.gl_
|
||||
var shader = gl.createShader(type)
|
||||
gl.shaderSource(shader, shaderSource)
|
||||
|
@ -247,7 +247,7 @@ function WebGLRender(canvasElement) {
|
|||
//this.setup()
|
||||
}
|
||||
|
||||
WebGLRender.prototype.setup = function () {
|
||||
WebGLRender.prototype.setup = function() {
|
||||
// create shaders
|
||||
var vertexShaderSrc =
|
||||
'attribute vec2 aVertex;' +
|
||||
|
@ -305,13 +305,13 @@ WebGLRender.prototype.setup = function () {
|
|||
|
||||
}
|
||||
|
||||
WebGLRender.prototype.draw = function (image) {
|
||||
WebGLRender.prototype.draw = function(image) {
|
||||
// this.renderer.drawTexture(image, image.width, image.height)
|
||||
this.renderer.drawTexture(image, 643, 1149)
|
||||
}
|
||||
|
||||
|
||||
WebGLRender.prototype.drawOld = function (image) {
|
||||
WebGLRender.prototype.drawOld = function(image) {
|
||||
var tex = this.ctx.createTexture()
|
||||
this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex)
|
||||
this.ctx.texParameteri(
|
||||
|
@ -354,7 +354,7 @@ WebGLRender.prototype.drawOld = function (image) {
|
|||
this.ctx.vertexAttribPointer(this.tloc, 2, this.ctx.FLOAT, false, 0, 0)
|
||||
}
|
||||
|
||||
WebGLRender.prototype.clear = function () {
|
||||
WebGLRender.prototype.clear = function() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint no-console: 0 */
|
||||
var rotator = require('./rotator')
|
||||
|
||||
var tests = [
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = function ScalingServiceFactory() {
|
|||
var scalingService = {
|
||||
}
|
||||
|
||||
scalingService.coordinator = function (realWidth, realHeight) {
|
||||
scalingService.coordinator = function(realWidth, realHeight) {
|
||||
var realRatio = realWidth / realHeight
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ module.exports = function ScalingServiceFactory() {
|
|||
* |--------------|------|---------|---------|---------|
|
||||
*/
|
||||
return {
|
||||
coords: function (boundingW, boundingH, relX, relY, rotation) {
|
||||
coords: function(boundingW, boundingH, relX, relY, rotation) {
|
||||
var w, h, x, y, ratio, scaledValue
|
||||
|
||||
switch (rotation) {
|
||||
|
@ -138,7 +138,9 @@ module.exports = function ScalingServiceFactory() {
|
|||
, yP: y / h
|
||||
}
|
||||
}
|
||||
, size: function (width, height) {
|
||||
, size: function(sizeWidth, sizeHeight) {
|
||||
var width = sizeWidth
|
||||
var height = sizeHeight
|
||||
var ratio = width / height
|
||||
|
||||
if (realRatio > ratio) {
|
||||
|
@ -171,7 +173,7 @@ module.exports = function ScalingServiceFactory() {
|
|||
, height: height
|
||||
}
|
||||
}
|
||||
, projectedSize: function (boundingW, boundingH, rotation) {
|
||||
, projectedSize: function(boundingW, boundingH, rotation) {
|
||||
var w, h
|
||||
|
||||
switch (rotation) {
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = function DeviceScreenCtrl(
|
|||
$scope.displayError = false
|
||||
$scope.ScalingService = ScalingService
|
||||
|
||||
$scope.installFile = function ($files) {
|
||||
$scope.installFile = function($files) {
|
||||
return InstallService.installFile($scope.control, $files)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ module.exports = function DeviceScreenDirective(
|
|||
control: '&'
|
||||
, device: '&'
|
||||
}
|
||||
, link: function (scope, element) {
|
||||
, link: function(scope, element) {
|
||||
var URL = window.URL || window.webkitURL
|
||||
var BLANK_IMG =
|
||||
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
|
||||
var cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
|
||||
|
||||
var device = scope.device()
|
||||
, control = scope.control()
|
||||
var control = scope.control()
|
||||
|
||||
var input = element.find('input')
|
||||
|
||||
|
@ -74,8 +74,8 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
|
||||
var canvas = element.find('canvas')[0]
|
||||
, g = canvas.getContext('2d')
|
||||
, positioner = element.find('div')[0]
|
||||
var g = canvas.getContext('2d')
|
||||
var positioner = element.find('div')[0]
|
||||
|
||||
function vendorBackingStorePixelRatio(g) {
|
||||
return g.webkitBackingStorePixelRatio ||
|
||||
|
@ -86,8 +86,8 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
|
||||
var devicePixelRatio = window.devicePixelRatio || 1
|
||||
, backingStoreRatio = vendorBackingStorePixelRatio(g)
|
||||
, frontBackRatio = devicePixelRatio / backingStoreRatio
|
||||
var backingStoreRatio = vendorBackingStorePixelRatio(g)
|
||||
var frontBackRatio = devicePixelRatio / backingStoreRatio
|
||||
|
||||
var options = {
|
||||
autoScaleForRetina: true
|
||||
|
@ -101,8 +101,8 @@ module.exports = function DeviceScreenDirective(
|
|||
function updateBounds() {
|
||||
function adjustBoundedSize(w, h) {
|
||||
var sw = w * options.density
|
||||
, sh = h * options.density
|
||||
, f
|
||||
var sh = h * options.density
|
||||
var f
|
||||
|
||||
if (sw < (f = device.display.width * options.minscale)) {
|
||||
sw *= f / sw
|
||||
|
@ -122,7 +122,7 @@ module.exports = function DeviceScreenDirective(
|
|||
|
||||
// FIXME: element is an object HTMLUnknownElement in IE9
|
||||
var w = screen.bounds.w = element[0].offsetWidth
|
||||
, h = screen.bounds.h = element[0].offsetHeight
|
||||
var h = screen.bounds.h = element[0].offsetHeight
|
||||
|
||||
// Developer error, let's try to reduce debug time
|
||||
if (!w || !h) {
|
||||
|
@ -144,9 +144,9 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
})()
|
||||
|
||||
if (!adjustedBoundSize
|
||||
|| newAdjustedBoundSize.w !== adjustedBoundSize.w
|
||||
|| newAdjustedBoundSize.h !== adjustedBoundSize.h) {
|
||||
if (!adjustedBoundSize ||
|
||||
newAdjustedBoundSize.w !== adjustedBoundSize.w ||
|
||||
newAdjustedBoundSize.h !== adjustedBoundSize.h) {
|
||||
adjustedBoundSize = newAdjustedBoundSize
|
||||
onScreenInterestAreaChanged()
|
||||
}
|
||||
|
@ -215,10 +215,10 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
|
||||
var cachedImageWidth = 0
|
||||
, cachedImageHeight = 0
|
||||
, cssRotation = 0
|
||||
, alwaysUpright = false
|
||||
, imagePool = new ImagePool(10)
|
||||
var cachedImageHeight = 0
|
||||
var cssRotation = 0
|
||||
var alwaysUpright = false
|
||||
var imagePool = new ImagePool(10)
|
||||
|
||||
function applyQuirks(banner) {
|
||||
element[0].classList.toggle(
|
||||
|
@ -290,7 +290,7 @@ module.exports = function DeviceScreenDirective(
|
|||
if (message.data instanceof Blob) {
|
||||
if (shouldUpdateScreen()) {
|
||||
if (scope.displayError) {
|
||||
scope.$apply(function () {
|
||||
scope.$apply(function() {
|
||||
scope.displayError = false
|
||||
})
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ module.exports = function DeviceScreenDirective(
|
|||
applyQuirks(JSON.parse(message.data.substr('start '.length)))
|
||||
}
|
||||
else if (message.data === 'secure_on') {
|
||||
scope.$apply(function () {
|
||||
scope.$apply(function() {
|
||||
scope.displayError = 'secure'
|
||||
})
|
||||
}
|
||||
|
@ -356,22 +356,22 @@ module.exports = function DeviceScreenDirective(
|
|||
scope.$on('visibilitychange', checkEnabled)
|
||||
scope.$watch('$parent.showScreen', checkEnabled)
|
||||
|
||||
scope.retryLoadingScreen = function () {
|
||||
scope.retryLoadingScreen = function() {
|
||||
if (scope.displayError === 'secure') {
|
||||
control.home()
|
||||
}
|
||||
}
|
||||
|
||||
scope.$on('guest-portrait', function () {
|
||||
scope.$on('guest-portrait', function() {
|
||||
control.rotate(0)
|
||||
})
|
||||
|
||||
scope.$on('guest-landscape', function () {
|
||||
scope.$on('guest-landscape', function() {
|
||||
control.rotate(90)
|
||||
})
|
||||
|
||||
var canvasAspect = 1
|
||||
, parentAspect = 1
|
||||
var parentAspect = 1
|
||||
|
||||
function resizeListener() {
|
||||
parentAspect = element[0].offsetWidth / element[0].offsetHeight
|
||||
|
@ -513,12 +513,12 @@ module.exports = function DeviceScreenDirective(
|
|||
*/
|
||||
;(function() {
|
||||
var slots = []
|
||||
, slotted = Object.create(null)
|
||||
, fingers = []
|
||||
, seq = -1
|
||||
, cycle = 100
|
||||
, fakePinch = false
|
||||
, lastPossiblyBuggyMouseUpEvent = 0
|
||||
var slotted = Object.create(null)
|
||||
var fingers = []
|
||||
var seq = -1
|
||||
var cycle = 100
|
||||
var fakePinch = false
|
||||
var lastPossiblyBuggyMouseUpEvent = 0
|
||||
|
||||
function nextSeq() {
|
||||
return ++seq >= cycle ? (seq = 0) : seq
|
||||
|
@ -575,7 +575,8 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
}
|
||||
|
||||
function mouseDownListener(e) {
|
||||
function mouseDownListener(event) {
|
||||
var e = event
|
||||
if (e.originalEvent) {
|
||||
e = e.originalEvent
|
||||
}
|
||||
|
@ -593,9 +594,9 @@ module.exports = function DeviceScreenDirective(
|
|||
startMousing()
|
||||
|
||||
var x = e.pageX - screen.bounds.x
|
||||
, y = e.pageY - screen.bounds.y
|
||||
, pressure = 0.5
|
||||
, scaled = scaler.coords(
|
||||
var y = e.pageY - screen.bounds.y
|
||||
var pressure = 0.5
|
||||
var scaled = scaler.coords(
|
||||
screen.bounds.w
|
||||
, screen.bounds.h
|
||||
, x
|
||||
|
@ -634,7 +635,8 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
}
|
||||
|
||||
function mouseMoveListener(e) {
|
||||
function mouseMoveListener(event) {
|
||||
var e = event
|
||||
if (e.originalEvent) {
|
||||
e = e.originalEvent
|
||||
}
|
||||
|
@ -651,9 +653,9 @@ module.exports = function DeviceScreenDirective(
|
|||
fakePinch = e.altKey
|
||||
|
||||
var x = e.pageX - screen.bounds.x
|
||||
, y = e.pageY - screen.bounds.y
|
||||
, pressure = 0.5
|
||||
, scaled = scaler.coords(
|
||||
var y = e.pageY - screen.bounds.y
|
||||
var pressure = 0.5
|
||||
var scaled = scaler.coords(
|
||||
screen.bounds.w
|
||||
, screen.bounds.h
|
||||
, x
|
||||
|
@ -686,7 +688,8 @@ module.exports = function DeviceScreenDirective(
|
|||
}
|
||||
}
|
||||
|
||||
function mouseUpListener(e) {
|
||||
function mouseUpListener(event) {
|
||||
var e = event
|
||||
if (e.originalEvent) {
|
||||
e = e.originalEvent
|
||||
}
|
||||
|
@ -782,7 +785,8 @@ module.exports = function DeviceScreenDirective(
|
|||
control.gestureStop(nextSeq())
|
||||
}
|
||||
|
||||
function touchStartListener(e) {
|
||||
function touchStartListener(event) {
|
||||
var e = event
|
||||
e.preventDefault()
|
||||
|
||||
//Make it jQuery compatible also
|
||||
|
@ -800,7 +804,7 @@ module.exports = function DeviceScreenDirective(
|
|||
var i, l
|
||||
|
||||
for (i = 0, l = e.touches.length; i < l; ++i) {
|
||||
currentTouches[e.touches[i].identifier] = 1;
|
||||
currentTouches[e.touches[i].identifier] = 1
|
||||
}
|
||||
|
||||
function maybeLostTouchEnd(id) {
|
||||
|
@ -827,11 +831,11 @@ module.exports = function DeviceScreenDirective(
|
|||
|
||||
for (i = 0, l = e.changedTouches.length; i < l; ++i) {
|
||||
var touch = e.changedTouches[i]
|
||||
, slot = slots.pop()
|
||||
, x = touch.pageX - screen.bounds.x
|
||||
, y = touch.pageY - screen.bounds.y
|
||||
, pressure = touch.force || 0.5
|
||||
, scaled = scaler.coords(
|
||||
var slot = slots.pop()
|
||||
var x = touch.pageX - screen.bounds.x
|
||||
var y = touch.pageY - screen.bounds.y
|
||||
var pressure = touch.force || 0.5
|
||||
var scaled = scaler.coords(
|
||||
screen.bounds.w
|
||||
, screen.bounds.h
|
||||
, x
|
||||
|
@ -851,7 +855,8 @@ module.exports = function DeviceScreenDirective(
|
|||
control.touchCommit(nextSeq())
|
||||
}
|
||||
|
||||
function touchMoveListener(e) {
|
||||
function touchMoveListener(event) {
|
||||
var e = event
|
||||
e.preventDefault()
|
||||
|
||||
if (e.originalEvent) {
|
||||
|
@ -860,11 +865,11 @@ module.exports = function DeviceScreenDirective(
|
|||
|
||||
for (var i = 0, l = e.changedTouches.length; i < l; ++i) {
|
||||
var touch = e.changedTouches[i]
|
||||
, slot = slotted[touch.identifier]
|
||||
, x = touch.pageX - screen.bounds.x
|
||||
, y = touch.pageY - screen.bounds.y
|
||||
, pressure = touch.force || 0.5
|
||||
, scaled = scaler.coords(
|
||||
var slot = slotted[touch.identifier]
|
||||
var x = touch.pageX - screen.bounds.x
|
||||
var y = touch.pageY - screen.bounds.y
|
||||
var pressure = touch.force || 0.5
|
||||
var scaled = scaler.coords(
|
||||
screen.bounds.w
|
||||
, screen.bounds.h
|
||||
, x
|
||||
|
@ -879,7 +884,8 @@ module.exports = function DeviceScreenDirective(
|
|||
control.touchCommit(nextSeq())
|
||||
}
|
||||
|
||||
function touchEndListener(e) {
|
||||
function touchEndListener(event) {
|
||||
var e = event
|
||||
if (e.originalEvent) {
|
||||
e = e.originalEvent
|
||||
}
|
||||
|
@ -888,8 +894,8 @@ module.exports = function DeviceScreenDirective(
|
|||
|
||||
for (var i = 0, l = e.changedTouches.length; i < l; ++i) {
|
||||
var touch = e.changedTouches[i]
|
||||
, slot = slotted[touch.identifier]
|
||||
if (slot === void 0) {
|
||||
var slot = slotted[touch.identifier]
|
||||
if (typeof slot === 'undefined') {
|
||||
// We've already disposed of the contact. We may have gotten a
|
||||
// touchend event for the same contact twice.
|
||||
continue
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue