mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
All JSHint trough webpack passes now.
This commit is contained in:
parent
176bd002da
commit
ce604d8211
21 changed files with 395 additions and 413 deletions
|
@ -1,4 +1,5 @@
|
|||
module.exports = function angularDraggabillyDirective(DraggabillyService) {
|
||||
module.exports =
|
||||
function angularDraggabillyDirective(DraggabillyService, $parse) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
link: function (scope, element, attrs) {
|
||||
|
@ -10,6 +11,7 @@ module.exports = function angularDraggabillyDirective(DraggabillyService) {
|
|||
var options = angular.extend({
|
||||
}, parsedAttrs)
|
||||
|
||||
/* jshint unused: false */
|
||||
var draggie = new DraggabillyService(element[0], options)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,18 @@
|
|||
// NOTE: Most of the detections stuff from Modernizr 3.0
|
||||
// NOTE: Most of the detection stuff is from Modernizr 3.0
|
||||
module.exports = function BrowserInfoServiceFactory() {
|
||||
var service = {}
|
||||
|
||||
var domPrefixes = 'Webkit Moz O ms'.toLowerCase().split(' ')
|
||||
|
||||
function createElement() {
|
||||
return document.createElement.apply(document, arguments)
|
||||
}
|
||||
|
||||
function hasEvent() {
|
||||
return (function (undefined) {
|
||||
function isEventSupportedInner(eventName, element) {
|
||||
var isSupported
|
||||
if (!eventName) {
|
||||
return false
|
||||
}
|
||||
if (!element || typeof element === 'string') {
|
||||
element = createElement(element || 'div')
|
||||
}
|
||||
eventName = 'on' + eventName
|
||||
isSupported = eventName in element
|
||||
return isSupported
|
||||
}
|
||||
|
||||
return isEventSupportedInner
|
||||
})()
|
||||
}
|
||||
|
||||
function addTest(key, test) {
|
||||
service[key] = (typeof test == 'function') ? test() : test
|
||||
}
|
||||
|
||||
addTest('touch', function () {
|
||||
return ('ontouchstart' in window) || window.DocumentTouch &&
|
||||
document instanceof DocumentTouch
|
||||
document instanceof window.DocumentTouch
|
||||
})
|
||||
|
||||
addTest('retina', function () {
|
||||
|
@ -80,6 +59,26 @@ module.exports = function BrowserInfoServiceFactory() {
|
|||
|
||||
addTest('ua', navigator.userAgent)
|
||||
|
||||
|
||||
//function hasEvent() {
|
||||
// return (function (undefined) {
|
||||
// function isEventSupportedInner(eventName, element) {
|
||||
// var isSupported
|
||||
// if (!eventName) {
|
||||
// return false
|
||||
// }
|
||||
// if (!element || typeof element === 'string') {
|
||||
// element = createElement(element || 'div')
|
||||
// }
|
||||
// eventName = 'on' + eventName
|
||||
// isSupported = eventName in element
|
||||
// return isSupported
|
||||
// }
|
||||
//
|
||||
// return isEventSupportedInner
|
||||
// })()
|
||||
//}
|
||||
// var domPrefixes = 'Webkit Moz O ms'.toLowerCase().split(' ')
|
||||
// addTest('pointerevents', function () {
|
||||
// var bool = false
|
||||
// var i = domPrefixes.length
|
||||
|
|
|
@ -3,11 +3,9 @@ module.exports = function badgeIconDirective() {
|
|||
restrict: 'EA',
|
||||
replace: true,
|
||||
scope: {
|
||||
|
||||
},
|
||||
template: require('./badge-icon.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
link: function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function counterDirective($timeout, $$rAF) {
|
||||
module.exports = function counterDirective($timeout) {
|
||||
return {
|
||||
replace: false,
|
||||
scope: true,
|
||||
|
@ -52,7 +52,7 @@ module.exports = function counterDirective($timeout, $$rAF) {
|
|||
}
|
||||
})
|
||||
|
||||
attrs.$observe('countFrom', function (val) {
|
||||
attrs.$observe('countFrom', function (/*val*/) {
|
||||
start()
|
||||
})
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = function ServiceFactory($modal, $location) {
|
|||
controller: ModalInstanceCtrl
|
||||
})
|
||||
|
||||
modalInstance.result.then(function (selectedItem) {
|
||||
modalInstance.result.then(function (/*selectedItem*/) {
|
||||
}, function () {
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,11 +4,9 @@ module.exports = function niceTabDirective() {
|
|||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {
|
||||
|
||||
},
|
||||
template: require('./nice-tab.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
link: function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ module.exports = function niceTabsDirective() {
|
|||
replace: true,
|
||||
template: require('./nice-tabs.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
// TODO: add support for 'key' for saving in localstorage
|
||||
// TODO: add support for 'key' for saving in Settings
|
||||
// TODO: add support for 'direction=below' for below tabs
|
||||
|
||||
scope.$watch(attrs.tabs, function (newValue, oldValue) {
|
||||
scope.$watch(attrs.tabs, function (newValue) {
|
||||
scope.tabs = newValue
|
||||
})
|
||||
|
||||
scope.$watch(attrs.filter, function (newValue, oldValue) {
|
||||
scope.$watch(attrs.filter, function (newValue) {
|
||||
scope.filter = newValue
|
||||
})
|
||||
|
||||
|
|
|
@ -5,5 +5,4 @@ require('angular-growl')
|
|||
module.exports = angular.module('stf/common-ui/notifications', [
|
||||
'ngAnimate',
|
||||
'angular-growl'
|
||||
]).config(['growlProvider', function (growlProvider) {
|
||||
}])
|
||||
])
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
module.exports = function tooltipsDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
link: function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ module.exports = angular.module('stf.device-status', [])
|
|||
}[text] || gettext('-')
|
||||
}
|
||||
})
|
||||
.filter('displayDensity', function (gettext) {
|
||||
.filter('displayDensity', function () {
|
||||
return function (text) {
|
||||
return {
|
||||
'0.5': 'LDPI', // (120 dpi)
|
||||
|
@ -102,7 +102,7 @@ module.exports = angular.module('stf.device-status', [])
|
|||
.filter('networkSubType', function (gettext) {
|
||||
return function (text) {
|
||||
return {
|
||||
'mobile_wifi': gettext('WiFi'),
|
||||
'mobile_wifi': gettext('WiFi')
|
||||
}[text] || text
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function imageOnloadAnimateDirective($parse, $animate) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function (scope, element) {
|
||||
$animate.addClass(element, 'ng-image-not-loaded')
|
||||
element.bind('load', function () {
|
||||
$animate.removeClass(element, 'ng-image-not-loaded')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function imageOnloadDirective($parse) {
|
||||
module.exports = function imageOnloadDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
module.exports = function landscapeDirective(BrowserInfo, $document, $window, $rootScope) {
|
||||
module.exports =
|
||||
function landscapeDirective(BrowserInfo, $document, $window) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs) {
|
||||
link: function (scope) {
|
||||
var body = angular.element($document[0].body)
|
||||
|
||||
if (typeof $window.orientation !== 'undefined') {
|
||||
if ($window.orientation === 0) {
|
||||
//rotateGuest(true)
|
||||
} else {
|
||||
if ($window.orientation !== 0) {
|
||||
rotateGuest(false)
|
||||
}
|
||||
}
|
||||
|
@ -28,18 +27,20 @@ module.exports = function landscapeDirective(BrowserInfo, $document, $window, $r
|
|||
}
|
||||
}
|
||||
|
||||
function guestDisplayRotatated(eventData) {
|
||||
function guestDisplayRotated() {
|
||||
var isPortrait = (window.innerHeight > window.innerWidth)
|
||||
rotateGuest(isPortrait)
|
||||
}
|
||||
|
||||
if (BrowserInfo.deviceorientation) {
|
||||
window.addEventListener('orientationchange', guestDisplayRotatated, true)
|
||||
window.addEventListener('orientationchange', guestDisplayRotated,
|
||||
true)
|
||||
}
|
||||
|
||||
function off() {
|
||||
if (BrowserInfo.deviceorientation) {
|
||||
window.removeEventListener('orientationchange', guestDisplayRotatated)
|
||||
window.removeEventListener('orientationchange',
|
||||
guestDisplayRotated)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
var _ = require('lodash')
|
||||
|
||||
module.exports = function logcatTableDirective($rootScope, $timeout, LogcatService) {
|
||||
module.exports =
|
||||
function logcatTableDirective($rootScope, $timeout, LogcatService) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
template: require('./logcat-table.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
link: function (scope, element) {
|
||||
var autoScroll = true
|
||||
var autoScrollDependingOnScrollPosition = true
|
||||
var scrollPosition = 0
|
||||
|
|
|
@ -16,7 +16,8 @@ CanvasRender.prototype.draw = function (image) {
|
|||
}
|
||||
|
||||
CanvasRender.prototype.clear = function () {
|
||||
this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height)
|
||||
this.context.clearRect(0, 0, this.context.canvas.width,
|
||||
this.context.canvas.height)
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,99 +38,95 @@ var Renderer = function (gl) {
|
|||
* @type {WebGLRenderingContext}
|
||||
* @private
|
||||
*/
|
||||
this.gl_ = gl;
|
||||
this.gl_ = gl
|
||||
|
||||
/**
|
||||
* The WebGLProgram.
|
||||
* @type {WebGLProgram}
|
||||
* @private
|
||||
*/
|
||||
this.program_ = gl.createProgram();
|
||||
this.program_ = gl.createProgram()
|
||||
|
||||
/**
|
||||
* @type {WebGLShader}
|
||||
* @private
|
||||
*/
|
||||
this.vertexShader_ = this.compileShader_(
|
||||
Renderer.vertexShaderSource_, gl.VERTEX_SHADER);
|
||||
Renderer.vertexShaderSource_, gl.VERTEX_SHADER)
|
||||
|
||||
/**
|
||||
* @type {WebGLShader}
|
||||
* @private
|
||||
*/
|
||||
this.fragmentShader_ = this.compileShader_(
|
||||
Renderer.fragmentShaderSource_, gl.FRAGMENT_SHADER);
|
||||
Renderer.fragmentShaderSource_, gl.FRAGMENT_SHADER)
|
||||
|
||||
/**
|
||||
* Cached uniform locations.
|
||||
* @type {Object.<string, WebGLUniformLocation>}
|
||||
* @private
|
||||
*/
|
||||
this.uniformLocations_ = {};
|
||||
this.uniformLocations_ = {}
|
||||
|
||||
/**
|
||||
* Cached attribute locations.
|
||||
* @type {Object.<string, WebGLActiveInfo>}
|
||||
* @private
|
||||
*/
|
||||
this.attribLocations_ = {};
|
||||
this.attribLocations_ = {}
|
||||
|
||||
/**
|
||||
* A vertex buffer containing a single quad with xy coordinates from [-1,-1]
|
||||
* to [1,1] and uv coordinates from [0,0] to [1,1].
|
||||
* @private
|
||||
*/
|
||||
this.quadVertexBuffer_ = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVertexBuffer_);
|
||||
this.quadVertexBuffer_ = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVertexBuffer_)
|
||||
var vertices = new Float32Array(
|
||||
[-1.0, -1.0, 0.0, 1.0,
|
||||
+1.0, -1.0, 1.0, 1.0,
|
||||
-1.0, +1.0, 0.0, 0.0,
|
||||
1.0, +1.0, 1.0, 0.0]);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
1.0, +1.0, 1.0, 0.0])
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW)
|
||||
|
||||
|
||||
// Init shaders
|
||||
gl.attachShader(this.program_, this.vertexShader_);
|
||||
gl.attachShader(this.program_, this.fragmentShader_);
|
||||
gl.bindAttribLocation(this.program_, 0, 'vert');
|
||||
gl.linkProgram(this.program_);
|
||||
gl.useProgram(this.program_);
|
||||
gl.enableVertexAttribArray(0);
|
||||
gl.attachShader(this.program_, this.vertexShader_)
|
||||
gl.attachShader(this.program_, this.fragmentShader_)
|
||||
gl.bindAttribLocation(this.program_, 0, 'vert')
|
||||
gl.linkProgram(this.program_)
|
||||
gl.useProgram(this.program_)
|
||||
gl.enableVertexAttribArray(0)
|
||||
|
||||
gl.enable(gl.DEPTH_TEST);
|
||||
gl.disable(gl.CULL_FACE);
|
||||
gl.enable(gl.DEPTH_TEST)
|
||||
gl.disable(gl.CULL_FACE)
|
||||
|
||||
var count = gl.getProgramParameter(this.program_, gl.ACTIVE_UNIFORMS);
|
||||
var count = gl.getProgramParameter(this.program_, gl.ACTIVE_UNIFORMS)
|
||||
for (var i = 0; i < /** @type {number} */(count); i++) {
|
||||
var infoU = gl.getActiveUniform(this.program_, i);
|
||||
var infoU = gl.getActiveUniform(this.program_, i)
|
||||
this.uniformLocations_[infoU.name] =
|
||||
gl.getUniformLocation(this.program_, infoU.name);
|
||||
gl.getUniformLocation(this.program_, infoU.name)
|
||||
}
|
||||
|
||||
count = gl.getProgramParameter(this.program_, gl.ACTIVE_ATTRIBUTES);
|
||||
count = gl.getProgramParameter(this.program_, gl.ACTIVE_ATTRIBUTES)
|
||||
for (var j = 0; j < /** @type {number} */(count); j++) {
|
||||
var infoA = gl.getActiveAttrib(this.program_, j);
|
||||
var infoA = gl.getActiveAttrib(this.program_, j)
|
||||
this.attribLocations_[infoA.name] =
|
||||
gl.getAttribLocation(this.program_, infoA.name);
|
||||
gl.getAttribLocation(this.program_, infoA.name)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Renderer.prototype.finishInit = function () {
|
||||
this.draw();
|
||||
};
|
||||
this.draw()
|
||||
}
|
||||
|
||||
|
||||
Renderer.prototype.createDxtTexture = function (
|
||||
dxtData
|
||||
, width
|
||||
, height
|
||||
, format
|
||||
) {
|
||||
var gl = this.gl_;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
Renderer.prototype.createDxtTexture =
|
||||
function (dxtData, width, height, format) {
|
||||
var gl = this.gl_
|
||||
var tex = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex)
|
||||
gl.compressedTexImage2D(
|
||||
gl.TEXTURE_2D,
|
||||
0,
|
||||
|
@ -137,21 +134,21 @@ Renderer.prototype.createDxtTexture = function (
|
|||
width,
|
||||
height,
|
||||
0,
|
||||
dxtData);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
dxtData)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
|
||||
//gl.generateMipmap(gl.TEXTURE_2D)
|
||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||
return tex;
|
||||
};
|
||||
gl.bindTexture(gl.TEXTURE_2D, null)
|
||||
return tex
|
||||
}
|
||||
|
||||
|
||||
Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) {
|
||||
var gl = this.gl_;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
var gl = this.gl_
|
||||
var tex = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex)
|
||||
gl.texImage2D(
|
||||
gl.TEXTURE_2D,
|
||||
0,
|
||||
|
@ -161,35 +158,35 @@ Renderer.prototype.createRgb565Texture = function (rgb565Data, width, height) {
|
|||
0,
|
||||
gl.RGB,
|
||||
gl.UNSIGNED_SHORT_5_6_5,
|
||||
rgb565Data);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
rgb565Data)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
|
||||
//gl.generateMipmap(gl.TEXTURE_2D)
|
||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||
return tex;
|
||||
};
|
||||
gl.bindTexture(gl.TEXTURE_2D, null)
|
||||
return tex
|
||||
}
|
||||
|
||||
|
||||
Renderer.prototype.drawTexture = function (texture, width, height) {
|
||||
var gl = this.gl_;
|
||||
var gl = this.gl_
|
||||
// draw scene
|
||||
gl.clearColor(0, 0, 0, 1);
|
||||
gl.clearDepth(1.0);
|
||||
gl.viewport(0, 0, width, height);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
|
||||
gl.clearColor(0, 0, 0, 1)
|
||||
gl.clearDepth(1.0)
|
||||
gl.viewport(0, 0, width, height)
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT)
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||
gl.uniform1i(this.uniformLocations_.texSampler, 0);
|
||||
gl.activeTexture(gl.TEXTURE0)
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture)
|
||||
gl.uniform1i(this.uniformLocations_.texSampler, 0)
|
||||
|
||||
gl.enableVertexAttribArray(this.attribLocations_.vert);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVertexBuffer_);
|
||||
gl.enableVertexAttribArray(this.attribLocations_.vert)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVertexBuffer_)
|
||||
gl.vertexAttribPointer(this.attribLocations_.vert, 4, gl.FLOAT,
|
||||
false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
};
|
||||
false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -200,12 +197,12 @@ Renderer.prototype.drawTexture = function (texture, width, height) {
|
|||
* @private
|
||||
*/
|
||||
Renderer.prototype.compileShader_ = function (shaderSource, type) {
|
||||
var gl = this.gl_;
|
||||
var shader = gl.createShader(type);
|
||||
gl.shaderSource(shader, shaderSource);
|
||||
gl.compileShader(shader);
|
||||
return shader;
|
||||
};
|
||||
var gl = this.gl_
|
||||
var shader = gl.createShader(type)
|
||||
gl.shaderSource(shader, shaderSource)
|
||||
gl.compileShader(shader)
|
||||
return shader
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -219,7 +216,7 @@ Renderer.vertexShaderSource_ = [
|
|||
' gl_Position = vec4(vert.xy, 0.0, 1.0);',
|
||||
' v_texCoord = vert.zw;',
|
||||
'}'
|
||||
].join('\n');
|
||||
].join('\n')
|
||||
|
||||
|
||||
/**
|
||||
|
@ -233,7 +230,7 @@ Renderer.fragmentShaderSource_ = [
|
|||
'void main() {',
|
||||
' gl_FragColor = texture2D(texSampler, v_texCoord);',
|
||||
'}'
|
||||
].join('\n');
|
||||
].join('\n')
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -284,7 +281,7 @@ WebGLRender.prototype.setup = function () {
|
|||
'void main(void) {' +
|
||||
' gl_Position = vec4(aVertex, 0.0, 1.0);' +
|
||||
' vTex = aUV;' +
|
||||
'}';
|
||||
'}'
|
||||
|
||||
var fragmentShaderSrc =
|
||||
'precision highp float;' +
|
||||
|
@ -292,7 +289,7 @@ WebGLRender.prototype.setup = function () {
|
|||
'uniform sampler2D sampler0;' +
|
||||
'void main(void){' +
|
||||
' gl_FragColor = texture2D(sampler0, vTex);' +
|
||||
'}';
|
||||
'}'
|
||||
|
||||
var vertShaderObj = this.ctx.createShader(this.ctx.VERTEX_SHADER)
|
||||
var fragShaderObj = this.ctx.createShader(this.ctx.FRAGMENT_SHADER)
|
||||
|
@ -316,18 +313,9 @@ WebGLRender.prototype.setup = function () {
|
|||
this.vertexBuff = this.ctx.createBuffer()
|
||||
this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, this.vertexBuff)
|
||||
this.ctx.bufferData(
|
||||
this.ctx.ARRAY_BUFFER
|
||||
, new Float32Array([
|
||||
-1 / 8
|
||||
, 1 / 6
|
||||
, -1 / 8
|
||||
, -1 / 6
|
||||
, 1 / 8
|
||||
, -1 / 6
|
||||
, 1 / 8
|
||||
, 1 / 6
|
||||
])
|
||||
, this.ctx.STATIC_DRAW
|
||||
this.ctx.ARRAY_BUFFER, new Float32Array([
|
||||
-1 / 8, 1 / 6, -1 / 8, -1 / 6, 1 / 8, -1 / 6, 1 / 8, 1 / 6
|
||||
]), this.ctx.STATIC_DRAW
|
||||
)
|
||||
|
||||
this.texBuff = this.ctx.createBuffer()
|
||||
|
@ -345,7 +333,6 @@ WebGLRender.prototype.setup = function () {
|
|||
WebGLRender.prototype.draw = function (image) {
|
||||
// this.renderer.drawTexture(image, image.width, image.height)
|
||||
this.renderer.drawTexture(image, 643, 1149)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,14 +340,10 @@ WebGLRender.prototype.drawOld = function (image) {
|
|||
var tex = this.ctx.createTexture()
|
||||
this.ctx.bindTexture(this.ctx.TEXTURE_2D, tex)
|
||||
this.ctx.texParameteri(
|
||||
this.ctx.TEXTURE_2D
|
||||
, this.ctx.TEXTURE_MIN_FILTER
|
||||
, this.ctx.NEAREST
|
||||
this.ctx.TEXTURE_2D, this.ctx.TEXTURE_MIN_FILTER, this.ctx.NEAREST
|
||||
)
|
||||
this.ctx.texParameteri(
|
||||
this.ctx.TEXTURE_2D
|
||||
, this.ctx.TEXTURE_MAG_FILTER
|
||||
, this.ctx.NEAREST
|
||||
this.ctx.TEXTURE_2D, this.ctx.TEXTURE_MAG_FILTER, this.ctx.NEAREST
|
||||
)
|
||||
/*
|
||||
this.ctx.texParameteri(
|
||||
|
@ -382,12 +365,8 @@ WebGLRender.prototype.drawOld = function (image) {
|
|||
*/
|
||||
this.ctx.generateMipmap(this.ctx.TEXTURE_2D)
|
||||
this.ctx.texImage2D(
|
||||
this.ctx.TEXTURE_2D
|
||||
, 0
|
||||
, this.ctx.RGBA
|
||||
, this.ctx.RGBA
|
||||
, this.ctx.UNSIGNED_BYTE
|
||||
, image
|
||||
this.ctx.TEXTURE_2D, 0, this.ctx.RGBA, this.ctx.RGBA,
|
||||
this.ctx.UNSIGNED_BYTE, image
|
||||
)
|
||||
|
||||
this.ctx.enableVertexAttribArray(this.vloc)
|
||||
|
@ -416,14 +395,14 @@ function FastImageRender(canvasElement, options) {
|
|||
|
||||
if (that.options.raf) {
|
||||
that.animLoop = function () {
|
||||
that.raf = requireAnimationFrame(that.animLoop)
|
||||
that.raf = window.requireAnimationFrame(that.animLoop)
|
||||
|
||||
// separate render from drawing
|
||||
// render
|
||||
}
|
||||
}
|
||||
|
||||
if (true) {
|
||||
// Loader
|
||||
this.loader = new Image()
|
||||
this.loader.onload = function () {
|
||||
if (that.options.timeout) {
|
||||
|
@ -441,7 +420,6 @@ function FastImageRender(canvasElement, options) {
|
|||
that.onError(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.render === 'webgl') {
|
||||
this.render = new WebGLRender(canvasElement, options)
|
||||
|
@ -454,7 +432,7 @@ function FastImageRender(canvasElement, options) {
|
|||
|
||||
FastImageRender.prototype.destroy = function () {
|
||||
|
||||
cancelAnimationFrame(this.raf)
|
||||
window.cancelAnimationFrame(this.raf)
|
||||
|
||||
// delete onLoad & onError
|
||||
}
|
||||
|
@ -472,11 +450,11 @@ FastImageRender.prototype.load = function (url, type) {
|
|||
|
||||
if (this.options.textureLoader) {
|
||||
if (!this.textureLoader) {
|
||||
this.textureLoader = new TextureUtil.TextureLoader(this.render.ctx)
|
||||
this.textureLoader = new window.TextureUtil.TextureLoader(this.render.ctx)
|
||||
}
|
||||
var texture = null
|
||||
if (type) {
|
||||
texture = this.render.ctx.createTexture();
|
||||
texture = this.render.ctx.createTexture()
|
||||
this.textureLoader.loadEx(url, texture, true, function () {
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
that.onLoad(texture)
|
||||
|
@ -511,7 +489,7 @@ Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
|
|||
set: function (width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width;
|
||||
this.canvasElement.width = width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +502,7 @@ Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
|
|||
set: function (height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height;
|
||||
this.canvasElement.height = height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +515,7 @@ Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
|
|||
set: function (width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width;
|
||||
this.canvasElement.width = width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -550,7 +528,7 @@ Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
|
|||
set: function (height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height;
|
||||
this.canvasElement.height = height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -564,7 +542,7 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
|
|||
if (width) {
|
||||
var styleWidth = width + 'px'
|
||||
if (styleWidth !== this.canvasElement.style.width) {
|
||||
this.canvasElement.style.width = styleWidth;
|
||||
this.canvasElement.style.width = styleWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +556,7 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', {
|
|||
if (height) {
|
||||
var styleHeight = height + 'px'
|
||||
if (styleHeight !== this.canvasElement.style.height) {
|
||||
this.canvasElement.style.height = height;
|
||||
this.canvasElement.style.height = height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,33 @@
|
|||
var FastImageRender = require('./fast-image-render').FastImageRender
|
||||
var _ = require('lodash')
|
||||
|
||||
module.exports = function DeviceScreenDirective($document, ScalingService, VendorUtil, PageVisibilityService, BrowserInfo, $timeout) {
|
||||
module.exports = function DeviceScreenDirective($document, ScalingService,
|
||||
VendorUtil, PageVisibilityService, BrowserInfo, $timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: require('./screen.jade'),
|
||||
link: function (scope, element) {
|
||||
var canvas = element.find('canvas')[0]
|
||||
, imageRender = new FastImageRender(canvas, {render: 'canvas', timeout: 3000})
|
||||
, guestDisplayDensity = setDisplayDensity(1.5)
|
||||
, guestDisplayRotation = 0
|
||||
, finger = element.find('span')
|
||||
, input = element.find('input')
|
||||
, boundingWidth = 0 // TODO: cache inside FastImageRender?
|
||||
, boundingHeight = 0
|
||||
, cachedBoundingWidth = 0
|
||||
, cachedBoundingHeight = 0
|
||||
, cachedImageWidth = 0
|
||||
, cachedImageHeight = 0
|
||||
, cachedRotation = 0
|
||||
, rotation = 0
|
||||
, loading = false
|
||||
, scaler
|
||||
, seq = 0
|
||||
, cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
|
||||
var imageRender = new FastImageRender(canvas, {
|
||||
render: 'canvas',
|
||||
timeout: 3000
|
||||
})
|
||||
var guestDisplayDensity = setDisplayDensity(1.5)
|
||||
//var guestDisplayRotation = 0
|
||||
var finger = element.find('span')
|
||||
var input = element.find('input')
|
||||
var boundingWidth = 0 // TODO: cache inside FastImageRender?
|
||||
var boundingHeight = 0
|
||||
var cachedBoundingWidth = 0
|
||||
var cachedBoundingHeight = 0
|
||||
var cachedImageWidth = 0
|
||||
var cachedImageHeight = 0
|
||||
var cachedRotation = 0
|
||||
var rotation = 0
|
||||
var loading = false
|
||||
var scaler
|
||||
var seq = 0
|
||||
var cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
|
||||
|
||||
// NOTE: instead of fa-pane-resize, a fa-child-pane-resize could be better
|
||||
var onPanelResizeThrottled = _.throttle(updateBounds, 16)
|
||||
|
@ -32,7 +36,10 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo
|
|||
function setDisplayDensity(forRetina) {
|
||||
// FORCE
|
||||
forRetina = 1.2
|
||||
return guestDisplayDensity = BrowserInfo.mobile && BrowserInfo.retina ? forRetina : 1
|
||||
|
||||
guestDisplayDensity =
|
||||
BrowserInfo.mobile && BrowserInfo.retina ? forRetina : 1
|
||||
return guestDisplayDensity
|
||||
}
|
||||
|
||||
function sendTouch(type, e) {
|
||||
|
@ -56,9 +63,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo
|
|||
'translate3d(' + x + 'px,' + y + 'px,0)'
|
||||
|
||||
scope.control[type](
|
||||
seq++
|
||||
, scaled.xP
|
||||
, scaled.yP
|
||||
seq++, scaled.xP, scaled.yP
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -216,8 +221,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo
|
|||
|
||||
function on() {
|
||||
scaler = ScalingService.coordinator(
|
||||
scope.device.display.width
|
||||
, scope.device.display.height
|
||||
scope.device.display.width, scope.device.display.height
|
||||
)
|
||||
|
||||
imageRender.onLoad = function (image) {
|
||||
|
@ -244,9 +248,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo
|
|||
imageRender.canvasHeight = cachedImageHeight
|
||||
|
||||
var size = scaler.projectedSize(
|
||||
boundingWidth
|
||||
, boundingHeight
|
||||
, rotation
|
||||
boundingWidth, boundingHeight, rotation
|
||||
)
|
||||
|
||||
imageRender.canvasStyleWidth = size.width
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = function SocketStateDirectiveFactory(socket, growl, gettext, $filter) {
|
||||
module.exports = function SocketStateDirectiveFactory(socket, growl, gettext,
|
||||
$filter) {
|
||||
|
||||
return {
|
||||
restrict: 'EA',
|
||||
template: require('./socket-state.jade'),
|
||||
// scope: {
|
||||
// }
|
||||
link: function (scope) {
|
||||
var hasFailedOnce = false
|
||||
|
||||
|
@ -55,27 +55,33 @@ module.exports = function SocketStateDirectiveFactory(socket, growl, gettext, $f
|
|||
hasFailedOnce = true
|
||||
})
|
||||
|
||||
scope.$watch('socketState', function (newValue, oldValue) {
|
||||
scope.$watch('socketState', function (newValue) {
|
||||
if (newValue) {
|
||||
if (newValue === 'connect') {
|
||||
if (hasFailedOnce) {
|
||||
growl.success('<h4>WebSocket</h4>' + $filter('translate')(gettext('Connected successfully.')) + '<refresh-page></refresh-page>', {ttl: 2000})
|
||||
growl.success('<h4>WebSocket</h4>' + $filter('translate')(
|
||||
gettext('Connected successfully.')) +
|
||||
'<refresh-page></refresh-page>', {ttl: 2000})
|
||||
}
|
||||
} else {
|
||||
switch (newValue) {
|
||||
case 'disconnect':
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(gettext('Disconnected.<br />Socket connection was lost, try again reloading the page.')), {ttl: -1})
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(
|
||||
gettext('Socket connection was lost, try again reloading the page.')),
|
||||
{ttl: -1})
|
||||
break;
|
||||
case 'connect_error':
|
||||
case 'connect_error':
|
||||
case 'error':
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(gettext('Error.'), {ttl: -1}))
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(
|
||||
gettext('Error.'), {ttl: -1}))
|
||||
break;
|
||||
case 'reconnect_failed':
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(gettext('Error while reconnecting.')), {ttl: -1})
|
||||
growl.error('<h4>WebSocket</h4>' + $filter('translate')(
|
||||
gettext('Error while reconnecting.')), {ttl: -1})
|
||||
break;
|
||||
case 'reconnect':
|
||||
growl.success('<h4>WebSocket</h4>' + $filter('translate')(gettext('Reconnected successfully.')), {ttl: -1})
|
||||
growl.success('<h4>WebSocket</h4>' + $filter('translate')(
|
||||
gettext('Reconnected successfully.')), {ttl: -1})
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var _ = require('lodash')
|
||||
|
||||
module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsService, gettext) {
|
||||
module.exports = function PortForwardingCtrl($scope, ngTableParams,
|
||||
SettingsService, gettext) {
|
||||
|
||||
$scope.forwarding = false
|
||||
|
||||
|
@ -62,7 +63,8 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ
|
|||
|
||||
|
||||
function portFieldsAreEmpty(ports) {
|
||||
return (_.isEmpty(ports.targetHost) && _.isEmpty(ports.targetPort) && _.isEmpty(ports.devicePort))
|
||||
return (_.isEmpty(ports.targetHost) && _.isEmpty(ports.targetPort) &&
|
||||
_.isEmpty(ports.devicePort))
|
||||
}
|
||||
|
||||
$scope.portSets = [
|
||||
|
@ -96,7 +98,7 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ
|
|||
}
|
||||
|
||||
// Adds a new row whenever necessary
|
||||
$scope.$watch('portSets', function (newValue, oldValue) {
|
||||
$scope.$watch('portSets', function (newValue) {
|
||||
if (newValue) {
|
||||
// Remove all empty sets from the middle
|
||||
_.remove(newValue, function (ports, index) {
|
||||
|
@ -108,12 +110,8 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ
|
|||
if (!portFieldsAreEmpty(last)) {
|
||||
createEmptyField()
|
||||
}
|
||||
} else {
|
||||
// createEmptyField()
|
||||
}
|
||||
|
||||
//SettingsService.setItem('PortForwarding.portSets', angular.copy($scope.portSets))
|
||||
|
||||
}, true)
|
||||
|
||||
$scope.portsTable = new ngTableParams({
|
||||
|
@ -122,9 +120,7 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ
|
|||
}, {
|
||||
counts: [],
|
||||
total: 1,
|
||||
getData: function ($defer, params) {
|
||||
|
||||
|
||||
getData: function ($defer) {
|
||||
$defer.resolve($scope.portSets)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// See https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
|
||||
|
||||
module.exports = function ShellCtrl($scope, gettext) {
|
||||
module.exports = function ShellCtrl($scope) {
|
||||
$scope.result = null
|
||||
|
||||
var run = function (command) {
|
||||
|
@ -13,7 +13,9 @@ module.exports = function ShellCtrl($scope, gettext) {
|
|||
}
|
||||
|
||||
function openSetting(activity) {
|
||||
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings\$' + activity)
|
||||
// TODO: CHECK THIS
|
||||
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings\\$' +
|
||||
activity)
|
||||
}
|
||||
|
||||
$scope.openSettings = function () {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function ClipboardCtrl($scope, gettext) {
|
||||
module.exports = function ClipboardCtrl() {
|
||||
// $scope.clipboardContent = null
|
||||
//
|
||||
// $scope.getClipboardContent = function () {
|
||||
|
|
|
@ -14,6 +14,7 @@ module.exports = function NavigationCtrl($scope, $rootScope) {
|
|||
$scope.urlFavicon = require('./default-favicon.png')
|
||||
faviconIsSet = false
|
||||
}
|
||||
|
||||
resetFavicon()
|
||||
|
||||
$scope.textUrlChanged = function () {
|
||||
|
@ -31,7 +32,7 @@ module.exports = function NavigationCtrl($scope, $rootScope) {
|
|||
|
||||
$scope.blurUrl = false
|
||||
|
||||
$scope.openURL = function ($event) {
|
||||
$scope.openURL = function () {
|
||||
$scope.blurUrl = true
|
||||
$rootScope.screenFocus = true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue