1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

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

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

View file

@ -58,14 +58,14 @@ module.exports = function DeviceColumnService($filter, gettext) {
}
, compare: function(deviceA, deviceB) {
var va = (deviceA.version || '0').split('.')
, vb = (deviceB.version || '0').split('.')
, la = va.length
, lb = vb.length
var vb = (deviceB.version || '0').split('.')
var la = va.length
var lb = vb.length
for (var i = 0, l = Math.max(la, lb); i < l; ++i) {
var a = i < la ? parseInt(va[i], 10) : 0
, b = i < lb ? parseInt(vb[i], 10) : 0
, diff = a - b
var b = i < lb ? parseInt(vb[i], 10) : 0
var diff = a - b
// One of the values might be something like 'M'. If so, do a string
// comparison instead.
@ -82,10 +82,10 @@ module.exports = function DeviceColumnService($filter, gettext) {
}
, filter: function(device, filter) {
var va = (device.version || '0').split('.')
, vb = (filter.query || '0').split('.')
, la = va.length
, lb = vb.length
, op = filterOps[filter.op || '=']
var vb = (filter.query || '0').split('.')
var la = va.length
var lb = vb.length
var op = filterOps[filter.op || '=']
// We have a single value and no operator or field. It matches
// too easily, let's wait for a dot (e.g. '5.'). An example of a
@ -106,7 +106,7 @@ module.exports = function DeviceColumnService($filter, gettext) {
for (var i = 0, l = Math.min(la, lb); i < l; ++i) {
var a = parseInt(va[i], 10)
, b = parseInt(vb[i], 10)
var b = parseInt(vb[i], 10)
// One of the values might be non-numeric, e.g. 'M'. In that case
// filter by string value instead.
@ -231,7 +231,7 @@ module.exports = function DeviceColumnService($filter, gettext) {
}
, compare: function(deviceA, deviceB) {
var va = deviceA.battery ? deviceA.battery.level : 0
, vb = deviceB.battery ? deviceB.battery.level : 0
var vb = deviceB.battery ? deviceB.battery.level : 0
return va - vb
}
})
@ -242,7 +242,7 @@ module.exports = function DeviceColumnService($filter, gettext) {
}
, compare: function(deviceA, deviceB) {
var va = deviceA.battery ? deviceA.battery.temp : 0
, vb = deviceB.battery ? deviceB.battery.temp : 0
var vb = deviceB.battery ? deviceB.battery.temp : 0
return va - vb
}
})
@ -277,27 +277,36 @@ function zeroPadTwoDigit(digit) {
function compareIgnoreCase(a, b) {
var la = (a || '').toLowerCase()
, lb = (b || '').toLowerCase()
return la === lb ? 0 : (la < lb ? -1 : 1)
var lb = (b || '').toLowerCase()
if (la === lb) {
return 0
}
else {
return la < lb ? -1 : 1
}
}
function filterIgnoreCase(a, filterValue) {
var va = (a || '').toLowerCase()
, vb = filterValue.toLowerCase()
var vb = filterValue.toLowerCase()
return va.indexOf(vb) !== -1
}
function compareRespectCase(a, b) {
return a === b ? 0 : (a < b ? -1 : 1)
if (a === b) {
return 0
}
else {
return a < b ? -1 : 1
}
}
function TextCell(options) {
return _.defaults(options, {
title: options.title
, defaultOrder: 'asc'
, build: function () {
, build: function() {
var td = document.createElement('td')
td.appendChild(document.createTextNode(''))
return td
@ -320,7 +329,7 @@ function NumberCell(options) {
return _.defaults(options, {
title: options.title
, defaultOrder: 'asc'
, build: function () {
, build: function() {
var td = document.createElement('td')
td.appendChild(document.createTextNode(''))
return td
@ -337,7 +346,7 @@ function NumberCell(options) {
return function(item, filter) {
return filterOps[filter.op || '='](
options.value(item)
, +filter.query
, Number(filter.query)
)
}
})()
@ -348,14 +357,14 @@ function DateCell(options) {
return _.defaults(options, {
title: options.title
, defaultOrder: 'desc'
, build: function () {
, build: function() {
var td = document.createElement('td')
td.appendChild(document.createTextNode(''))
return td
}
, update: function(td, item) {
var t = td.firstChild
, date = options.value(item)
var date = options.value(item)
if (date) {
t.nodeValue = date.getFullYear()
+ '-'
@ -370,7 +379,7 @@ function DateCell(options) {
}
, compare: function(a, b) {
var va = options.value(a) || 0
, vb = options.value(b) || 0
var vb = options.value(b) || 0
return va - vb
}
, filter: (function() {
@ -381,8 +390,8 @@ function DateCell(options) {
}
return function(item, filter) {
var filterDate = new Date(filter.query)
, va = dateNumber(options.value(item))
, vb = dateNumber(filterDate)
var va = dateNumber(options.value(item))
var vb = dateNumber(filterDate)
return filterOps[filter.op || '='](va, vb)
}
})()
@ -393,17 +402,17 @@ function LinkCell(options) {
return _.defaults(options, {
title: options.title
, defaultOrder: 'asc'
, build: function () {
, build: function() {
var td = document.createElement('td')
, a = document.createElement('a')
var a = document.createElement('a')
a.appendChild(document.createTextNode(''))
td.appendChild(a)
return td
}
, update: function(td, item) {
var a = td.firstChild
, t = a.firstChild
, href = options.link(item)
var t = a.firstChild
var href = options.link(item)
if (href) {
a.setAttribute('href', href)
}
@ -429,22 +438,22 @@ function DeviceBrowserCell(options) {
, defaultOrder: 'asc'
, build: function() {
var td = document.createElement('td')
, span = document.createElement('span')
var span = document.createElement('span')
span.className = 'device-browser-list'
td.appendChild(span)
return td
}
, update: function(td, device) {
var span = td.firstChild
, browser = options.value(device)
, apps = browser.apps.slice().sort(function(appA, appB) {
var browser = options.value(device)
var apps = browser.apps.slice().sort(function(appA, appB) {
return compareIgnoreCase(appA.name, appB.name)
})
for (var i = 0, l = apps.length; i < l; ++i) {
var app = apps[i]
, img = span.childNodes[i] || span.appendChild(document.createElement('img'))
, src = '/static/app/browsers/icon/36x36/' + (app.type || '_default') + '.png'
var img = span.childNodes[i] || span.appendChild(document.createElement('img'))
var src = '/static/app/browsers/icon/36x36/' + (app.type || '_default') + '.png'
// Only change if necessary so that we don't trigger a download
if (img.getAttribute('src') !== src) {
@ -477,8 +486,8 @@ function DeviceModelCell(options) {
, defaultOrder: 'asc'
, build: function() {
var td = document.createElement('td')
, span = document.createElement('span')
, image = document.createElement('img')
var span = document.createElement('span')
var image = document.createElement('img')
span.className = 'device-small-image'
image.className = 'device-small-image-img pointer'
span.appendChild(image)
@ -488,9 +497,9 @@ function DeviceModelCell(options) {
}
, update: function(td, device) {
var span = td.firstChild
, image = span.firstChild
, t = span.nextSibling
, src = '/static/app/devices/icon/x24/' +
var image = span.firstChild
var t = span.nextSibling
var src = '/static/app/devices/icon/x24/' +
(device.image || '_default.jpg')
// Only change if necessary so that we don't trigger a download
@ -517,14 +526,14 @@ function DeviceNameCell(options) {
, defaultOrder: 'asc'
, build: function() {
var td = document.createElement('td')
, a = document.createElement('a')
var a = document.createElement('a')
a.appendChild(document.createTextNode(''))
td.appendChild(a)
return td
}
, update: function(td, device) {
var a = td.firstChild
, t = a.firstChild
var t = a.firstChild
if (device.using) {
a.className = 'device-product-name-using'
@ -569,14 +578,14 @@ function DeviceStatusCell(options) {
, defaultOrder: 'asc'
, build: function() {
var td = document.createElement('td')
, a = document.createElement('a')
var a = document.createElement('a')
a.appendChild(document.createTextNode(''))
td.appendChild(a)
return td
}
, update: function(td, device) {
var a = td.firstChild
, t = a.firstChild
var t = a.firstChild
a.className = 'btn btn-xs device-status ' +
(stateClasses[device.state] || 'btn-default-outline')
@ -618,10 +627,10 @@ function DeviceNoteCell(options) {
return _.defaults(options, {
title: options.title
, defaultOrder: 'asc'
, build: function () {
, build: function() {
var td = document.createElement('td')
, span = document.createElement('span')
, i = document.createElement('i')
var span = document.createElement('span')
var i = document.createElement('i')
td.className = 'device-note'
span.className = 'xeditable-wrapper'
@ -636,7 +645,7 @@ function DeviceNoteCell(options) {
}
, update: function(td, item) {
var span = td.firstChild
, t = span.firstChild
var t = span.firstChild
t.nodeValue = options.value(item)
return td