lint: spaces

This commit is contained in:
bordun 2020-03-23 15:34:42 +01:00
parent d40f8155c7
commit 74dcbd2aff
12 changed files with 69 additions and 69 deletions

View file

@ -4,9 +4,9 @@ var iOS
if (navigator.platform.match(/iPhone|iPod|iPad/)) {
var supportsPassiveOption = false;
var supportsPassiveOption = false
try {
document.createElement("div").addEventListener("test", function() {}, {
document.createElement('div').addEventListener('test', function() {}, {
get passive() {
supportsPassiveOption = true
return false

View file

@ -7,24 +7,24 @@ var UiWidget = require('./ui-widget'),
class UiModal extends UiWidget {
constructor(options) {
constructor(options) {
super(options)
super(options)
if (!MODAL_CONTAINER) MODAL_CONTAINER = DOM.get('osc-modal-container')[0]
if (!MODAL_CONTAINER) MODAL_CONTAINER = DOM.get('osc-modal-container')[0]
if (options.closable) {
if (options.closable) {
if (MODAL_SINGLETON) MODAL_SINGLETON.close()
MODAL_SINGLETON = this
if (MODAL_SINGLETON) MODAL_SINGLETON.close()
MODAL_SINGLETON = this
}
}
this.escKey = options.closable || options.escKey
this.enterKey = options.enterKey
this.state = 0
this.escKey = options.closable || options.escKey
this.enterKey = options.enterKey
this.state = 0
this.container = html`
this.container = html`
<div class="popup show">
<div class="popup-wrapper">
<div class="popup-title ${options.closable? 'closable' : ''}">
@ -41,64 +41,64 @@ class UiModal extends UiWidget {
</div>
`
if (options.width) this.container.style.setProperty('--width', options.width + 'rem')
if (options.height) this.container.style.setProperty('--height', options.height + 'rem')
if (options.width) this.container.style.setProperty('--width', options.width + 'rem')
if (options.height) this.container.style.setProperty('--height', options.height + 'rem')
if (options.closable) {
var closer = DOM.get(this.container, '.popup-title .closer')[0]
this.container.addEventListener('fast-click',(e)=>{
if (e.target === this.container || e.target === closer) {
e.detail.preventOriginalEvent = true
this.close()
}
})
}
if (options.closable) {
var closer = DOM.get(this.container, '.popup-title .closer')[0]
this.container.addEventListener('fast-click',(e)=>{
if (e.target === this.container || e.target === closer) {
e.detail.preventOriginalEvent = true
this.close()
}
})
}
if (this.escKey) {
this.escKeyHandler = ((e)=>{
if (e.keyCode==27) this.close()
}).bind(this)
}
if (this.escKey) {
this.escKeyHandler = ((e)=>{
if (e.keyCode==27) this.close()
}).bind(this)
}
if (this.enterKey) {
this.enterKeyHandler = ((e)=>{
if (e.keyCode == 13) this.enterKey.call(this, e)
}).bind(this)
}
if (this.enterKey) {
this.enterKeyHandler = ((e)=>{
if (e.keyCode == 13) this.enterKey.call(this, e)
}).bind(this)
}
if (!options.hide) this.open()
if (!options.hide) this.open()
}
}
close() {
close() {
if (!this.state) return
this.state = 0
if (!this.state) return
this.state = 0
if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler)
if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler)
if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler)
if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler)
MODAL_CONTAINER.removeChild(this.container)
MODAL_CONTAINER.removeChild(this.container)
this.trigger('close')
this.trigger('close')
}
}
open() {
open() {
if (this.state) return
this.state = 1
if (this.state) return
this.state = 1
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
MODAL_CONTAINER.appendChild(this.container)
MODAL_CONTAINER.appendChild(this.container)
this.trigger('open')
}
this.trigger('open')
}
}

View file

@ -7,8 +7,8 @@ var Widget = require('../common/widget'),
var sanitizeOptions = {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe'),
allowedAttributes: {
'*': [ 'title', 'class', 'style'],
'img': [ 'src' , 'title', 'class', 'style', 'width', 'height']
'*': [ 'title', 'class', 'style'],
'img': [ 'src' , 'title', 'class', 'style', 'width', 'height']
}
}

View file

@ -65,7 +65,7 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false}) {
} catch(e) {
this.filters[i] = new BiquadFilterNode(audioContext, {
Q: 1,
type: "allpass",
type: 'allpass',
})
}
@ -101,9 +101,9 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false}) {
if (filter._on === false) continue
var filterResponse = new Float32Array(resolution);
var filterResponse = new Float32Array(resolution)
filter.getFrequencyResponse(frequencyHz, filterResponse, phaseResponse);
filter.getFrequencyResponse(frequencyHz, filterResponse, phaseResponse)
responses.push(filterResponse)

View file

@ -217,7 +217,7 @@ module.exports = class Xy extends Pad {
for (let i in this.faders.x.rangeKeys) {
let pip = this.faders.x.rangeKeys[i],
px = Math.round(0.5 * this.faders.x.percentToCoord(pip)) * 2
px = Math.round(0.5 * this.faders.x.percentToCoord(pip)) * 2
if (parseInt(px) === px) px -= 0.5
@ -238,7 +238,7 @@ module.exports = class Xy extends Pad {
for (let i in this.faders.y.rangeKeys) {
let pip = this.faders.y.rangeKeys[i],
py = Math.round(0.5 * this.faders.y.percentToCoord(pip)) * 2
py = Math.round(0.5 * this.faders.y.percentToCoord(pip)) * 2
if (parseInt(py) === py) py -= 0.5

View file

@ -136,7 +136,7 @@ class ScriptVm extends Vm {
if (filter) {
var filter = Array.isArray(filter) ? filter : [filter],
containers = this.filter.map(x=>widgetManager.getWidgetById(x)).reduce((a,b)=>a.concat(b), [])
containers = this.filter.map(x=>widgetManager.getWidgetById(x)).reduce((a,b)=>a.concat(b), [])
if (!containers.length) return
filter = (widget)=>{
return containers.some(x=>x.contains(widget) || x === widget)
@ -242,7 +242,7 @@ class ScriptVm extends Vm {
}
for (var imports of ['set', 'get', 'getProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage',
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout']) {
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout']) {
this.sanitize(this.sandbox.contentWindow[imports])
}

View file

@ -310,7 +310,7 @@ module.exports = class Fader extends Slider {
if (this.getProp('pips') && !compact) {
this.ctx.globalAlpha = 1
this.ctx.drawImage(this.pips, 0, 0);
this.ctx.drawImage(this.pips, 0, 0)
if (!compact) this.clearRect = [this.clearRect, [m + 10 * PXSCALE, 0, 10 * PXSCALE + this.pipsTextSize, height]]
}
@ -394,7 +394,7 @@ module.exports = class Fader extends Slider {
ctx.save()
ctx.translate(textX + 3 * PXSCALE, textY - 0.5 * PXSCALE)
ctx.rotate(Math.PI/2)
ctx.textAlign = "center"
ctx.textAlign = 'center'
ctx.fillText(this.rangeLabels[i], 0, 0)
ctx.restore()

View file

@ -367,7 +367,7 @@ class Range extends Fader {
if (this.getProp('pips')) {
this.ctx.globalAlpha = 1
this.ctx.drawImage(this.pips, 0, 0);
this.ctx.drawImage(this.pips, 0, 0)
if (!compact) this.clearRect = [this.clearRect, [m + 10 * PXSCALE, 0, 10 * PXSCALE + this.pipsTextSize, height]]
}

View file

@ -1,4 +1,4 @@
var terminal = require('./terminal')
var terminal = require('./terminal'),
settings = require('./settings'),
contextmenu = require('./context-menu'),
toolbar = require('./toolbar'),

View file

@ -111,7 +111,7 @@ class Settings {
if (data.type === 'boolean') {
toggle = field.appendChild(html`
<osc-settings-checkbox class="${!!value ? 'on' : ''}">${raw(icon('check'))}</osc-settings-checkbox>
<osc-settings-checkbox class="${value ? 'on' : ''}">${raw(icon('check'))}</osc-settings-checkbox>
`)
toggle.addEventListener('click', (e)=>{
input.value = toggle.classList.toggle('on')
@ -200,7 +200,7 @@ class Settings {
DOM.dispatchEvent(el, 'change', {stop: true})
})
this.write()
}
}
})

View file

@ -82,7 +82,7 @@ module.exports = function(options={}) {
if ((input.key === 'w' || input.key === 'W') && input.control) {
window.close()
}
});
})
}
if (options.shortcuts) {

View file

@ -33,7 +33,7 @@ function httpRoute(req, res) {
window.ENV=${JSON.stringify(settings.read('client-options'))}
window.READ_ONLY=${JSON.stringify(settings.read('read-only'))}
</script></body>`))
.pipe(res);
.pipe(res)
// res.sendFile(path.resolve(__dirname + '/../client/index.html'))