1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 00:05:22 +03:00

chore: add template-curly-spacing

This commit is contained in:
Tomas Chmelevskij 2021-12-19 08:10:24 +01:00
parent 6e6c3f76ae
commit 5be4a4596a
31 changed files with 253 additions and 252 deletions

View file

@ -18,5 +18,6 @@ module.exports = {
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"no-var": "error", "no-var": "error",
"prefer-template": "error", "prefer-template": "error",
"template-curly-spacing": "error",
}, },
}; };

View file

@ -57,9 +57,9 @@ DarkTheme.setConfig = function (result) {
}; };
DarkTheme.applyDark = function () { DarkTheme.applyDark = function () {
css_dark.forEach((el) => $(`link[href="${ el }"]`).prop('disabled', false)); css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', false));
}; };
DarkTheme.applyNormal = function () { DarkTheme.applyNormal = function () {
css_dark.forEach((el) => $(`link[href="${ el }"]`).prop('disabled', true)); css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', true));
}; };

View file

@ -104,7 +104,7 @@ let FirmwareCache = (function () {
* @returns {string} A key for storing cached data for a release * @returns {string} A key for storing cached data for a release
*/ */
function withCachePrefix(key) { function withCachePrefix(key) {
return `cache:${ key}`; return `cache:${key}`;
} }
/** /**
@ -133,7 +133,7 @@ let FirmwareCache = (function () {
} }
let key = keyOf(release); let key = keyOf(release);
if (has(release)) { if (has(release)) {
console.debug(`Firmware is already cached: ${ key}`); console.debug(`Firmware is already cached: ${key}`);
return; return;
} }
journal.set(key, true); journal.set(key, true);
@ -159,7 +159,7 @@ let FirmwareCache = (function () {
} }
let key = keyOf(release); let key = keyOf(release);
if (!has(release)) { if (!has(release)) {
console.debug(`Firmware is not cached: ${ key}`); console.debug(`Firmware is not cached: ${key}`);
return; return;
} }
let cacheKey = withCachePrefix(key); let cacheKey = withCachePrefix(key);
@ -208,7 +208,7 @@ let FirmwareCache = (function () {
if (typeof onPutToCacheCallback === "function") { if (typeof onPutToCacheCallback === "function") {
onPutToCacheCallback(release); onPutToCacheCallback(release);
} }
console.info(`Release put to cache: ${ keyOf(release)}`); console.info(`Release put to cache: ${keyOf(release)}`);
} }
/** /**
@ -218,7 +218,7 @@ let FirmwareCache = (function () {
if (typeof onRemoveFromCacheCallback === "function") { if (typeof onRemoveFromCacheCallback === "function") {
onRemoveFromCacheCallback(release); onRemoveFromCacheCallback(release);
} }
console.debug(`Cache data removed: ${ keyOf(release)}`); console.debug(`Cache data removed: ${keyOf(release)}`);
} }
/** /**
@ -231,7 +231,7 @@ let FirmwareCache = (function () {
} }
journal.assign(pairs); journal.assign(pairs);
journalLoaded = true; journalLoaded = true;
console.info(`Firmware cache journal loaded; number of entries: ${ entries.length}`); console.info(`Firmware cache journal loaded; number of entries: ${entries.length}`);
} }
return { return {

View file

@ -179,8 +179,8 @@ LogoManager.init = function (font, logoStartIndex) {
this.logoStartIndex = logoStartIndex; this.logoStartIndex = logoStartIndex;
// inject logo size variables for dynamic translation strings // inject logo size variables for dynamic translation strings
i18n.addResources({ i18n.addResources({
logoWidthPx: `${ this.constraints.imageSize.expectedWidth}`, // NOSONAR logoWidthPx: `${this.constraints.imageSize.expectedWidth}`, // NOSONAR
logoHeightPx: `${ this.constraints.imageSize.expectedHeight}`, // NOSONAR logoHeightPx: `${this.constraints.imageSize.expectedHeight}`, // NOSONAR
}); });
// find/cache DOM elements // find/cache DOM elements
Object.keys(this.elements).forEach(key => { Object.keys(this.elements).forEach(key => {

View file

@ -487,7 +487,7 @@ GuiControl.prototype.showInformationDialog = function(informationDialogSettings)
GuiControl.prototype.saveToTextFileDialog = function(textToSave, suggestedFileName, extension) { GuiControl.prototype.saveToTextFileDialog = function(textToSave, suggestedFileName, extension) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const accepts = [{ description: `${extension.toUpperCase() } files`, extensions: [extension] }]; const accepts = [{ description: `${extension.toUpperCase()} files`, extensions: [extension] }];
chrome.fileSystem.chooseEntry( chrome.fileSystem.chooseEntry(
{ {
@ -535,7 +535,7 @@ GuiControl.prototype._saveToTextFileDialogFileSelected = function(entry, textToS
GuiControl.prototype.readTextFileDialog = function(extension) { GuiControl.prototype.readTextFileDialog = function(extension) {
const accepts = [{ description: `${extension.toUpperCase() } files`, extensions: [extension] }]; const accepts = [{ description: `${extension.toUpperCase()} files`, extensions: [extension] }];
return new Promise(resolve => { return new Promise(resolve => {
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) { chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) {

View file

@ -810,7 +810,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
case MSPCodes.MSP_API_VERSION: case MSPCodes.MSP_API_VERSION:
FC.CONFIG.mspProtocolVersion = data.readU8(); FC.CONFIG.mspProtocolVersion = data.readU8();
FC.CONFIG.apiVersion = `${data.readU8() }.${ data.readU8() }.0`; FC.CONFIG.apiVersion = `${data.readU8()}.${data.readU8()}.0`;
break; break;
case MSPCodes.MSP_FC_VARIANT: case MSPCodes.MSP_FC_VARIANT:
@ -822,7 +822,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
break; break;
case MSPCodes.MSP_FC_VERSION: case MSPCodes.MSP_FC_VERSION:
FC.CONFIG.flightControllerVersion = `${data.readU8() }.${ data.readU8() }.${ data.readU8()}`; FC.CONFIG.flightControllerVersion = `${data.readU8()}.${data.readU8()}.${data.readU8()}`;
break; break;
case MSPCodes.MSP_BUILD_INFO: case MSPCodes.MSP_BUILD_INFO:
@ -1741,9 +1741,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
break; break;
default: default:
console.log(`Unknown code detected: ${ code}`); console.log(`Unknown code detected: ${code}`);
} else { } else {
console.log(`FC reports unsupported message error: ${ code}`); console.log(`FC reports unsupported message error: ${code}`);
if (code === MSPCodes.MSP_SET_REBOOT) { if (code === MSPCodes.MSP_SET_REBOOT) {
TABS.onboard_logging.mscRebootFailedCallback(); TABS.onboard_logging.mscRebootFailedCallback();
@ -2507,12 +2507,12 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
} }
} else { } else {
// Report address error // Report address error
console.log(`Expected address ${ address } but received ${ chunkAddress } - retrying`); console.log(`Expected address ${address} but received ${chunkAddress} - retrying`);
onDataCallback(address, null); // returning null to the callback forces a retry onDataCallback(address, null); // returning null to the callback forces a retry
} }
} else { } else {
// Report crc error // Report crc error
console.log(`CRC error for address ${ address } - retrying`); console.log(`CRC error for address ${address} - retrying`);
onDataCallback(address, null); // returning null to the callback forces a retry onDataCallback(address, null); // returning null to the callback forces a retry
} }
}, true); }, true);

View file

@ -407,7 +407,7 @@ STM32_protocol.prototype.verify_chip_signature = function (signature) {
if (this.hex.bytes_total < this.available_flash_size) { if (this.hex.bytes_total < this.available_flash_size) {
return true; return true;
} else { } else {
console.log(`Supplied hex is bigger then flash available on the chip, HEX: ${ this.hex.bytes_total } bytes, limit = ${ this.available_flash_size } bytes`); console.log(`Supplied hex is bigger then flash available on the chip, HEX: ${this.hex.bytes_total} bytes, limit = ${this.available_flash_size} bytes`);
return false; return false;
} }
} }

View file

@ -95,7 +95,7 @@ STM32DFU_protocol.prototype.connect = function (device, hex, options, callback)
chrome.usb.getDevices(device, function (result) { chrome.usb.getDevices(device, function (result) {
if (result.length) { if (result.length) {
console.log(`USB DFU detected with ID: ${ result[0].device}`); console.log(`USB DFU detected with ID: ${result[0].device}`);
self.openDevice(result[0]); self.openDevice(result[0]);
} else { } else {
@ -121,7 +121,7 @@ STM32DFU_protocol.prototype.openDevice = function (device) {
self.handle = handle; self.handle = handle;
GUI.log(i18n.getMessage('usbDeviceOpened', handle.handle.toString())); GUI.log(i18n.getMessage('usbDeviceOpened', handle.handle.toString()));
console.log(`Device opened with Handle ID: ${ handle.handle}`); console.log(`Device opened with Handle ID: ${handle.handle}`);
self.claimInterface(0); self.claimInterface(0);
}); });
}; };
@ -136,7 +136,7 @@ STM32DFU_protocol.prototype.closeDevice = function () {
} }
GUI.log(i18n.getMessage('usbDeviceClosed')); GUI.log(i18n.getMessage('usbDeviceClosed'));
console.log(`Device closed with Handle ID: ${ self.handle.handle}`); console.log(`Device closed with Handle ID: ${self.handle.handle}`);
self.handle = null; self.handle = null;
}); });
@ -154,7 +154,7 @@ STM32DFU_protocol.prototype.claimInterface = function (interfaceNumber) {
self.cleanup(); self.cleanup();
} }
console.log(`Claimed interface: ${ interfaceNumber}`); console.log(`Claimed interface: ${interfaceNumber}`);
if (self.options.exitDfu) { if (self.options.exitDfu) {
self.leave(); self.leave();
@ -168,7 +168,7 @@ STM32DFU_protocol.prototype.releaseInterface = function (interfaceNumber) {
const self = this; const self = this;
chrome.usb.releaseInterface(this.handle, interfaceNumber, function released() { chrome.usb.releaseInterface(this.handle, interfaceNumber, function released() {
console.log(`Released interface: ${ interfaceNumber}`); console.log(`Released interface: ${interfaceNumber}`);
self.closeDevice(); self.closeDevice();
}); });
@ -176,7 +176,7 @@ STM32DFU_protocol.prototype.releaseInterface = function (interfaceNumber) {
STM32DFU_protocol.prototype.resetDevice = function (callback) { STM32DFU_protocol.prototype.resetDevice = function (callback) {
chrome.usb.resetDevice(this.handle, function (result) { chrome.usb.resetDevice(this.handle, function (result) {
console.log(`Reset Device: ${ result}`); console.log(`Reset Device: ${result}`);
if (callback) callback(); if (callback) callback();
}); });
@ -195,7 +195,7 @@ STM32DFU_protocol.prototype.getString = function (index, callback) {
'length': 255, // max length to retreive 'length': 255, // max length to retreive
}, function (result) { }, function (result) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
console.log(`USB getString failed! ${ result.resultCode}`); console.log(`USB getString failed! ${result.resultCode}`);
callback("", result.resultCode); callback("", result.resultCode);
return; return;
} }
@ -264,7 +264,7 @@ STM32DFU_protocol.prototype.getInterfaceDescriptor = function (_interface, callb
'length': 18 + _interface * 9, 'length': 18 + _interface * 9,
}, function (result) { }, function (result) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
console.log(`USB getInterfaceDescriptor failed! ${ result.resultCode}`); console.log(`USB getInterfaceDescriptor failed! ${result.resultCode}`);
callback({}, result.resultCode); callback({}, result.resultCode);
return; return;
} }
@ -298,7 +298,7 @@ STM32DFU_protocol.prototype.getFunctionalDescriptor = function (_interface, call
'length': 255, 'length': 255,
}, function (result) { }, function (result) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
console.log(`USB getFunctionalDescriptor failed! ${ result.resultCode}`); console.log(`USB getFunctionalDescriptor failed! ${result.resultCode}`);
callback({}, result.resultCode); callback({}, result.resultCode);
return; return;
} }
@ -360,7 +360,7 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
// support option bytes. // support option bytes.
if (tmp1.length > 3) { if (tmp1.length > 3) {
console.log(`parseDescriptor: shrinking long descriptor "${ str }"`); console.log(`parseDescriptor: shrinking long descriptor "${str}"`);
tmp1.length = 3; tmp1.length = 3;
} }
if (!tmp1[0].startsWith("@")) { if (!tmp1[0].startsWith("@")) {
@ -446,9 +446,9 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
'timeout': timeout, 'timeout': timeout,
}, function (result) { }, function (result) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
console.log(`USB controlTransfer IN failed for request ${ request }!`); console.log(`USB controlTransfer IN failed for request ${request}!`);
} }
if (result.resultCode) console.log(`USB transfer result code: ${ result.resultCode}`); if (result.resultCode) console.log(`USB transfer result code: ${result.resultCode}`);
var buf = new Uint8Array(result.data); var buf = new Uint8Array(result.data);
callback(buf, result.resultCode); callback(buf, result.resultCode);
@ -474,9 +474,9 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
'timeout': timeout, 'timeout': timeout,
}, function (result) { }, function (result) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
console.log(`USB controlTransfer OUT failed for request ${ request }!`); console.log(`USB controlTransfer OUT failed for request ${request}!`);
} }
if (result.resultCode) console.log(`USB transfer result code: ${ result.resultCode}`); if (result.resultCode) console.log(`USB transfer result code: ${result.resultCode}`);
callback(result); callback(result);
}); });
@ -542,12 +542,12 @@ STM32DFU_protocol.prototype.loadAddress = function (address, callback, abort) {
STM32DFU_protocol.prototype.verify_flash = function (first_array, second_array) { STM32DFU_protocol.prototype.verify_flash = function (first_array, second_array) {
for (var i = 0; i < first_array.length; i++) { for (var i = 0; i < first_array.length; i++) {
if (first_array[i] != second_array[i]) { if (first_array[i] != second_array[i]) {
console.log(`Verification failed on byte: ${ i } expected: 0x${ first_array[i].toString(16) } received: 0x${ second_array[i].toString(16)}`); console.log(`Verification failed on byte: ${i} expected: 0x${first_array[i].toString(16)} received: 0x${second_array[i].toString(16)}`);
return false; return false;
} }
} }
console.log(`Verification successful, matching: ${ first_array.length } bytes`); console.log(`Verification successful, matching: ${first_array.length} bytes`);
return true; return true;
}; };
@ -600,7 +600,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
case 0: case 0:
self.getChipInfo(0, function (chipInfo, resultCode) { self.getChipInfo(0, function (chipInfo, resultCode) {
if (resultCode != 0 || typeof chipInfo === "undefined") { if (resultCode != 0 || typeof chipInfo === "undefined") {
console.log(`Failed to detect chip info, resultCode: ${ resultCode}`); console.log(`Failed to detect chip info, resultCode: ${resultCode}`);
self.cleanup(); self.cleanup();
} else { } else {
let nextAction; let nextAction;
@ -643,7 +643,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} else { } else {
self.getFunctionalDescriptor(0, function (descriptor, resultCode) { self.getFunctionalDescriptor(0, function (descriptor, resultCode) {
self.transferSize = resultCode ? 2048 : descriptor.wTransferSize; self.transferSize = resultCode ? 2048 : descriptor.wTransferSize;
console.log(`Using transfer size: ${ self.transferSize}`); console.log(`Using transfer size: ${self.transferSize}`);
self.clearStatus(function () { self.clearStatus(function () {
self.upload_procedure(nextAction); self.upload_procedure(nextAction);
}); });
@ -717,7 +717,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
// the following should fail if read protection is active // the following should fail if read protection is active
self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) { self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) {
if(errcode) { if(errcode) {
console.log(`USB transfer error while reading option bytes: ${ errcode1}`); console.log(`USB transfer error while reading option bytes: ${errcode1}`);
self.cleanup(); self.cleanup();
return; return;
} }
@ -853,8 +853,8 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
self.flash_layout.sectors[erase_pages[page].sector].start_address; self.flash_layout.sectors[erase_pages[page].sector].start_address;
var cmd = [0x41, page_addr & 0xff, (page_addr >> 8) & 0xff, (page_addr >> 16) & 0xff, (page_addr >> 24) & 0xff]; var cmd = [0x41, page_addr & 0xff, (page_addr >> 8) & 0xff, (page_addr >> 16) & 0xff, (page_addr >> 24) & 0xff];
total_erased += self.flash_layout.sectors[erase_pages[page].sector].page_size; total_erased += self.flash_layout.sectors[erase_pages[page].sector].page_size;
console.log(`Erasing. sector ${ erase_pages[page].sector console.log(`Erasing. sector ${erase_pages[page].sector
}, page ${ erase_pages[page].page } @ 0x${ page_addr.toString(16)}`); }, page ${erase_pages[page].page} @ 0x${page_addr.toString(16)}`);
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, cmd, function () { self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, cmd, function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) { self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
@ -882,7 +882,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
if (data[4] == self.state.dfuIDLE) { if (data[4] == self.state.dfuIDLE) {
erase_page_next(); erase_page_next();
} else { } else {
console.log(`Failed to erase page 0x${ page_addr.toString(16) } (did not reach dfuIDLE after clearing`); console.log(`Failed to erase page 0x${page_addr.toString(16)} (did not reach dfuIDLE after clearing`);
self.cleanup(); self.cleanup();
} }
}); });
@ -890,13 +890,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} else if (data[4] == self.state.dfuDNLOAD_IDLE) { } else if (data[4] == self.state.dfuDNLOAD_IDLE) {
erase_page_next(); erase_page_next();
} else { } else {
console.log(`Failed to erase page 0x${ page_addr.toString(16)}`); console.log(`Failed to erase page 0x${page_addr.toString(16)}`);
self.cleanup(); self.cleanup();
} }
}); });
}, delay); }, delay);
} else { } else {
console.log(`Failed to initiate page erase, page 0x${ page_addr.toString(16)}`); console.log(`Failed to initiate page erase, page 0x${page_addr.toString(16)}`);
self.cleanup(); self.cleanup();
} }
}); });
@ -945,13 +945,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
// flash another page // flash another page
write(); write();
} else { } else {
console.log(`Failed to write ${ bytes_to_write }bytes to 0x${ address.toString(16)}`); console.log(`Failed to write ${bytes_to_write}bytes to 0x${address.toString(16)}`);
self.cleanup(); self.cleanup();
} }
}); });
}, delay); }, delay);
} else { } else {
console.log(`Failed to initiate write ${ bytes_to_write }bytes to 0x${ address.toString(16)}`); console.log(`Failed to initiate write ${bytes_to_write}bytes to 0x${address.toString(16)}`);
self.cleanup(); self.cleanup();
} }
}); });
@ -1104,7 +1104,7 @@ STM32DFU_protocol.prototype.cleanup = function () {
var timeSpent = new Date().getTime() - self.upload_time_start; var timeSpent = new Date().getTime() - self.upload_time_start;
console.log(`Script finished after: ${ timeSpent / 1000 } seconds`); console.log(`Script finished after: ${timeSpent / 1000} seconds`);
if (self.callback) { if (self.callback) {
self.callback(); self.callback();

View file

@ -104,7 +104,7 @@ const serial = {
case 'frame_error': case 'frame_error':
case 'parity_error': case 'parity_error':
GUI.log(i18n.getMessage(`serialError${ inflection.camelize(info.error)}`)); GUI.log(i18n.getMessage(`serialError${inflection.camelize(info.error)}`));
self.errorHandler(info.error, 'receive'); self.errorHandler(info.error, 'receive');
break; break;
case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI

View file

@ -789,17 +789,17 @@ function bit_clear(num, bit) {
function update_dataflash_global() { function update_dataflash_global() {
function formatFilesize(bytes) { function formatFilesize(bytes) {
if (bytes < 1024) { if (bytes < 1024) {
return `${bytes }B`; return `${bytes}B`;
} }
const kilobytes = bytes / 1024; const kilobytes = bytes / 1024;
if (kilobytes < 1024) { if (kilobytes < 1024) {
return `${Math.round(kilobytes) }kB`; return `${Math.round(kilobytes)}kB`;
} }
const megabytes = kilobytes / 1024; const megabytes = kilobytes / 1024;
return `${megabytes.toFixed(1) }MB`; return `${megabytes.toFixed(1)}MB`;
} }
const supportsDataflash = FC.DATAFLASH.totalSize > 0; const supportsDataflash = FC.DATAFLASH.totalSize > 0;
@ -817,7 +817,7 @@ function update_dataflash_global() {
width: `${100-(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize) / FC.DATAFLASH.totalSize * 100}%`, width: `${100-(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize) / FC.DATAFLASH.totalSize * 100}%`,
display: 'block', display: 'block',
}); });
$(".dataflash-free_global div").text(`Dataflash: free ${ formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize)}`); $(".dataflash-free_global div").text(`Dataflash: free ${formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize)}`);
} else { } else {
$(".noflash_global").css({ $(".noflash_global").css({
display: 'block', display: 'block',

View file

@ -30,7 +30,7 @@ TABS.adjustments.initialize = function (callback) {
const template = $('#tab-adjustments-templates .adjustments .adjustment'); const template = $('#tab-adjustments-templates .adjustments .adjustment');
const newAdjustment = template.clone(); const newAdjustment = template.clone();
$(newAdjustment).attr('id', `adjustment-${ adjustmentIndex}`); $(newAdjustment).attr('id', `adjustment-${adjustmentIndex}`);
$(newAdjustment).data('index', adjustmentIndex); $(newAdjustment).data('index', adjustmentIndex);
// //
@ -51,7 +51,7 @@ TABS.adjustments.initialize = function (callback) {
channelOptionTemplate.remove(); channelOptionTemplate.remove();
for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) { for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) {
const channelOption = channelOptionTemplate.clone(); const channelOption = channelOptionTemplate.clone();
channelOption.text(`AUX ${ channelIndex + 1}`); channelOption.text(`AUX ${channelIndex + 1}`);
channelOption.val(channelIndex); channelOption.val(channelIndex);
channelList.append(channelOption); channelList.append(channelOption);
} }
@ -76,7 +76,7 @@ TABS.adjustments.initialize = function (callback) {
let switchOption; let switchOption;
for (let switchIndex = 0; switchIndex < auxChannelCount; switchIndex++) { for (let switchIndex = 0; switchIndex < auxChannelCount; switchIndex++) {
switchOption = switchOptionTemplate.clone(); switchOption = switchOptionTemplate.clone();
switchOption.text(`AUX ${ switchIndex + 1}`); switchOption.text(`AUX ${switchIndex + 1}`);
switchOption.val(switchIndex); switchOption.val(switchIndex);
switchList.append(switchOption); switchList.append(switchOption);
} }
@ -250,7 +250,7 @@ TABS.adjustments.initialize = function (callback) {
return; return;
} }
$(this).find('.range .marker').css('left', `${percentage }%`); $(this).find('.range .marker').css('left', `${percentage}%`);
}); });
} }
@ -304,7 +304,7 @@ TABS.adjustments.adjust_template = function () {
} }
for (let i = 0; i < elementsNumber; i++) { for (let i = 0; i < elementsNumber; i++) {
selectFunction.append(new Option(i18n.getMessage(`adjustmentsFunction${ i}`), i)); selectFunction.append(new Option(i18n.getMessage(`adjustmentsFunction${i}`), i));
} }
// For 1.40, the D Setpoint has been replaced, so we replace it with the correct values // For 1.40, the D Setpoint has been replaced, so we replace it with the correct values

View file

@ -46,7 +46,7 @@ TABS.auxiliary.initialize = function (callback) {
// Adjust the name of the box if a peripheral is selected // Adjust the name of the box if a peripheral is selected
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName); modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
$(newMode).attr('id', `mode-${ modeIndex}`); $(newMode).attr('id', `mode-${modeIndex}`);
$(newMode).find('.name').text(modeName); $(newMode).find('.name').text(modeName);
$(newMode).data('index', modeIndex); $(newMode).data('index', modeIndex);
@ -99,7 +99,7 @@ TABS.auxiliary.initialize = function (callback) {
for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) { for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) {
channelOption = channelOptionTemplate.clone(); channelOption = channelOptionTemplate.clone();
channelOption.text(`AUX ${ channelIndex + 1}`); channelOption.text(`AUX ${channelIndex + 1}`);
channelOption.val(channelIndex); channelOption.val(channelIndex);
channelList.append(channelOption); channelList.append(channelOption);
} }
@ -151,7 +151,7 @@ TABS.auxiliary.initialize = function (callback) {
const rangeIndex = modeRanges.children().length; const rangeIndex = modeRanges.children().length;
let rangeElement = $('#tab-auxiliary-templates .range').clone(); let rangeElement = $('#tab-auxiliary-templates .range').clone();
rangeElement.attr('id', `mode-${ modeIndex }-range-${ rangeIndex}`); rangeElement.attr('id', `mode-${modeIndex}-range-${rangeIndex}`);
modeRanges.append(rangeElement); modeRanges.append(rangeElement);
if (rangeIndex == 0) { if (rangeIndex == 0) {
@ -172,9 +172,9 @@ TABS.auxiliary.initialize = function (callback) {
}), }),
}); });
const elementName = `#mode-${ modeIndex }-range-${ rangeIndex}`; const elementName = `#mode-${modeIndex}-range-${rangeIndex}`;
$(`${elementName } .channel-slider`).Link('lower').to($(`${elementName } .lowerLimitValue`)); $(`${elementName} .channel-slider`).Link('lower').to($(`${elementName} .lowerLimitValue`));
$(`${elementName } .channel-slider`).Link('upper').to($(`${elementName } .upperLimitValue`)); $(`${elementName} .channel-slider`).Link('upper').to($(`${elementName} .upperLimitValue`));
let sliderValues = [900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100]; let sliderValues = [900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100];
if ($(window).width() < 575) { if ($(window).width() < 575) {
@ -215,7 +215,7 @@ TABS.auxiliary.initialize = function (callback) {
const linkIndex = modeRanges.children().length; const linkIndex = modeRanges.children().length;
let linkElement = $('#tab-auxiliary-templates .link').clone(); let linkElement = $('#tab-auxiliary-templates .link').clone();
linkElement.attr('id', `mode-${ modeIndex }-link-${ linkIndex}`); linkElement.attr('id', `mode-${modeIndex}-link-${linkIndex}`);
modeRanges.append(linkElement); modeRanges.append(linkElement);
if (linkIndex == 0) { if (linkIndex == 0) {
@ -226,7 +226,7 @@ TABS.auxiliary.initialize = function (callback) {
// disable the option associated with this mode // disable the option associated with this mode
const linkSelect = $(linkElement).find('.linkedTo'); const linkSelect = $(linkElement).find('.linkedTo');
$(linkSelect).find(`option[value="${ modeId }"]`).prop('disabled',true); $(linkSelect).find(`option[value="${modeId}"]`).prop('disabled',true);
$(linkElement).find('.deleteLink').data('linkElement', linkElement); $(linkElement).find('.deleteLink').data('linkElement', linkElement);
$(linkElement).find('.deleteLink').data('modeElement', modeElement); $(linkElement).find('.deleteLink').data('modeElement', modeElement);
@ -422,7 +422,7 @@ TABS.auxiliary.initialize = function (callback) {
return; return;
} }
$(this).find('.marker').css('left', `${percentage }%`); $(this).find('.marker').css('left', `${percentage}%`);
}); });
} }
@ -434,7 +434,7 @@ TABS.auxiliary.initialize = function (callback) {
function update_ui() { function update_ui() {
let hasUsedMode = false; let hasUsedMode = false;
for (let i = 0; i < FC.AUX_CONFIG.length; i++) { for (let i = 0; i < FC.AUX_CONFIG.length; i++) {
let modeElement = $(`#mode-${ i}`); let modeElement = $(`#mode-${i}`);
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) { if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
// if the mode is unused, skip it // if the mode is unused, skip it
modeElement.removeClass('off').removeClass('on').removeClass('disabled'); modeElement.removeClass('off').removeClass('on').removeClass('disabled');
@ -469,7 +469,7 @@ TABS.auxiliary.initialize = function (callback) {
// that arming is disabled. // that arming is disabled.
if (armSwitchActive) { if (armSwitchActive) {
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('off').addClass('disabled'); $('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('off').addClass('disabled');
$('.mode .name').eq(i).html(`${FC.AUX_CONFIG[i] }<br>${ i18n.getMessage('auxiliaryDisabled')}`); $('.mode .name').eq(i).html(`${FC.AUX_CONFIG[i]}<br>${i18n.getMessage('auxiliaryDisabled')}`);
} else { } else {
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('disabled').addClass('off'); $('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('disabled').addClass('off');
$('.mode .name').eq(i).html(FC.AUX_CONFIG[i]); $('.mode .name').eq(i).html(FC.AUX_CONFIG[i]);
@ -483,7 +483,7 @@ TABS.auxiliary.initialize = function (callback) {
let hideUnused = hideUnusedModes && hasUsedMode; let hideUnused = hideUnusedModes && hasUsedMode;
for (let i = 0; i < FC.AUX_CONFIG.length; i++) { for (let i = 0; i < FC.AUX_CONFIG.length; i++) {
let modeElement = $(`#mode-${ i}`); let modeElement = $(`#mode-${i}`);
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) { if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
modeElement.toggle(!hideUnused); modeElement.toggle(!hideUnused);
} }

View file

@ -37,7 +37,7 @@ function commandWithBackSpaces(command, buffer, noOfCharsToDelete) {
function getCliCommand(command, cliBuffer) { function getCliCommand(command, cliBuffer) {
const buffer = removePromptHash(cliBuffer); const buffer = removePromptHash(cliBuffer);
const bufferRegex = new RegExp(`^${ buffer}`, 'g'); const bufferRegex = new RegExp(`^${buffer}`, 'g');
if (command.match(bufferRegex)) { if (command.match(bufferRegex)) {
return command.replace(bufferRegex, ''); return command.replace(bufferRegex, '');
} }
@ -146,7 +146,7 @@ TABS.cli.initialize = function (callback) {
const filename = generateFilename(prefix, suffix); const filename = generateFilename(prefix, suffix);
const accepts = [{ const accepts = [{
description: `${suffix.toUpperCase() } files`, extensions: [suffix], description: `${suffix.toUpperCase()} files`, extensions: [suffix],
}]; }];
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, accepts: accepts}, function(entry) { chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, accepts: accepts}, function(entry) {
@ -377,7 +377,7 @@ function writeLineToOutput(text) {
if (text.startsWith("###ERROR")) { if (text.startsWith("###ERROR")) {
writeToOutput(`<span class="error_message">${text}</span><br>`); writeToOutput(`<span class="error_message">${text}</span><br>`);
} else { } else {
writeToOutput(`${text }<br>`); writeToOutput(`${text}<br>`);
} }
} }
@ -488,11 +488,11 @@ TABS.cli.read = function (readInfo) {
}; };
TABS.cli.sendLine = function (line, callback) { TABS.cli.sendLine = function (line, callback) {
this.send(`${line }\n`, callback); this.send(`${line}\n`, callback);
}; };
TABS.cli.sendNativeAutoComplete = function (line, callback) { TABS.cli.sendNativeAutoComplete = function (line, callback) {
this.send(`${line }\t`, callback); this.send(`${line}\t`, callback);
}; };
TABS.cli.send = function (line, callback) { TABS.cli.send = function (line, callback) {

View file

@ -118,7 +118,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
let modeName = FC.AUX_CONFIG[modeIndex]; let modeName = FC.AUX_CONFIG[modeIndex];
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName); modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
auxAssignment[modeRange.auxChannelIndex] += `<span class="modename">${ modeName }</span>`; auxAssignment[modeRange.auxChannelIndex] += `<span class="modename">${modeName}</span>`;
} }
} }
@ -139,10 +139,10 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
fullChannels_e.append(`\ fullChannels_e.append(`\
<div class="number">\ <div class="number">\
<div class="channelprimary">\ <div class="channelprimary">\
<span>${ channelNames[i] }</span>\ <span>${channelNames[i]}</span>\
</div>\ </div>\
<div class="cf_tip channelsetting" title="${ i18n.getMessage("failsafeChannelFallbackSettingsAuto") }">\ <div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsAuto")}">\
<select class="aux_set" id="${ i }">\ <select class="aux_set" id="${i}">\
<option value="0">Auto</option>\ <option value="0">Auto</option>\
<option value="1">Hold</option>\ <option value="1">Hold</option>\
</select>\ </select>\
@ -153,16 +153,16 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
fullChannels_e.append(`\ fullChannels_e.append(`\
<div class="number">\ <div class="number">\
<div class="channelprimary">\ <div class="channelprimary">\
<span>${ channelNames[i] }</span>\ <span>${channelNames[i]}</span>\
</div>\ </div>\
<div class="cf_tip channelsetting" title="${ i18n.getMessage("failsafeChannelFallbackSettingsAuto") }">\ <div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsAuto")}">\
<select class="aux_set" id="${ i }">\ <select class="aux_set" id="${i}">\
<option value="0">Auto</option>\ <option value="0">Auto</option>\
<option value="1">Hold</option>\ <option value="1">Hold</option>\
<option value="2">Set</option>\ <option value="2">Set</option>\
</select>\ </select>\
</div>\ </div>\
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${ i }"/></div>\ <div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${i}"/></div>\
</div>\ </div>\
`); `);
} }
@ -171,16 +171,16 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
fullChannels_e.append(`\ fullChannels_e.append(`\
<div class="number">\ <div class="number">\
<div class="channelauxiliary">\ <div class="channelauxiliary">\
<span class="channelname">${ i18n.getMessage(messageKey) }</span>\ <span class="channelname">${i18n.getMessage(messageKey)}</span>\
${ auxAssignment[aux_assignment_index++] }\ ${auxAssignment[aux_assignment_index++]}\
</div>\ </div>\
<div class="cf_tip channelsetting" title="${ i18n.getMessage("failsafeChannelFallbackSettingsHold") }">\ <div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsHold")}">\
<select class="aux_set" id="${ i }">\ <select class="aux_set" id="${i}">\
<option value="1">Hold</option>\ <option value="1">Hold</option>\
<option value="2">Set</option>\ <option value="2">Set</option>\
</select>\ </select>\
</div>\ </div>\
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${ i }"/></div>\ <div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${i}"/></div>\
</div>\ </div>\
`); `);
} }

View file

@ -59,7 +59,7 @@ firmware_flasher.initialize = function (callback) {
} }
function show_loaded_hex(summary) { function show_loaded_hex(summary) {
self.flashingMessage(`<a class="save_firmware" href="#" title="Save Firmware">${ i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', self.parsed_hex.bytes_total) }</a>`, self.flashingMessage(`<a class="save_firmware" href="#" title="Save Firmware">${i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', self.parsed_hex.bytes_total)}</a>`,
self.FLASH_MESSAGE_TYPES.NEUTRAL); self.FLASH_MESSAGE_TYPES.NEUTRAL);
self.enableFlashing(true); self.enableFlashing(true);
@ -209,7 +209,7 @@ firmware_flasher.initialize = function (callback) {
const month = `0${date.getMonth() + 1}`.slice(-2); const month = `0${date.getMonth() + 1}`.slice(-2);
const year = date.getFullYear(); const year = date.getFullYear();
const hours = `0${date.getHours()}`.slice(-2); const hours = `0${date.getHours()}`.slice(-2);
const minutes = `0${ date.getMinutes()}`.slice(-2); const minutes = `0${date.getMinutes()}`.slice(-2);
const formattedDate = `${dayOfTheMonth}-${month}-${year} ${hours}:${minutes}`; const formattedDate = `${dayOfTheMonth}-${month}-${year} ${hours}:${minutes}`;
const descriptor = { const descriptor = {
"releaseUrl": release.html_url, "releaseUrl": release.html_url,

View file

@ -59,12 +59,12 @@ TABS.gps.initialize = function (callback) {
} }
$('.GPS_info td.fix').html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse')); $('.GPS_info td.fix').html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
$('.GPS_info td.alt').text(`${alt } m`); $('.GPS_info td.alt').text(`${alt} m`);
$('.GPS_info td.lat a').prop('href', url).text(`${lat.toFixed(4) } deg`); $('.GPS_info td.lat a').prop('href', url).text(`${lat.toFixed(4)} deg`);
$('.GPS_info td.lon a').prop('href', url).text(`${lon.toFixed(4) } deg`); $('.GPS_info td.lon a').prop('href', url).text(`${lon.toFixed(4)} deg`);
$('.GPS_info td.speed').text(`${FC.GPS_DATA.speed } cm/s`); $('.GPS_info td.speed').text(`${FC.GPS_DATA.speed} cm/s`);
$('.GPS_info td.sats').text(FC.GPS_DATA.numSat); $('.GPS_info td.sats').text(FC.GPS_DATA.numSat);
$('.GPS_info td.distToHome').text(`${FC.GPS_DATA.distanceToHome } m`); $('.GPS_info td.distToHome').text(`${FC.GPS_DATA.distanceToHome} m`);
// Update GPS Signal Strengths // Update GPS Signal Strengths
const eSsTable = $('div.GPS_signal_strength table'); const eSsTable = $('div.GPS_signal_strength table');

View file

@ -24,7 +24,7 @@ landing.initialize = function (callback) {
bottomSection.append(' <a href="#" i18n="language_default_pretty" lang="DEFAULT"></a>'); bottomSection.append(' <a href="#" i18n="language_default_pretty" lang="DEFAULT"></a>');
const languagesAvailables = i18n.getLanguagesAvailables(); const languagesAvailables = i18n.getLanguagesAvailables();
languagesAvailables.forEach(function(element) { languagesAvailables.forEach(function(element) {
bottomSection.append(` <a href="#" lang="${ element }" i18n="language_${ element }"></a>`); bottomSection.append(` <a href="#" lang="${element}" i18n="language_${element}"></a>`);
}); });
bottomSection.find('a').each(function(index) { bottomSection.find('a').each(function(index) {
let element = $(this); let element = $(this);

View file

@ -143,13 +143,13 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
const classesToRemove = []; const classesToRemove = [];
TABS.led_strip.baseFuncs.forEach(function(letter) { TABS.led_strip.baseFuncs.forEach(function(letter) {
classesToRemove.push(`function-${ letter}`); classesToRemove.push(`function-${letter}`);
}); });
TABS.led_strip.overlays.forEach(function(letter) { TABS.led_strip.overlays.forEach(function(letter) {
classesToRemove.push(`function-${ letter}`); classesToRemove.push(`function-${letter}`);
}); });
TABS.led_strip.directions.forEach(function(letter) { TABS.led_strip.directions.forEach(function(letter) {
classesToRemove.push(`dir-${ letter}`); classesToRemove.push(`dir-${letter}`);
}); });
$(element).removeClass(classesToRemove.join(' ')); $(element).removeClass(classesToRemove.join(' '));
} }
@ -159,13 +159,13 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
const that = this; const that = this;
if ($('.ui-selected').length > 0) { if ($('.ui-selected').length > 0) {
TABS.led_strip.directions.forEach(function(letter) { TABS.led_strip.directions.forEach(function(letter) {
if ($(that).is(`.dir-${ letter}`)) { if ($(that).is(`.dir-${letter}`)) {
if ($(that).is('.btnOn')) { if ($(that).is('.btnOn')) {
$(that).removeClass('btnOn'); $(that).removeClass('btnOn');
$('.ui-selected').removeClass(`dir-${ letter}`); $('.ui-selected').removeClass(`dir-${letter}`);
} else { } else {
$(that).addClass('btnOn'); $(that).addClass('btnOn');
$('.ui-selected').addClass(`dir-${ letter}`); $('.ui-selected').addClass(`dir-${letter}`);
} }
} }
}); });
@ -179,10 +179,10 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$('.mode_colors').on('click', 'button', function() { $('.mode_colors').on('click', 'button', function() {
const that = this; const that = this;
FC.LED_MODE_COLORS.forEach(function(mc) { FC.LED_MODE_COLORS.forEach(function(mc) {
if ($(that).is(`.mode_color-${ mc.mode }-${ mc.direction}`)) { if ($(that).is(`.mode_color-${mc.mode}-${mc.direction}`)) {
if ($(that).is('.btnOn')) { if ($(that).is('.btnOn')) {
$(that).removeClass('btnOn'); $(that).removeClass('btnOn');
$('.ui-selected').removeClass(`mode_color-${ mc.mode }-${ mc.direction}`); $('.ui-selected').removeClass(`mode_color-${mc.mode}-${mc.direction}`);
selectedModeColor = null; selectedModeColor = null;
} else { } else {
$(that).addClass('btnOn'); $(that).addClass('btnOn');
@ -190,7 +190,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// select the color button // select the color button
for (let colorIndex = 0; colorIndex < 16; colorIndex++) { for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
const className = `.color-${ colorIndex}`; const className = `.color-${colorIndex}`;
if (colorIndex == getModeColor(mc.mode, mc.direction)) { if (colorIndex == getModeColor(mc.mode, mc.direction)) {
$(className).addClass('btnOn'); $(className).addClass('btnOn');
selectedColorIndex = colorIndex; selectedColorIndex = colorIndex;
@ -237,12 +237,12 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
for (let colorIndex = 0; colorIndex < 16; colorIndex++) { for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
colorButtons.removeClass('btnOn'); colorButtons.removeClass('btnOn');
if (selectedModeColor == undefined) if (selectedModeColor == undefined)
$('.ui-selected').removeClass(`color-${ colorIndex}`); $('.ui-selected').removeClass(`color-${colorIndex}`);
if ($(that).is(`.color-${ colorIndex}`)) { if ($(that).is(`.color-${colorIndex}`)) {
selectedColorIndex = colorIndex; selectedColorIndex = colorIndex;
if (selectedModeColor == undefined) if (selectedModeColor == undefined)
$('.ui-selected').addClass(`color-${ colorIndex}`); $('.ui-selected').addClass(`color-${colorIndex}`);
} }
} }
@ -344,21 +344,21 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// Get function & overlays or current cell // Get function & overlays or current cell
TABS.led_strip.directions.forEach(function(letter) { TABS.led_strip.directions.forEach(function(letter) {
const className = `.dir-${ letter}`; const className = `.dir-${letter}`;
if ($(that).is(className)) { if ($(that).is(className)) {
directionsInSelection.push(className); directionsInSelection.push(className);
} }
}); });
TABS.led_strip.baseFuncs.forEach(function(letter) { TABS.led_strip.baseFuncs.forEach(function(letter) {
const className = `.function-${ letter}`; const className = `.function-${letter}`;
if ($(that).is(className)) { if ($(that).is(className)) {
functionsInSelection.push(className); functionsInSelection.push(className);
} }
}); });
TABS.led_strip.overlays.forEach(function(letter) { TABS.led_strip.overlays.forEach(function(letter) {
const className = `.function-${ letter}`; const className = `.function-${letter}`;
if ($(that).is(className)) { if ($(that).is(className)) {
functionsInSelection.push(className); functionsInSelection.push(className);
} }
@ -370,8 +370,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$('select.functionSelect').val(""); $('select.functionSelect').val("");
TABS.led_strip.baseFuncs.forEach(function(letter) { TABS.led_strip.baseFuncs.forEach(function(letter) {
const className = `function-${ letter}`; const className = `function-${letter}`;
if ($('select.functionSelect').is(`.${ className}`)) { if ($('select.functionSelect').is(`.${className}`)) {
$('select.functionSelect').removeClass(className); $('select.functionSelect').removeClass(className);
} }
}); });
@ -382,7 +382,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// set active color // set active color
for (let colorIndex = 0; colorIndex < 16; colorIndex++) { for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
const className = `.color-${ colorIndex}`; const className = `.color-${colorIndex}`;
if ($(uiSelectedLast).is(className)) { if ($(uiSelectedLast).is(className)) {
$(className).addClass('btnOn'); $(className).addClass('btnOn');
selectedColorIndex = colorIndex; selectedColorIndex = colorIndex;
@ -407,8 +407,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// Update active function in combobox // Update active function in combobox
TABS.led_strip.baseFuncs.forEach(function(letter) { TABS.led_strip.baseFuncs.forEach(function(letter) {
if ($(uiSelectedLast).is(functionTag + letter)) { if ($(uiSelectedLast).is(functionTag + letter)) {
$('select.functionSelect').val(`function-${ letter}`); $('select.functionSelect').val(`function-${letter}`);
$('select.functionSelect').addClass(`function-${ letter}`); $('select.functionSelect').addClass(`function-${letter}`);
} }
}); });
} }
@ -443,9 +443,9 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$('.mode_colors').find('button').each(function() { $('.mode_colors').find('button').each(function() {
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
for (let j = 0; j < 6; j++) { for (let j = 0; j < 6; j++) {
if ($(this).hasClass(`mode_color-${ i }-${ j}`)) { if ($(this).hasClass(`mode_color-${i}-${j}`)) {
$(this).removeClass(`mode_color-${ i }-${ j}`); $(this).removeClass(`mode_color-${i}-${j}`);
$(this).addClass(`mode_color-${ mode }-${ j}`); $(this).addClass(`mode_color-${mode}-${j}`);
} }
} }
} }
@ -469,27 +469,27 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
case 't': case 't':
case 'o': case 'o':
case 's': case 's':
if (areModifiersActive(`function-${ f}`)) if (areModifiersActive(`function-${f}`))
p.addClass(`function-${ letter}`); p.addClass(`function-${letter}`);
break; break;
case 'b': case 'b':
case 'n': case 'n':
if (areBlinkersActive(`function-${ f}`)) if (areBlinkersActive(`function-${f}`))
p.addClass(`function-${ letter}`); p.addClass(`function-${letter}`);
break; break;
case 'i': case 'i':
if (areOverlaysActive(`function-${ f}`)) if (areOverlaysActive(`function-${f}`))
p.addClass(`function-${ letter}`); p.addClass(`function-${letter}`);
break; break;
case 'w': case 'w':
if (areOverlaysActive(`function-${ f}`)) if (areOverlaysActive(`function-${f}`))
if (isWarningActive(`function-${ f}`)) if (isWarningActive(`function-${f}`))
p.addClass(`function-${ letter}`); p.addClass(`function-${letter}`);
break; break;
case 'v': case 'v':
if (areOverlaysActive(`function-${ f}`)) if (areOverlaysActive(`function-${f}`))
if (isVtxActive(`function-${ f}`)) if (isVtxActive(`function-${f}`))
p.addClass(`function-${ letter}`); p.addClass(`function-${letter}`);
break; break;
} }
} }
@ -497,7 +497,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
}); });
} else { } else {
$('.ui-selected').removeClass(`function-${ letter}`); $('.ui-selected').removeClass(`function-${letter}`);
} }
return $(that).is(':checked'); return $(that).is(':checked');
} }
@ -668,7 +668,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}); });
TABS.led_strip.directions.forEach(function(letter){ TABS.led_strip.directions.forEach(function(letter){
if ($(that).is(`.dir-${ letter}`)) { if ($(that).is(`.dir-${letter}`)) {
directions += letter; directions += letter;
} }
}); });
@ -937,19 +937,19 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
const activeFunction = $('select.functionSelect').val(); const activeFunction = $('select.functionSelect').val();
TABS.led_strip.baseFuncs.forEach(function(letter) { TABS.led_strip.baseFuncs.forEach(function(letter) {
if (activeFunction == `function-${ letter}`) { if (activeFunction == `function-${letter}`) {
$('select.functionSelect').addClass(`function-${ letter}`); $('select.functionSelect').addClass(`function-${letter}`);
$('.ui-selected').find('.wire').each(function() { $('.ui-selected').find('.wire').each(function() {
if ($(this).text() != "") if ($(this).text() != "")
$(this).parent().addClass(`function-${ letter}`); $(this).parent().addClass(`function-${letter}`);
}); });
unselectOverlays(letter); unselectOverlays(letter);
} else { } else {
$('select.functionSelect').removeClass(`function-${ letter}`); $('select.functionSelect').removeClass(`function-${letter}`);
$('.ui-selected').removeClass(`function-${ letter}`); $('.ui-selected').removeClass(`function-${letter}`);
} }
if (activeFunction == '') { if (activeFunction == '') {
@ -990,11 +990,11 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
function unselectOverlay(func, overlay) { function unselectOverlay(func, overlay) {
$(`input.function-${ overlay}`).prop('checked', false); $(`input.function-${overlay}`).prop('checked', false);
$(`input.function-${ overlay}`).change(); $(`input.function-${overlay}`).change();
$('.ui-selected').each(function() { $('.ui-selected').each(function() {
if (func === '' || $(this).is(functionTag + func)) { if (func === '' || $(this).is(functionTag + func)) {
$(this).removeClass(`function-${ overlay}`); $(this).removeClass(`function-${overlay}`);
} }
}); });
} }
@ -1004,7 +1004,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
value = Number(value); value = Number(value);
const className = `.color-${ selectedColorIndex}`; const className = `.color-${selectedColorIndex}`;
if ($(className).hasClass('btnOn')) { if ($(className).hasClass('btnOn')) {
switch (hsvIndex) { switch (hsvIndex) {
case 0: case 0:
@ -1049,12 +1049,12 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$(this).find('.overlay-color').show(); $(this).find('.overlay-color').show();
for (let colorIndex = 0; colorIndex < 16; colorIndex++) { for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
const className = `color-${ colorIndex}`; const className = `color-${colorIndex}`;
if ($(this).is(`.${ className}`)) { if ($(this).is(`.${className}`)) {
$(this).find('.overlay-color').addClass(className); $(this).find('.overlay-color').addClass(className);
$(this).find('.overlay-color').css('background-color', HsvToColor(FC.LED_COLORS[colorIndex])); $(this).find('.overlay-color').css('background-color', HsvToColor(FC.LED_COLORS[colorIndex]));
} else { } else {
if ($(this).find('.overlay-color').is(`.${ className}`)) if ($(this).find('.overlay-color').is(`.${className}`))
$(this).find('.overlay-color').removeClass(className); $(this).find('.overlay-color').removeClass(className);
} }
} }

View file

@ -158,17 +158,17 @@ logging.initialize = function (callback) {
break; break;
case 'MSP_RC': case 'MSP_RC':
for (let chan = 0; chan < FC.RC.active_channels; chan++) { for (let chan = 0; chan < FC.RC.active_channels; chan++) {
head += `${',' + 'RC'}${ chan}`; head += `${',' + 'RC'}${chan}`;
} }
break; break;
case 'MSP_MOTOR': case 'MSP_MOTOR':
for (let motor = 0; motor < FC.MOTOR_DATA.length; motor++) { for (let motor = 0; motor < FC.MOTOR_DATA.length; motor++) {
head += `${',' + 'Motor'}${ motor}`; head += `${',' + 'Motor'}${motor}`;
} }
break; break;
case 'MSP_DEBUG': case 'MSP_DEBUG':
for (let debug = 0; debug < FC.SENSOR_DATA.debug.length; debug++) { for (let debug = 0; debug < FC.SENSOR_DATA.debug.length; debug++) {
head += `${',' + 'Debug'}${ debug}`; head += `${',' + 'Debug'}${debug}`;
} }
break; break;
} }
@ -183,43 +183,43 @@ logging.initialize = function (callback) {
for (let i = 0; i < requestedProperties.length; i++) { for (let i = 0; i < requestedProperties.length; i++) {
switch (requestedProperties[i]) { switch (requestedProperties[i]) {
case 'MSP_RAW_IMU': case 'MSP_RAW_IMU':
sample += `,${ FC.SENSOR_DATA.gyroscope}`; sample += `,${FC.SENSOR_DATA.gyroscope}`;
sample += `,${ FC.SENSOR_DATA.accelerometer}`; sample += `,${FC.SENSOR_DATA.accelerometer}`;
sample += `,${ FC.SENSOR_DATA.magnetometer}`; sample += `,${FC.SENSOR_DATA.magnetometer}`;
break; break;
case 'MSP_ATTITUDE': case 'MSP_ATTITUDE':
sample += `,${ FC.SENSOR_DATA.kinematics[0]}`; sample += `,${FC.SENSOR_DATA.kinematics[0]}`;
sample += `,${ FC.SENSOR_DATA.kinematics[1]}`; sample += `,${FC.SENSOR_DATA.kinematics[1]}`;
sample += `,${ FC.SENSOR_DATA.kinematics[2]}`; sample += `,${FC.SENSOR_DATA.kinematics[2]}`;
break; break;
case 'MSP_ALTITUDE': case 'MSP_ALTITUDE':
sample += `,${ FC.SENSOR_DATA.altitude}`; sample += `,${FC.SENSOR_DATA.altitude}`;
break; break;
case 'MSP_RAW_GPS': case 'MSP_RAW_GPS':
sample += `,${ FC.GPS_DATA.fix}`; sample += `,${FC.GPS_DATA.fix}`;
sample += `,${ FC.GPS_DATA.numSat}`; sample += `,${FC.GPS_DATA.numSat}`;
sample += `,${ FC.GPS_DATA.lat / 10000000}`; sample += `,${FC.GPS_DATA.lat / 10000000}`;
sample += `,${ FC.GPS_DATA.lon / 10000000}`; sample += `,${FC.GPS_DATA.lon / 10000000}`;
sample += `,${ FC.GPS_DATA.alt}`; sample += `,${FC.GPS_DATA.alt}`;
sample += `,${ FC.GPS_DATA.speed}`; sample += `,${FC.GPS_DATA.speed}`;
sample += `,${ FC.GPS_DATA.ground_course}`; sample += `,${FC.GPS_DATA.ground_course}`;
break; break;
case 'MSP_ANALOG': case 'MSP_ANALOG':
sample += `,${ FC.ANALOG.voltage}`; sample += `,${FC.ANALOG.voltage}`;
sample += `,${ FC.ANALOG.amperage}`; sample += `,${FC.ANALOG.amperage}`;
sample += `,${ FC.ANALOG.mAhdrawn}`; sample += `,${FC.ANALOG.mAhdrawn}`;
sample += `,${ FC.ANALOG.rssi}`; sample += `,${FC.ANALOG.rssi}`;
break; break;
case 'MSP_RC': case 'MSP_RC':
for (let chan = 0; chan < FC.RC.active_channels; chan++) { for (let chan = 0; chan < FC.RC.active_channels; chan++) {
sample += `,${ FC.RC.channels[chan]}`; sample += `,${FC.RC.channels[chan]}`;
} }
break; break;
case 'MSP_MOTOR': case 'MSP_MOTOR':
sample += `,${ FC.MOTOR_DATA}`; sample += `,${FC.MOTOR_DATA}`;
break; break;
case 'MSP_DEBUG': case 'MSP_DEBUG':
sample += `,${ FC.SENSOR_DATA.debug}`; sample += `,${FC.SENSOR_DATA.debug}`;
break; break;
} }
} }
@ -239,7 +239,7 @@ logging.initialize = function (callback) {
const filename = generateFilename(prefix, suffix); const filename = generateFilename(prefix, suffix);
const accepts = [{ const accepts = [{
description: `${suffix.toUpperCase() } files`, extensions: [suffix], description: `${suffix.toUpperCase()} files`, extensions: [suffix],
}]; }];
// create or load the file // create or load the file
@ -252,7 +252,7 @@ logging.initialize = function (callback) {
// echo/console log path specified // echo/console log path specified
chrome.fileSystem.getDisplayPath(fileEntry, function(path) { chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
console.log(`Log file path: ${ path}`); console.log(`Log file path: ${path}`);
}); });
// change file entry from read only to read/write // change file entry from read only to read/write
@ -315,7 +315,7 @@ logging.initialize = function (callback) {
fileWriter.seek(fileWriter.length); fileWriter.seek(fileWriter.length);
} }
fileWriter.write(new Blob([`${data }\n`], {type: 'text/plain'})); fileWriter.write(new Blob([`${data}\n`], {type: 'text/plain'}));
} }
}; };

View file

@ -1016,7 +1016,7 @@ TABS.motors.initialize = function (callback) {
// Reduce the size of the value if too big // Reduce the size of the value if too big
if (rpmMotorValue > 999999) { if (rpmMotorValue > 999999) {
rpmMotorValue = `${(rpmMotorValue / 1000000).toFixed(5 - (rpmMotorValue / 1000000).toFixed(0).toString().length) }M`; rpmMotorValue = `${(rpmMotorValue / 1000000).toFixed(5 - (rpmMotorValue / 1000000).toFixed(0).toString().length)}M`;
} }
rpmMotorValue = rpmMotorValue.toString().padStart(MAX_VALUE_SIZE); rpmMotorValue = rpmMotorValue.toString().padStart(MAX_VALUE_SIZE);

View file

@ -167,21 +167,21 @@ TABS.onboard_logging.initialize = function (callback) {
deviceSelect.empty(); deviceSelect.empty();
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
deviceSelect.append(`<option value="0">${ i18n.getMessage('blackboxLoggingNone') }</option>`); deviceSelect.append(`<option value="0">${i18n.getMessage('blackboxLoggingNone')}</option>`);
if (FC.DATAFLASH.supported) { if (FC.DATAFLASH.supported) {
deviceSelect.append(`<option value="1">${ i18n.getMessage('blackboxLoggingFlash') }</option>`); deviceSelect.append(`<option value="1">${i18n.getMessage('blackboxLoggingFlash')}</option>`);
} }
if (FC.SDCARD.supported) { if (FC.SDCARD.supported) {
deviceSelect.append(`<option value="2">${ i18n.getMessage('blackboxLoggingSdCard') }</option>`); deviceSelect.append(`<option value="2">${i18n.getMessage('blackboxLoggingSdCard')}</option>`);
} }
deviceSelect.append(`<option value="3">${ i18n.getMessage('blackboxLoggingSerial') }</option>`); deviceSelect.append(`<option value="3">${i18n.getMessage('blackboxLoggingSerial')}</option>`);
} else { } else {
deviceSelect.append(`<option value="0">${ i18n.getMessage('blackboxLoggingSerial') }</option>`); deviceSelect.append(`<option value="0">${i18n.getMessage('blackboxLoggingSerial')}</option>`);
if (FC.DATAFLASH.ready) { if (FC.DATAFLASH.ready) {
deviceSelect.append(`<option value="1">${ i18n.getMessage('blackboxLoggingFlash') }</option>`); deviceSelect.append(`<option value="1">${i18n.getMessage('blackboxLoggingFlash')}</option>`);
} }
if (FC.SDCARD.supported) { if (FC.SDCARD.supported) {
deviceSelect.append(`<option value="2">${ i18n.getMessage('blackboxLoggingSdCard') }</option>`); deviceSelect.append(`<option value="2">${i18n.getMessage('blackboxLoggingSdCard')}</option>`);
} }
} }
@ -264,11 +264,11 @@ TABS.onboard_logging.initialize = function (callback) {
loggingRateUnit = " kHz"; loggingRateUnit = " kHz";
} }
} }
loggingRatesSelect.append(`<option value="${ loggingRates[i].num }/${ loggingRates[i].denom }">${ loggingRatesSelect.append(`<option value="${loggingRates[i].num}/${loggingRates[i].denom}">${
loggingRate }${loggingRateUnit } (${ Math.round(loggingRates[i].num / loggingRates[i].denom * 100) }%)</option>`); loggingRate}${loggingRateUnit} (${Math.round(loggingRates[i].num / loggingRates[i].denom * 100)}%)</option>`);
} }
loggingRatesSelect.val(`${FC.BLACKBOX.blackboxRateNum }/${ FC.BLACKBOX.blackboxRateDenom}`); loggingRatesSelect.val(`${FC.BLACKBOX.blackboxRateNum}/${FC.BLACKBOX.blackboxRateDenom}`);
} }
} }
@ -384,24 +384,24 @@ TABS.onboard_logging.initialize = function (callback) {
function formatFilesizeKilobytes(kilobytes) { function formatFilesizeKilobytes(kilobytes) {
if (kilobytes < 1024) { if (kilobytes < 1024) {
return `${Math.round(kilobytes) }kB`; return `${Math.round(kilobytes)}kB`;
} }
const megabytes = kilobytes / 1024; const megabytes = kilobytes / 1024;
let gigabytes; let gigabytes;
if (megabytes < 900) { if (megabytes < 900) {
return `${megabytes.toFixed(1) }MB`; return `${megabytes.toFixed(1)}MB`;
} else { } else {
gigabytes = megabytes / 1024; gigabytes = megabytes / 1024;
return `${gigabytes.toFixed(1) }GB`; return `${gigabytes.toFixed(1)}GB`;
} }
} }
function formatFilesizeBytes(bytes) { function formatFilesizeBytes(bytes) {
if (bytes < 1024) { if (bytes < 1024) {
return `${bytes }B`; return `${bytes}B`;
} }
return formatFilesizeKilobytes(bytes / 1024); return formatFilesizeKilobytes(bytes / 1024);
} }
@ -413,7 +413,7 @@ TABS.onboard_logging.initialize = function (callback) {
display: 'block', display: 'block',
}); });
$("div", bar).text((label ? `${label } ` : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value))); $("div", bar).text((label ? `${label} ` : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value)));
} else { } else {
bar.css({ bar.css({
display: 'none', display: 'none',
@ -515,8 +515,8 @@ TABS.onboard_logging.initialize = function (callback) {
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash'); analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash');
const totalTime = (new Date().getTime() - startTime) / 1000; const totalTime = (new Date().getTime() - startTime) / 1000;
console.log(`Received ${ totalBytes } bytes in ${ totalTime.toFixed(2) }s (${ console.log(`Received ${totalBytes} bytes in ${totalTime.toFixed(2)}s (${
(totalBytes / totalTime / 1024).toFixed(2) }kB / s) with block size ${ self.blockSize }.`); (totalBytes / totalTime / 1024).toFixed(2)}kB / s) with block size ${self.blockSize}.`);
if (!isNaN(totalBytesCompressed)) { if (!isNaN(totalBytesCompressed)) {
console.log('Compressed into', totalBytesCompressed, 'bytes with mean compression factor of', totalBytes / totalBytesCompressed); console.log('Compressed into', totalBytesCompressed, 'bytes with mean compression factor of', totalBytes / totalBytesCompressed);
} }
@ -614,7 +614,7 @@ TABS.onboard_logging.initialize = function (callback) {
const filename = generateFilename(prefix, suffix); const filename = generateFilename(prefix, suffix);
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename,
accepts: [{description: `${suffix.toUpperCase() } files`, extensions: [suffix]}]}, function(fileEntry) { accepts: [{description: `${suffix.toUpperCase()} files`, extensions: [suffix]}]}, function(fileEntry) {
if (checkChromeRuntimeError()) { if (checkChromeRuntimeError()) {
if (chrome.runtime.lastError.message !== "User cancelled") { if (chrome.runtime.lastError.message !== "User cancelled") {
GUI.log(i18n.getMessage('dataflashFileWriteFailed')); GUI.log(i18n.getMessage('dataflashFileWriteFailed'));
@ -624,12 +624,12 @@ TABS.onboard_logging.initialize = function (callback) {
// echo/console log path specified // echo/console log path specified
chrome.fileSystem.getDisplayPath(fileEntry, function(path) { chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
console.log(`Dataflash dump file path: ${ path}`); console.log(`Dataflash dump file path: ${path}`);
}); });
fileEntry.createWriter(function (fileWriter) { fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) { fileWriter.onerror = function (e) {
GUI.log(`<strong><span class="message-negative">${ i18n.getMessage('error', { errorMessage: e.target.error.message }) }</span class="message-negative></strong>`); GUI.log(`<strong><span class="message-negative">${i18n.getMessage('error', { errorMessage: e.target.error.message })}</span class="message-negative></strong>`);
console.error(e); console.error(e);

View file

@ -91,7 +91,7 @@ TABS.pid_tuning.initialize = function (callback) {
FC.PID_NAMES.forEach(function(elementPid, indexPid) { FC.PID_NAMES.forEach(function(elementPid, indexPid) {
// Look into the PID table to a row with the name of the pid // Look into the PID table to a row with the name of the pid
const searchRow = $(`.pid_tuning .${ elementPid } input`); const searchRow = $(`.pid_tuning .${elementPid} input`);
// Assign each value // Assign each value
searchRow.each((indexInput, element) => { searchRow.each((indexInput, element) => {
@ -1016,14 +1016,14 @@ TABS.pid_tuning.initialize = function (callback) {
// The notch cutoff must be smaller than the notch frecuency // The notch cutoff must be smaller than the notch frecuency
function adjustNotchCutoff(frequencyName, cutoffName) { function adjustNotchCutoff(frequencyName, cutoffName) {
const frecuency = parseInt($(`.pid_filter input[name='${ frequencyName }']`).val()); const frecuency = parseInt($(`.pid_filter input[name='${frequencyName}']`).val());
const cutoff = parseInt($(`.pid_filter input[name='${ cutoffName }']`).val()); const cutoff = parseInt($(`.pid_filter input[name='${cutoffName}']`).val());
// Change the max and refresh the value if needed // Change the max and refresh the value if needed
const maxCutoff = frecuency == 0 ? 0 : frecuency - 1; const maxCutoff = frecuency == 0 ? 0 : frecuency - 1;
$(`.pid_filter input[name='${ cutoffName }']`).attr("max", maxCutoff); $(`.pid_filter input[name='${cutoffName}']`).attr("max", maxCutoff);
if (cutoff >= frecuency) { if (cutoff >= frecuency) {
$(`.pid_filter input[name='${ cutoffName }']`).val(maxCutoff); $(`.pid_filter input[name='${cutoffName}']`).val(maxCutoff);
} }
} }
@ -1071,7 +1071,7 @@ TABS.pid_tuning.initialize = function (callback) {
FC.PID_NAMES.forEach(function(elementPid, indexPid) { FC.PID_NAMES.forEach(function(elementPid, indexPid) {
// Look into the PID table to a row with the name of the pid // Look into the PID table to a row with the name of the pid
const searchRow = $(`.pid_tuning .${ elementPid } input`); const searchRow = $(`.pid_tuning .${elementPid} input`);
// Assign each value // Assign each value
searchRow.each(function (indexInput) { searchRow.each(function (indexInput) {
@ -1320,10 +1320,10 @@ TABS.pid_tuning.initialize = function (callback) {
// Only show rows supported by the firmware // Only show rows supported by the firmware
FC.PID_NAMES.forEach(function(elementPid) { FC.PID_NAMES.forEach(function(elementPid) {
// Show rows for the PID // Show rows for the PID
$(`.pid_tuning .${ elementPid}`).show(); $(`.pid_tuning .${elementPid}`).show();
// Show titles and other elements needed by the PID // Show titles and other elements needed by the PID
$(`.needed_by_${ elementPid}`).show(); $(`.needed_by_${elementPid}`).show();
}); });
// Special case // Special case
@ -1549,7 +1549,7 @@ TABS.pid_tuning.initialize = function (callback) {
function populateProfilesSelector(_selectProfileValues) { function populateProfilesSelector(_selectProfileValues) {
const profileSelect = $('select[name="profile"]'); const profileSelect = $('select[name="profile"]');
_selectProfileValues.forEach(function(value, key) { _selectProfileValues.forEach(function(value, key) {
profileSelect.append(`<option value="${ key }">${ value }</option>`); profileSelect.append(`<option value="${key}">${value}</option>`);
}); });
} }
@ -1558,7 +1558,7 @@ TABS.pid_tuning.initialize = function (callback) {
function populateRateProfilesSelector(_selectRateProfileValues) { function populateRateProfilesSelector(_selectRateProfileValues) {
const rateProfileSelect = $('select[name="rate_profile"]'); const rateProfileSelect = $('select[name="rate_profile"]');
_selectRateProfileValues.forEach(function(value, key) { _selectRateProfileValues.forEach(function(value, key) {
rateProfileSelect.append(`<option value="${ key }">${ value }</option>`); rateProfileSelect.append(`<option value="${key}">${value}</option>`);
}); });
} }
@ -1689,9 +1689,9 @@ TABS.pid_tuning.initialize = function (callback) {
} }
function populateFilterTypeSelector(name, selectDtermValues) { function populateFilterTypeSelector(name, selectDtermValues) {
const dtermFilterSelect = $(`select[name="${ name }"]`); const dtermFilterSelect = $(`select[name="${name}"]`);
selectDtermValues.forEach(function(value, key) { selectDtermValues.forEach(function(value, key) {
dtermFilterSelect.append(`<option value="${ key }">${ value }</option>`); dtermFilterSelect.append(`<option value="${key}">${value}</option>`);
}); });
} }
// Added in API 1.42.0 // Added in API 1.42.0
@ -1701,7 +1701,7 @@ TABS.pid_tuning.initialize = function (callback) {
function populateDynamicNotchRangeSelect(selectDynamicNotchRangeValues) { function populateDynamicNotchRangeSelect(selectDynamicNotchRangeValues) {
const dynamicNotchRangeSelect = $('select[name="dynamicNotchRange"]'); const dynamicNotchRangeSelect = $('select[name="dynamicNotchRange"]');
selectDynamicNotchRangeValues.forEach(function(value, key) { selectDynamicNotchRangeValues.forEach(function(value, key) {
dynamicNotchRangeSelect.append(`<option value="${ key }">${ value }</option>`); dynamicNotchRangeSelect.append(`<option value="${key}">${value}</option>`);
}); });
} }
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
@ -1723,15 +1723,15 @@ TABS.pid_tuning.initialize = function (callback) {
function activateSubtab(subtabName) { function activateSubtab(subtabName) {
const names = ['pid', 'rates', 'filter']; const names = ['pid', 'rates', 'filter'];
if (!names.includes(subtabName)) { if (!names.includes(subtabName)) {
console.debug(`Invalid subtab name: "${ subtabName }"`); console.debug(`Invalid subtab name: "${subtabName}"`);
return; return;
} }
for (name of names) { for (name of names) {
const el = $(`.tab-pid_tuning .subtab-${ name}`); const el = $(`.tab-pid_tuning .subtab-${name}`);
el[name == subtabName ? 'show' : 'hide'](); el[name == subtabName ? 'show' : 'hide']();
} }
$('.tab-pid_tuning .tab-container .tab').removeClass('active'); $('.tab-pid_tuning .tab-container .tab').removeClass('active');
$(`.tab-pid_tuning .tab-container .${ subtabName}`).addClass('active'); $(`.tab-pid_tuning .tab-container .${subtabName}`).addClass('active');
self.activeSubtab = subtabName; self.activeSubtab = subtabName;
if (subtabName == 'rates') { if (subtabName == 'rates') {
// force drawing of throttle curve once the throttle curve container element is available // force drawing of throttle curve once the throttle curve container element is available
@ -1771,7 +1771,7 @@ TABS.pid_tuning.initialize = function (callback) {
} }
for (let i = 0; i < pidControllerList.length; i++) { for (let i = 0; i < pidControllerList.length; i++) {
pidController_e.append(`<option value="${ i }">${ pidControllerList[i].name }</option>`); pidController_e.append(`<option value="${i}">${pidControllerList[i].name}</option>`);
} }
if (semver.gte(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_MIN_SUPPORTED_PID_CONTROLLER_CHANGE)) { if (semver.gte(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_MIN_SUPPORTED_PID_CONTROLLER_CHANGE)) {
@ -2003,11 +2003,11 @@ TABS.pid_tuning.initialize = function (callback) {
context.fill(); context.fill();
context.save(); context.save();
let fontSize = 10; let fontSize = 10;
context.font = `${fontSize }pt Verdana, Arial, sans-serif`; context.font = `${fontSize}pt Verdana, Arial, sans-serif`;
let realthr = thrPercent * 100.0, let realthr = thrPercent * 100.0,
expothr = 100 - (thrpos.y / canvasHeight) * 100.0, expothr = 100 - (thrpos.y / canvasHeight) * 100.0,
thrlabel = `${Math.round(thrPercent <= 0 ? 0 : realthr) }%` + thrlabel = `${Math.round(thrPercent <= 0 ? 0 : realthr)}%` +
` = ${ Math.round(thrPercent <= 0 ? 0 : expothr) }%`, ` = ${Math.round(thrPercent <= 0 ? 0 : expothr)}%`,
textWidth = context.measureText(thrlabel); textWidth = context.measureText(thrlabel);
context.fillStyle = '#000'; context.fillStyle = '#000';
context.scale(textWidth / throttleCurve.clientWidth, 1); context.scale(textWidth / throttleCurve.clientWidth, 1);
@ -2855,9 +2855,9 @@ TABS.pid_tuning.updateRatesLabels = function() {
stickContext.save(); stickContext.save();
const maxAngularVelRoll = `${self.maxAngularVelRollElement.text() } deg/s`; const maxAngularVelRoll = `${self.maxAngularVelRollElement.text()} deg/s`;
const maxAngularVelPitch = `${self.maxAngularVelPitchElement.text() } deg/s`; const maxAngularVelPitch = `${self.maxAngularVelPitchElement.text()} deg/s`;
const maxAngularVelYaw = `${self.maxAngularVelYawElement.text() } deg/s`; const maxAngularVelYaw = `${self.maxAngularVelYawElement.text()} deg/s`;
let currentValues = []; let currentValues = [];
let balloonsDirty = []; let balloonsDirty = [];
const curveHeight = rcStickElement.height; const curveHeight = rcStickElement.height;
@ -2874,13 +2874,13 @@ TABS.pid_tuning.updateRatesLabels = function() {
if (windowScale <= 1) { if (windowScale <= 1) {
stickContext.font = "24pt Verdana, Arial, sans-serif"; stickContext.font = "24pt Verdana, Arial, sans-serif";
} else { } else {
stickContext.font = `${24 * windowScale }pt Verdana, Arial, sans-serif`; stickContext.font = `${24 * windowScale}pt Verdana, Arial, sans-serif`;
} }
if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) { if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) {
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[0], self.currentRates.roll_rate, self.currentRates.rc_rate, self.currentRates.rc_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.roll_rate_limit, maxAngularVel, stickContext, '#FF8080') } deg/s`); currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[0], self.currentRates.roll_rate, self.currentRates.rc_rate, self.currentRates.rc_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.roll_rate_limit, maxAngularVel, stickContext, '#FF8080')} deg/s`);
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[1], self.currentRates.pitch_rate, self.currentRates.rc_rate_pitch, self.currentRates.rc_pitch_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.pitch_rate_limit, maxAngularVel, stickContext, '#80FF80') } deg/s`); currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[1], self.currentRates.pitch_rate, self.currentRates.rc_rate_pitch, self.currentRates.rc_pitch_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.pitch_rate_limit, maxAngularVel, stickContext, '#80FF80')} deg/s`);
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[2], self.currentRates.yaw_rate, self.currentRates.rc_rate_yaw, self.currentRates.rc_yaw_expo, self.currentRates.superexpo, self.currentRates.yawDeadband, self.currentRates.yaw_rate_limit, maxAngularVel, stickContext, '#8080FF') } deg/s`); currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[2], self.currentRates.yaw_rate, self.currentRates.rc_rate_yaw, self.currentRates.rc_yaw_expo, self.currentRates.superexpo, self.currentRates.yawDeadband, self.currentRates.yaw_rate_limit, maxAngularVel, stickContext, '#8080FF')} deg/s`);
} else { } else {
currentValues = []; currentValues = [];
} }
@ -2891,7 +2891,7 @@ TABS.pid_tuning.updateRatesLabels = function() {
stickContext.scale(textScale, 1); stickContext.scale(textScale, 1);
// add the maximum range label // add the maximum range label
drawAxisLabel(stickContext, `${maxAngularVel.toFixed(0) } deg/s`, ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right'); drawAxisLabel(stickContext, `${maxAngularVel.toFixed(0)} deg/s`, ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right');
// and then the balloon labels. // and then the balloon labels.
balloonsDirty = []; // reset the dirty balloon draw area (for overlap detection) balloonsDirty = []; // reset the dirty balloon draw area (for overlap detection)
@ -2995,7 +2995,7 @@ TABS.pid_tuning.updatePIDColors = function(clear = false) {
}; };
FC.PID_NAMES.forEach(function(elementPid, indexPid) { FC.PID_NAMES.forEach(function(elementPid, indexPid) {
$(`.pid_tuning .${ elementPid } input`).each(function(indexInput) { $(`.pid_tuning .${elementPid} input`).each(function(indexInput) {
setTuningElementColor($(this), FC.PIDS_ACTIVE[indexPid][indexInput], FC.PIDS[indexPid][indexInput]); setTuningElementColor($(this), FC.PIDS_ACTIVE[indexPid][indexInput], FC.PIDS[indexPid][indexInput]);
}); });
}); });

View file

@ -88,7 +88,7 @@ TABS.power.initialize = function (callback) {
const elementVoltageMeter = templateVoltageMeter.clone(); const elementVoltageMeter = templateVoltageMeter.clone();
$(elementVoltageMeter).attr('id', `voltage-meter-${index}`); $(elementVoltageMeter).attr('id', `voltage-meter-${index}`);
const message = i18n.getMessage(`powerVoltageId${ FC.VOLTAGE_METERS[index].id}`); const message = i18n.getMessage(`powerVoltageId${FC.VOLTAGE_METERS[index].id}`);
$(elementVoltageMeter).find('.label').text(message); $(elementVoltageMeter).find('.label').text(message);
destinationVoltageMeter.append(elementVoltageMeter); destinationVoltageMeter.append(elementVoltageMeter);
@ -106,7 +106,7 @@ TABS.power.initialize = function (callback) {
const attributeNames = ["vbatscale", "vbatresdivval", "vbatresdivmultiplier"]; const attributeNames = ["vbatscale", "vbatresdivval", "vbatresdivmultiplier"];
for (let attributeName of attributeNames) { for (let attributeName of attributeNames) {
$(elementVoltageConfiguration).find(`input[name="${attributeName}"]`).attr('name', `${attributeName }-${ index}`); $(elementVoltageConfiguration).find(`input[name="${attributeName}"]`).attr('name', `${attributeName}-${index}`);
} }
destinationVoltageConfiguration.append(elementVoltageConfiguration); destinationVoltageConfiguration.append(elementVoltageConfiguration);
@ -146,7 +146,7 @@ TABS.power.initialize = function (callback) {
const elementAmperageMeter = templateAmperageMeter.clone(); const elementAmperageMeter = templateAmperageMeter.clone();
$(elementAmperageMeter).attr('id', `amperage-meter-${index}`); $(elementAmperageMeter).attr('id', `amperage-meter-${index}`);
const message = i18n.getMessage(`powerAmperageId${ FC.CURRENT_METERS[index].id}`); const message = i18n.getMessage(`powerAmperageId${FC.CURRENT_METERS[index].id}`);
$(elementAmperageMeter).find('.label').text(message); $(elementAmperageMeter).find('.label').text(message);
destinationAmperageMeter.append(elementAmperageMeter); destinationAmperageMeter.append(elementAmperageMeter);

View file

@ -122,16 +122,16 @@ TABS.receiver.initialize = function (callback) {
if (i < bar_names.length) { if (i < bar_names.length) {
name = bar_names[i]; name = bar_names[i];
} else { } else {
name = i18n.getMessage(`controlAxisAux${ auxIndex++}`); name = i18n.getMessage(`controlAxisAux${auxIndex++}`);
} }
barContainer.append(`\ barContainer.append(`\
<ul>\ <ul>\
<li class="name">${ name }</li>\ <li class="name">${name}</li>\
<li class="meter">\ <li class="meter">\
<div class="meter-bar">\ <div class="meter-bar">\
<div class="label"></div>\ <div class="label"></div>\
<div class="fill${ FC.RC.active_channels == 0 ? 'disabled' : '' }">\ <div class="fill${FC.RC.active_channels == 0 ? 'disabled' : ''}">\
<div class="label"></div>\ <div class="label"></div>\
</div>\ </div>\
</div>\ </div>\
@ -716,7 +716,7 @@ TABS.receiver.initialize = function (callback) {
// update bars with latest data // update bars with latest data
for (let i = 0; i < FC.RC.active_channels; i++) { for (let i = 0; i < FC.RC.active_channels; i++) {
meterFillArray[i].css('width', `${((FC.RC.channels[i] - meterScale.min) / (meterScale.max - meterScale.min) * 100).clamp(0, 100) }%`); meterFillArray[i].css('width', `${((FC.RC.channels[i] - meterScale.min) / (meterScale.max - meterScale.min) * 100).clamp(0, 100)}%`);
meterLabelArray[i].text(FC.RC.channels[i]); meterLabelArray[i].text(FC.RC.channels[i]);
} }

View file

@ -106,10 +106,10 @@ function updateControlPositions() {
stickElem = $(".control-stick", gimbalElem); stickElem = $(".control-stick", gimbalElem);
if (gimbal[0] == stickName) { if (gimbal[0] == stickName) {
stickElem.css('top', `${(1.0 - channelValueToStickPortion(stickValue)) * gimbalSize }px`); stickElem.css('top', `${(1.0 - channelValueToStickPortion(stickValue)) * gimbalSize}px`);
break; break;
} else if (gimbal[1] == stickName) { } else if (gimbal[1] == stickName) {
stickElem.css('left', `${channelValueToStickPortion(stickValue) * gimbalSize }px`); stickElem.css('left', `${channelValueToStickPortion(stickValue) * gimbalSize}px`);
break; break;
} }
} }
@ -131,21 +131,21 @@ function localizeAxisNames() {
for (const gimbalIndex in gimbals) { for (const gimbalIndex in gimbals) {
const gimbal = gimbalElems.get(gimbalIndex); const gimbal = gimbalElems.get(gimbalIndex);
$(".gimbal-label-vert", gimbal).text(i18n.getMessage(`controlAxis${ gimbals[gimbalIndex][0]}`)); $(".gimbal-label-vert", gimbal).text(i18n.getMessage(`controlAxis${gimbals[gimbalIndex][0]}`));
$(".gimbal-label-horz", gimbal).text(i18n.getMessage(`controlAxis${ gimbals[gimbalIndex][1]}`)); $(".gimbal-label-horz", gimbal).text(i18n.getMessage(`controlAxis${gimbals[gimbalIndex][1]}`));
} }
for (let sliderIndex = 0; sliderIndex < 4; sliderIndex++) { for (let sliderIndex = 0; sliderIndex < 4; sliderIndex++) {
$(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage(`controlAxisAux${ sliderIndex + 1}`)); $(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage(`controlAxisAux${sliderIndex + 1}`));
} }
} }
function applyDarkTheme() { function applyDarkTheme() {
css_dark.forEach((el) => $(`link[href="${ el }"]`).prop('disabled', false)); css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', false));
} }
function applyNormalTheme() { function applyNormalTheme() {
css_dark.forEach((el) => $(`link[href="${ el }"]`).prop('disabled', true)); css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', true));
} }
$(document).ready(function() { $(document).ready(function() {

View file

@ -255,15 +255,15 @@ TABS.setup.initialize = function (callback) {
// All the known elements but the ARM_SWITCH (it must be always the last element) // All the known elements but the ARM_SWITCH (it must be always the last element)
if (i < disarmFlagElements.length - 1) { if (i < disarmFlagElements.length - 1) {
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${ i }" class="cf_tip disarm-flag" title="${ i18n.getMessage(`initialSetupArmingDisableFlagsTooltip${ disarmFlagElements[i]}`) }" style="display: none;">${ disarmFlagElements[i] }</span>`); arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="cf_tip disarm-flag" title="${i18n.getMessage(`initialSetupArmingDisableFlagsTooltip${disarmFlagElements[i]}`)}" style="display: none;">${disarmFlagElements[i]}</span>`);
// The ARM_SWITCH, always the last element // The ARM_SWITCH, always the last element
} else if (i == FC.CONFIG.armingDisableCount - 1) { } else if (i == FC.CONFIG.armingDisableCount - 1) {
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${ i }" class="cf_tip disarm-flag" title="${ i18n.getMessage('initialSetupArmingDisableFlagsTooltipARM_SWITCH') }" style="display: none;">ARM_SWITCH</span>`); arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="cf_tip disarm-flag" title="${i18n.getMessage('initialSetupArmingDisableFlagsTooltipARM_SWITCH')}" style="display: none;">ARM_SWITCH</span>`);
// Unknown disarm flags // Unknown disarm flags
} else { } else {
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${ i }" class="disarm-flag" style="display: none;">${ i + 1 }</span>`); arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="disarm-flag" style="display: none;">${i + 1}</span>`);
} }
} }
}; };
@ -293,8 +293,8 @@ TABS.setup.initialize = function (callback) {
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () { MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
gpsFix_e.html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse')); gpsFix_e.html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
gpsSats_e.text(FC.GPS_DATA.numSat); gpsSats_e.text(FC.GPS_DATA.numSat);
gpsLat_e.text(`${(FC.GPS_DATA.lat / 10000000).toFixed(4) } deg`); gpsLat_e.text(`${(FC.GPS_DATA.lat / 10000000).toFixed(4)} deg`);
gpsLon_e.text(`${(FC.GPS_DATA.lon / 10000000).toFixed(4) } deg`); gpsLon_e.text(`${(FC.GPS_DATA.lon / 10000000).toFixed(4)} deg`);
}); });
} }
} }

View file

@ -140,7 +140,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
} }
function pad(n, width) { function pad(n, width) {
n = `${n }`; n = `${n}`;
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n; return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
} }
@ -192,12 +192,12 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
let template = $('#transponder-configuration-template').clone(); let template = $('#transponder-configuration-template').clone();
template.find('.spacer_box_title').html(i18n.getMessage(`transponderData${ transponderProvider.id}`)); template.find('.spacer_box_title').html(i18n.getMessage(`transponderData${transponderProvider.id}`));
template.find('.dataHelp').html(i18n.getMessage(`transponderDataHelp${ transponderProvider.id}`)); template.find('.dataHelp').html(i18n.getMessage(`transponderDataHelp${transponderProvider.id}`));
if ( i18n.getMessage(`transponderHelp${ transponderProvider.id}`).length ) { if ( i18n.getMessage(`transponderHelp${transponderProvider.id}`).length ) {
$('#transponderHelp').html(i18n.getMessage(`transponderHelp${ transponderProvider.id}`)); $('#transponderHelp').html(i18n.getMessage(`transponderHelp${transponderProvider.id}`));
$('#transponderHelpBox').show(); $('#transponderHelpBox').show();
} }
@ -222,7 +222,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
dataInput.append($('<option>').val(dataOptions).html(dataOptionsKey)); dataInput.append($('<option>').val(dataOptions).html(dataOptionsKey));
} }
if ( dataInput.find(`option[value='${ data }']`).length > 0 && !clearValue ) { if ( dataInput.find(`option[value='${data}']`).length > 0 && !clearValue ) {
dataInput.val(data); dataInput.val(data);
} else { } else {
dataInput.val(_persistentInputValues[transponderProvider.id] || ''); dataInput.val(_persistentInputValues[transponderProvider.id] || '');
@ -239,7 +239,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
let changedInputValue = function() { let changedInputValue = function() {
let dataString = $(this).val(); let dataString = $(this).val();
let hexRegExp = new RegExp(`[0-9a-fA-F]{${ transponderProvider.dataLength * 2 }}`, 'gi'); let hexRegExp = new RegExp(`[0-9a-fA-F]{${transponderProvider.dataLength * 2}}`, 'gi');
if ( !dataString.match(hexRegExp) ) { if ( !dataString.match(hexRegExp) ) {
FC.TRANSPONDER.data = []; FC.TRANSPONDER.data = [];

View file

@ -43,7 +43,7 @@ CSSUtil.prototype.getColorForPercentage = function(percentage, colorTable = null
b: Math.floor(lower.color.b * percentageLower + upper.color.b * percentageUpper), b: Math.floor(lower.color.b * percentageLower + upper.color.b * percentageUpper),
a: lower.color.a * percentageLower + upper.color.a * percentageUpper, a: lower.color.a * percentageLower + upper.color.a * percentageUpper,
}; };
return `rgba(${ [color.r, color.g, color.b, color.a].join(",") })`; return `rgba(${[color.r, color.g, color.b, color.a].join(",")})`;
}; };
const cssUtil = new CSSUtil(); const cssUtil = new CSSUtil();

View file

@ -133,7 +133,7 @@ class CliEngine
getCliCommand(command, cliBuffer) { getCliCommand(command, cliBuffer) {
const buffer = this.removePromptHash(cliBuffer); const buffer = this.removePromptHash(cliBuffer);
const bufferRegex = new RegExp(`^${ buffer}`, 'g'); const bufferRegex = new RegExp(`^${buffer}`, 'g');
if (command.match(bufferRegex)) { if (command.match(bufferRegex)) {
return command.replace(bufferRegex, ''); return command.replace(bufferRegex, '');
@ -153,7 +153,7 @@ class CliEngine
this.writeToOutput(`<span class="error_message">${text}</span><br>`); this.writeToOutput(`<span class="error_message">${text}</span><br>`);
this._cliErrorsCount++; this._cliErrorsCount++;
} else { } else {
this.writeToOutput(`${text }<br>`); this.writeToOutput(`${text}<br>`);
} }
this._responseCallback?.(); this._responseCallback?.();
this._onRowCameCallback?.(text); this._onRowCameCallback?.(text);
@ -219,7 +219,7 @@ class CliEngine
} }
sendLine(line, callback, responseCallback) { sendLine(line, callback, responseCallback) {
this.send(`${line }\n`, callback, responseCallback); this.send(`${line}\n`, callback, responseCallback);
} }
send(line, callback, responseCallback) { send(line, callback, responseCallback) {

View file

@ -12,7 +12,7 @@ class PresetsRepoIndexed {
} }
loadIndex() { loadIndex() {
return fetch(`${this._urlRaw }index.json`, {cache: "no-cache"}) return fetch(`${this._urlRaw}index.json`, {cache: "no-cache"})
.then(res => res.json()) .then(res => res.json())
.then(out => { .then(out => {
this._index = out; this._index = out;

View file

@ -104,7 +104,7 @@ class PresetsSourcesDialog {
_scrollDown() { _scrollDown() {
this._domDivSourcesPanel.stop(); this._domDivSourcesPanel.stop();
this._domDivSourcesPanel.animate({scrollTop: `${this._domDivSourcesPanel.prop('scrollHeight') }px`}); this._domDivSourcesPanel.animate({scrollTop: `${this._domDivSourcesPanel.prop('scrollHeight')}px`});
} }
_addNewSourcePanel(presetSource, isActive = false, isSelected = true) { _addNewSourcePanel(presetSource, isActive = false, isSelected = true) {