mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-11 08:43:39 +00:00
Change string concats to template literals
This commit is contained in:
+4
-6
@@ -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) {
|
||||
|
||||
+7
-10
@@ -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'
|
||||
)
|
||||
);
|
||||
|
||||
+2
-6
@@ -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 = [];
|
||||
|
||||
+2
-2
@@ -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]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-18
@@ -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 += '</body></html>';
|
||||
|
||||
$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 =
|
||||
'<div class="col device-wrapper" id="device-' +
|
||||
i +
|
||||
'">' +
|
||||
'<img id="device-' +
|
||||
i +
|
||||
'-pinned" class="device-pin" src="src/img/outline_push_pin_white_18dp.png">' +
|
||||
'<iframe id="device-' +
|
||||
i +
|
||||
'-draw-area" class="draw-area"></iframe>' +
|
||||
'<div id="device-' +
|
||||
i +
|
||||
'-settings"></div></div>';
|
||||
var html = `<div class="col device-wrapper" id="device-${i}"><img id="device-${i}-pinned" class="device-pin" src="src/img/outline_push_pin_white_18dp.png"><iframe id="device-${i}-draw-area" class="draw-area"></iframe><div id="device-${i}-settings"></div></div>`;
|
||||
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 =
|
||||
|
||||
Reference in New Issue
Block a user