diff --git a/plugins/eos/eos.js b/plugins/eos/eos.js index 7113754..fef62d5 100644 --- a/plugins/eos/eos.js +++ b/plugins/eos/eos.js @@ -32,7 +32,7 @@ exports.data = function (device, osc) { this.deviceInfoUpdate(device, 'defaultName', osc.args[0]); } else if (osc.address == '/eos/out/get/cuelist/count') { for (var i = 0; i < osc.args[0]; i++) { - device.send('/eos/get/cuelist/index/' + i); + device.send(`/eos/get/cuelist/index/${i}`); } } else if ( p[1] == 'out' && @@ -41,7 +41,7 @@ exports.data = function (device, osc) { p[5] == 'list' ) { device.data.cuelists[p[4]] = {}; - device.send('/eos/get/cue/' + p[4] + '/count'); + device.send(`/eos/get/cue/${p[4]}/count`); } else if ( p[1] == 'out' && p[2] == 'get' && @@ -49,7 +49,7 @@ exports.data = function (device, osc) { p[5] == 'count' ) { for (var i = 0; i < osc.args[0]; i++) { - device.send('/eos/get/cue/' + p[4] + '/index/' + i); + device.send(`'/eos/get/cue/${p[4]}/index/${i}`); } } else if ( p[1] == 'out' && @@ -124,7 +124,7 @@ exports.data = function (device, osc) { var listCount = p[7]; var cueNumber = osc.args[1]; - device.send('/eos/get/cue/' + cueList + '/' + cueNumber); + device.send(`/eos/get/cue/${cueList}/${cueNumber}`); //console.log("SENT /eos/get/cue/"+cueList+"/"+cueNumber); } else if ( p[2] == 'cmd' || diff --git a/plugins/pjlink/pjlink.js b/plugins/pjlink/pjlink.js index 0498657..caa98c2 100644 --- a/plugins/pjlink/pjlink.js +++ b/plugins/pjlink/pjlink.js @@ -25,10 +25,9 @@ exports.data = function (device, message) { const md5 = require('md5'); if (msg.substring(0, 8) == 'PJLINK 1') { - password = md5(msg.substring(9, 17) + 'JBMIAProjectorLink'); + password = md5(`${msg.substring(9, 17)}JBMIAProjectorLink`); device.send( - password + - '%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r' + `${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r` ); } if (msg.substring(0, 7) == '%1POWR=') { @@ -115,8 +114,7 @@ function processPJLink(device, str, that) { exports.heartbeat = function (device) { if (password) { device.send( - password + - '%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r' + `${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r` ); } }; diff --git a/plugins/qlab/qlab.js b/plugins/qlab/qlab.js index 48f6cee..0c5014b 100644 --- a/plugins/qlab/qlab.js +++ b/plugins/qlab/qlab.js @@ -25,12 +25,12 @@ exports.data = function (device, osc) { selectionIsPlayhead: true, }; device.data.version = d[i].version; - device.send('/workspace/' + d[i].uniqueID + '/cueLists'); - device.send('/workspace/' + d[i].uniqueID + '/updates', [ + device.send(`/workspace/${d[i].uniqueID}/cueLists`); + device.send(`/workspace/${d[i].uniqueID}/updates`, [ { type: 'i', value: 1 }, ]); device.send('/cue/playbackPosition/uniqueID'); - device.send('/workspace/' + d[i].uniqueID + '/selectionIsPlayhead'); + device.send(`/workspace/${d[i].uniqueID}/selectionIsPlayhead`); } } else if (p[1] == 'workspace' && p[3] == 'cueLists') { var workspace = p[2]; @@ -59,11 +59,7 @@ exports.data = function (device, osc) { cue.groups = groups; device.send( - '/workspace/' + - workspace + - '/cue_id/' + - cue.uniqueID + - '/valuesForKeys', + `/workspace/${workspace}/cue_id/${cue.uniqueID}/valuesForKeys`, [ { type: 's', @@ -89,7 +85,7 @@ exports.data = function (device, osc) { device.draw(); } else if (p[0] == 'update' && p[1] == 'workspace' && p[3] == 'cue_id') { - device.send('/workspace/' + p[2] + '/cueLists'); + device.send(`/workspace/${p[2]}/cueLists`); } else if ( p[0] == 'update' && p[1] == 'workspace' && @@ -143,8 +139,6 @@ exports.data = function (device, osc) { exports.heartbeat = function (device) { try { - device.send( - '/workspace/' + Object.keys(device.data.workspaces)[0] + '/thump' - ); + device.send(`/workspace/${Object.keys(device.data.workspaces)[0]}/thump`); } catch (err) {} }; diff --git a/plugins/watchout/watchout.js b/plugins/watchout/watchout.js index 8c671ab..b8e577b 100644 --- a/plugins/watchout/watchout.js +++ b/plugins/watchout/watchout.js @@ -27,7 +27,7 @@ exports.data = function (device, message) { var i = 0; while (arr[i][arr[i].length - 1] != '"') { i++; - device.data.showName += arr[i] + ' '; + device.data.showName += `${arr[i]} `; } device.data.showName = device.data.showName.substring( 1, diff --git a/plugins/x32/x32.js b/plugins/x32/x32.js index 22f5ab6..c8f8e70 100644 --- a/plugins/x32/x32.js +++ b/plugins/x32/x32.js @@ -48,9 +48,9 @@ exports.data = function (device, buf) { for (var i = 0; i <= 32; i++) { device.send( Buffer.from( - '/ch/' + - i.toString().padStart(2, '0') + - '/config/name\u0000\u0000\u0000\u0000' + `/ch/${i + .toString() + .padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000` ) ); } @@ -85,7 +85,7 @@ exports.data = function (device, buf) { } device.draw(); device.send( - Buffer.from('/ch/' + addr[1] + '/mix/fader\u0000\u0000\u0000\u0000') + Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`) ); } else if (msg[0].indexOf('/config/name') > 0) { var addr = parseAddress(msg[0]); @@ -93,16 +93,14 @@ exports.data = function (device, buf) { device.data.channelNames[channel - 1] = msg[2]; device.draw(); device.send( - Buffer.from('/ch/' + addr[1] + '/config/color\u0000\u0000\u0000\u0000') + Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`) ); } else if (msg[0].indexOf('/config/color') > 0) { var addr = parseAddress(msg[0]); var channel = Number(addr[1]); device.data.channelColors[channel - 1] = buf.readInt8(27); device.draw(); - device.send( - Buffer.from('/ch/' + addr[1] + '/mix/on\u0000\u0000\u0000\u0000') - ); + device.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`)); } else { //console.log(msg) } diff --git a/plugins/xair/xair.js b/plugins/xair/xair.js index d288dbb..69f720b 100644 --- a/plugins/xair/xair.js +++ b/plugins/xair/xair.js @@ -53,9 +53,9 @@ exports.data = function (device, buf) { for (var i = 0; i <= 32; i++) { device.send( Buffer.from( - '/ch/' + - i.toString().padStart(2, '0') + - '/config/name\u0000\u0000\u0000\u0000' + `/ch/${i + .toString() + .padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000` ) ); } @@ -90,7 +90,7 @@ exports.data = function (device, buf) { } device.draw(); device.send( - Buffer.from('/ch/' + addr[1] + '/mix/fader\u0000\u0000\u0000\u0000') + Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`) ); } else if (msg[0].indexOf('/config/name') > 0) { var addr = parseAddress(msg[0]); @@ -98,16 +98,14 @@ exports.data = function (device, buf) { device.data.channelNames[channel - 1] = msg[4]; device.draw(); device.send( - Buffer.from('/ch/' + addr[1] + '/config/color\u0000\u0000\u0000\u0000') + Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`) ); } else if (msg[0].indexOf('/config/color') > 0) { var addr = parseAddress(msg[0]); var channel = Number(addr[1]); device.data.channelColors[channel - 1] = buf.readInt8(27); device.draw(); - device.send( - Buffer.from('/ch/' + addr[1] + '/mix/on\u0000\u0000\u0000\u0000') - ); + device.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`)); } else { //console.log(msg) } diff --git a/src/device.js b/src/device.js index 3e053aa..3ac7154 100644 --- a/src/device.js +++ b/src/device.js @@ -15,7 +15,7 @@ registerDevice = function (newDevice) { console.log(PLUGINS.all); if (PLUGINS.all[newDevice.type] == undefined) { - console.error('Plugin for device ' + newDevice.type + ' does not exist.'); + console.error(`Plugin for device ${newDevice.type} does not exist.`); return true; } @@ -166,11 +166,9 @@ module.exports.initDeviceConnection = initDeviceConnection; module.exports.deleteActive = function () { var device = VIEW.getActiveDevice(); var choice = confirm( - 'Are you sure you want to delete ' + - device.type + - ' device "' + - (device.displayName || device.defaultName) + - '"?' + `Are you sure you want to delete ${device.type} device "${ + device.displayName || device.defaultName + }"?` ); if (choice) { diff --git a/src/plugins.js b/src/plugins.js index eaf5307..b3a0672 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -6,20 +6,17 @@ var allPlugins = {}; module.exports.all = allPlugins; module.exports.init = function (callback) { - console.log('Loading plugin files... ' + __dirname + '/../plugins'); + console.log(`Loading plugin files... ${__dirname}/../plugins`); - fs.readdir(__dirname + '/../plugins', function (err, files) { + fs.readdir(`${__dirname}/../plugins`, function (err, files) { for (var i in files) { var plugin = files[i]; if (plugin[0] != '.') { - console.log(i + ' ' + plugin); - allPlugins[plugin] = require(__dirname + - '/../plugins/' + - plugin + - '/' + - plugin + - '.js'); + console.log(`${i} ${plugin}`); + allPlugins[ + plugin + ] = require(`${__dirname}/../plugins/${plugin}/${plugin}.js`); allPlugins[plugin].deviceInfoUpdate = function (device, param, value) { DEVICE.infoUpdate(device, param, value); @@ -30,7 +27,7 @@ module.exports.init = function (callback) { allPlugins[plugin].template = ejs.compile( fs.readFileSync( - __dirname + '/../plugins/' + plugin + '/' + plugin + '.html', + `${__dirname}/../plugins/${plugin}/${plugin}.html`, 'utf8' ) ); diff --git a/src/saveSlots.js b/src/saveSlots.js index fe69798..fa3a431 100644 --- a/src/saveSlots.js +++ b/src/saveSlots.js @@ -46,7 +46,7 @@ loadSlot = function (slotIndex) { module.exports.loadSlot = loadSlot; module.exports.loadDevices = function () { - console.log('Loading ' + savedDevices.length + ' saved devices...'); + console.log(`Loading ${savedDevices.length} saved devices...`); console.log(savedDevices); for (var i = 0; i < savedDevices.length; i++) { @@ -75,11 +75,7 @@ module.exports.saveAll = function () { } localStorage.setItem('savedSlots', JSON.stringify(savedSlots)); console.log( - 'Saved ' + - currentPins.length + - ' pinned devices to slot ' + - activeSlot + - '!' + `Saved ${currentPins.length} pinned devices to slot ${activeSlot}!` ); savedDevices = []; diff --git a/src/search.js b/src/search.js index bc7b88e..9c0633d 100644 --- a/src/search.js +++ b/src/search.js @@ -58,7 +58,7 @@ searchAll = function () { break; } } catch (err) { - console.error('Unable to search for plugin ' + p); + console.error(`Unable to search for plugin ${p}`); } } @@ -218,7 +218,7 @@ findOnlineDevices = function () { cur[2] = j; for (var k = Number(f[3]); k < Number(l[3]); k++) { cur[3] = k; - allIPs.push(cur[0] + '.' + cur[1] + '.' + cur[2] + '.' + cur[3]); + allIPs.push(`${cur[0]}.${cur[1]}.${cur[2]}.${cur[3]}`); } } } diff --git a/src/view.js b/src/view.js index b0bacc2..7f6a4be 100644 --- a/src/view.js +++ b/src/view.js @@ -14,8 +14,8 @@ module.exports.init = function () { drawDeviceInterface = function (id) { // console.log("DRAW") - var $deviceDrawArea = document.getElementById('device-' + id + '-draw-area'); - var $devicePinned = document.getElementById('device-' + id + '-pinned'); + var $deviceDrawArea = document.getElementById(`device-${id}-draw-area`); + var $devicePinned = document.getElementById(`device-${id}-pinned`); if ($deviceDrawArea == null) { return true; @@ -68,7 +68,7 @@ drawDeviceInterface = function (id) { str += ''; - $deviceDrawArea.setAttribute('class', d.type + ' draw-area'); + $deviceDrawArea.setAttribute('class', `${d.type} draw-area`); $deviceDrawArea.contentWindow.document.open(); $deviceDrawArea.contentWindow.document.write(str); @@ -155,29 +155,17 @@ switchDevice = function (id) { var $deviceWrapper = document.getElementById('device-' + i); if (!$deviceWrapper) { - var html = - '
' + - '' + - '' + - '
'; + var html = `
`; document .getElementById('all-devices') .insertAdjacentHTML('afterbegin', html); - $deviceWrapper = document.getElementById('device-' + i); + $deviceWrapper = document.getElementById(`device-${i}`); } switchClass(document.getElementById(id), 'active-device'); drawDeviceInterface(id); - switchClass(document.getElementById('device-' + id), 'active-device-outline'); + switchClass(document.getElementById(`device-${id}`), 'active-device-outline'); document.getElementById('device-settings-table').style.display = 'block'; document.getElementById('device-settings-plugin-dropdown').value =