lint: spaces
This commit is contained in:
parent
d40f8155c7
commit
74dcbd2aff
12 changed files with 69 additions and 69 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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]]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
var terminal = require('./terminal')
|
||||
var terminal = require('./terminal'),
|
||||
settings = require('./settings'),
|
||||
contextmenu = require('./context-menu'),
|
||||
toolbar = require('./toolbar'),
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ module.exports = function(options={}) {
|
|||
if ((input.key === 'w' || input.key === 'W') && input.control) {
|
||||
window.close()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
if (options.shortcuts) {
|
||||
|
|
|
|||
|
|
@ -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'))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue