mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 05:15:21 +03:00
parent
704970e291
commit
483dec9103
34 changed files with 559 additions and 546 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -31,3 +31,4 @@ nbproject/
|
||||||
# Eclipse
|
# Eclipse
|
||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
|
test-results-junit/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
import GUI from './gui.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates the Clipboard logic, depending on web or nw
|
* Encapsulates the Clipboard logic, depending on web or nw
|
||||||
|
@ -99,3 +99,5 @@ if (GUI.isNWJS()){
|
||||||
} else {
|
} else {
|
||||||
Clipboard._configureClipboardAsOther();
|
Clipboard._configureClipboardAsOther();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Clipboard;
|
||||||
|
|
225
src/js/gui.js
225
src/js/gui.js
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
window.TABS = {}; // filled by individual tab js file
|
window.TABS = {}; // filled by individual tab js file
|
||||||
|
|
||||||
const GUI_MODES = {
|
const GUI_MODES = {
|
||||||
|
@ -9,7 +6,8 @@ const GUI_MODES = {
|
||||||
Other: "Other",
|
Other: "Other",
|
||||||
};
|
};
|
||||||
|
|
||||||
const GuiControl = function () {
|
class GuiControl {
|
||||||
|
constructor() {
|
||||||
this.auto_connect = false;
|
this.auto_connect = false;
|
||||||
this.connecting_to = false;
|
this.connecting_to = false;
|
||||||
this.connected_to = false;
|
this.connected_to = false;
|
||||||
|
@ -71,20 +69,14 @@ const GuiControl = function () {
|
||||||
this.Mode = GUI_MODES.Other;
|
this.Mode = GUI_MODES.Other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
// Timer managing methods
|
||||||
function GUI_checkOperatingSystem() {
|
// name = string
|
||||||
return navigator?.userAgentData?.platform || 'Android';
|
// code = function reference (code to be executed)
|
||||||
}
|
// interval = time interval in miliseconds
|
||||||
|
// first = true/false if code should be ran initially before next timer interval hits
|
||||||
// Timer managing methods
|
interval_add(name, code, interval, first) {
|
||||||
|
const data = { 'name': name, 'timer': null, 'code': code, 'interval': interval, 'fired': 0, 'paused': false };
|
||||||
// name = string
|
|
||||||
// code = function reference (code to be executed)
|
|
||||||
// interval = time interval in miliseconds
|
|
||||||
// first = true/false if code should be ran initially before next timer interval hits
|
|
||||||
GuiControl.prototype.interval_add = function (name, code, interval, first) {
|
|
||||||
const data = {'name': name, 'timer': null, 'code': code, 'interval': interval, 'fired': 0, 'paused': false};
|
|
||||||
|
|
||||||
if (first === true) {
|
if (first === true) {
|
||||||
code(); // execute code
|
code(); // execute code
|
||||||
|
@ -92,7 +84,7 @@ GuiControl.prototype.interval_add = function (name, code, interval, first) {
|
||||||
data.fired++; // increment counter
|
data.fired++; // increment counter
|
||||||
}
|
}
|
||||||
|
|
||||||
data.timer = setInterval(function() {
|
data.timer = setInterval(function () {
|
||||||
code(); // execute code
|
code(); // execute code
|
||||||
|
|
||||||
data.fired++; // increment counter
|
data.fired++; // increment counter
|
||||||
|
@ -101,14 +93,13 @@ GuiControl.prototype.interval_add = function (name, code, interval, first) {
|
||||||
this.interval_array.push(data); // push to primary interval array
|
this.interval_array.push(data); // push to primary interval array
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
// code = function reference (code to be executed)
|
||||||
// code = function reference (code to be executed)
|
// interval = time interval in miliseconds
|
||||||
// interval = time interval in miliseconds
|
// first = true/false if code should be ran initially before next timer interval hits
|
||||||
// first = true/false if code should be ran initially before next timer interval hits
|
// condition = function reference with true/false result, a condition to be checked before every interval code execution
|
||||||
// condition = function reference with true/false result, a condition to be checked before every interval code execution
|
interval_add_condition(name, code, interval, first, condition) {
|
||||||
GuiControl.prototype.interval_add_condition = function (name, code, interval, first, condition) {
|
|
||||||
this.interval_add(name, () => {
|
this.interval_add(name, () => {
|
||||||
if (condition()) {
|
if (condition()) {
|
||||||
code();
|
code();
|
||||||
|
@ -116,10 +107,9 @@ GuiControl.prototype.interval_add_condition = function (name, code, interval, fi
|
||||||
this.interval_remove(name);
|
this.interval_remove(name);
|
||||||
}
|
}
|
||||||
}, interval, first);
|
}, interval, first);
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
interval_remove(name) {
|
||||||
GuiControl.prototype.interval_remove = function (name) {
|
|
||||||
for (let i = 0; i < this.interval_array.length; i++) {
|
for (let i = 0; i < this.interval_array.length; i++) {
|
||||||
if (this.interval_array[i].name === name) {
|
if (this.interval_array[i].name === name) {
|
||||||
clearInterval(this.interval_array[i].timer); // stop timer
|
clearInterval(this.interval_array[i].timer); // stop timer
|
||||||
|
@ -131,10 +121,9 @@ GuiControl.prototype.interval_remove = function (name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
interval_pause(name) {
|
||||||
GuiControl.prototype.interval_pause = function (name) {
|
|
||||||
for (let i = 0; i < this.interval_array.length; i++) {
|
for (let i = 0; i < this.interval_array.length; i++) {
|
||||||
if (this.interval_array[i].name === name) {
|
if (this.interval_array[i].name === name) {
|
||||||
clearInterval(this.interval_array[i].timer);
|
clearInterval(this.interval_array[i].timer);
|
||||||
|
@ -145,10 +134,9 @@ GuiControl.prototype.interval_pause = function (name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
interval_resume(name) {
|
||||||
GuiControl.prototype.interval_resume = function (name) {
|
|
||||||
|
|
||||||
function executeCode(obj) {
|
function executeCode(obj) {
|
||||||
obj.code(); // execute code
|
obj.code(); // execute code
|
||||||
|
@ -168,11 +156,10 @@ GuiControl.prototype.interval_resume = function (name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
// input = array of timers thats meant to be kept, or nothing
|
||||||
// input = array of timers thats meant to be kept, or nothing
|
// return = returns timers killed in last call
|
||||||
// return = returns timers killed in last call
|
interval_kill_all(keepArray) {
|
||||||
GuiControl.prototype.interval_kill_all = function (keepArray) {
|
|
||||||
const self = this;
|
const self = this;
|
||||||
let timersKilled = 0;
|
let timersKilled = 0;
|
||||||
|
|
||||||
|
@ -196,22 +183,23 @@ GuiControl.prototype.interval_kill_all = function (keepArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return timersKilled;
|
return timersKilled;
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
// code = function reference (code to be executed)
|
||||||
// code = function reference (code to be executed)
|
// timeout = timeout in miliseconds
|
||||||
// timeout = timeout in miliseconds
|
timeout_add(name, code, timeout) {
|
||||||
GuiControl.prototype.timeout_add = function (name, code, timeout) {
|
|
||||||
const self = this;
|
const self = this;
|
||||||
const data = {'name': name,
|
const data = {
|
||||||
|
'name': name,
|
||||||
'timer': null,
|
'timer': null,
|
||||||
'timeout': timeout,
|
'timeout': timeout,
|
||||||
};
|
};
|
||||||
|
|
||||||
// start timer with "cleaning" callback
|
// start timer with "cleaning" callback
|
||||||
data.timer = setTimeout(function() {
|
data.timer = setTimeout(function () {
|
||||||
code(); // execute code
|
code(); // execute code
|
||||||
|
|
||||||
|
|
||||||
// remove object from array
|
// remove object from array
|
||||||
const index = self.timeout_array.indexOf(data);
|
const index = self.timeout_array.indexOf(data);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
@ -222,10 +210,9 @@ GuiControl.prototype.timeout_add = function (name, code, timeout) {
|
||||||
this.timeout_array.push(data); // push to primary timeout array
|
this.timeout_array.push(data); // push to primary timeout array
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
}
|
||||||
|
// name = string
|
||||||
// name = string
|
timeout_remove(name) {
|
||||||
GuiControl.prototype.timeout_remove = function (name) {
|
|
||||||
for (let i = 0; i < this.timeout_array.length; i++) {
|
for (let i = 0; i < this.timeout_array.length; i++) {
|
||||||
if (this.timeout_array[i].name === name) {
|
if (this.timeout_array[i].name === name) {
|
||||||
clearTimeout(this.timeout_array[i].timer); // stop timer
|
clearTimeout(this.timeout_array[i].timer); // stop timer
|
||||||
|
@ -237,11 +224,10 @@ GuiControl.prototype.timeout_remove = function (name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
// no input parameters
|
||||||
// no input parameters
|
// return = returns timers killed in last call
|
||||||
// return = returns timers killed in last call
|
timeout_kill_all() {
|
||||||
GuiControl.prototype.timeout_kill_all = function () {
|
|
||||||
let timersKilled = 0;
|
let timersKilled = 0;
|
||||||
|
|
||||||
for (let i = 0; i < this.timeout_array.length; i++) {
|
for (let i = 0; i < this.timeout_array.length; i++) {
|
||||||
|
@ -253,10 +239,9 @@ GuiControl.prototype.timeout_kill_all = function () {
|
||||||
this.timeout_array = []; // drop objects
|
this.timeout_array = []; // drop objects
|
||||||
|
|
||||||
return timersKilled;
|
return timersKilled;
|
||||||
};
|
}
|
||||||
|
// message = string
|
||||||
// message = string
|
log(message) {
|
||||||
GuiControl.prototype.log = function (message) {
|
|
||||||
const commandLog = $('div#log');
|
const commandLog = $('div#log');
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
const year = d.getFullYear();
|
const year = d.getFullYear();
|
||||||
|
@ -270,12 +255,11 @@ GuiControl.prototype.log = function (message) {
|
||||||
const formattedDate = `${year}-${month}-${date} @${time}`;
|
const formattedDate = `${year}-${month}-${date} @${time}`;
|
||||||
$('div.wrapper', commandLog).append(`<p>${formattedDate} -- ${message}</p>`);
|
$('div.wrapper', commandLog).append(`<p>${formattedDate} -- ${message}</p>`);
|
||||||
commandLog.scrollTop($('div.wrapper', commandLog).height());
|
commandLog.scrollTop($('div.wrapper', commandLog).height());
|
||||||
};
|
}
|
||||||
|
// Method is called every time a valid tab change event is received
|
||||||
// Method is called every time a valid tab change event is received
|
// callback = code to run when cleanup is finished
|
||||||
// callback = code to run when cleanup is finished
|
// default switch doesn't require callback to be set
|
||||||
// default switch doesn't require callback to be set
|
tab_switch_cleanup(callback) {
|
||||||
GuiControl.prototype.tab_switch_cleanup = function (callback) {
|
|
||||||
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
|
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
|
||||||
this.interval_kill_all(); // all intervals (mostly data pulling) needs to be removed on tab switch
|
this.interval_kill_all(); // all intervals (mostly data pulling) needs to be removed on tab switch
|
||||||
|
|
||||||
|
@ -284,14 +268,13 @@ GuiControl.prototype.tab_switch_cleanup = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
switchery() {
|
||||||
GuiControl.prototype.switchery = function() {
|
|
||||||
|
|
||||||
const COLOR_ACCENT = 'var(--accent)';
|
const COLOR_ACCENT = 'var(--accent)';
|
||||||
const COLOR_SWITCHERY_SECOND = 'var(--switcherysecond)';
|
const COLOR_SWITCHERY_SECOND = 'var(--switcherysecond)';
|
||||||
|
|
||||||
$('.togglesmall').each(function(index, elem) {
|
$('.togglesmall').each(function (index, elem) {
|
||||||
const switchery = new Switchery(elem, {
|
const switchery = new Switchery(elem, {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
color: COLOR_ACCENT,
|
color: COLOR_ACCENT,
|
||||||
|
@ -303,7 +286,7 @@ GuiControl.prototype.switchery = function() {
|
||||||
$(elem).removeClass('togglesmall');
|
$(elem).removeClass('togglesmall');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggle').each(function(index, elem) {
|
$('.toggle').each(function (index, elem) {
|
||||||
const switchery = new Switchery(elem, {
|
const switchery = new Switchery(elem, {
|
||||||
color: COLOR_ACCENT,
|
color: COLOR_ACCENT,
|
||||||
secondaryColor: COLOR_SWITCHERY_SECOND,
|
secondaryColor: COLOR_SWITCHERY_SECOND,
|
||||||
|
@ -314,7 +297,7 @@ GuiControl.prototype.switchery = function() {
|
||||||
$(elem).removeClass('toggle');
|
$(elem).removeClass('toggle');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.togglemedium').each(function(index, elem) {
|
$('.togglemedium').each(function (index, elem) {
|
||||||
const switchery = new Switchery(elem, {
|
const switchery = new Switchery(elem, {
|
||||||
className: 'switcherymid',
|
className: 'switcherymid',
|
||||||
color: COLOR_ACCENT,
|
color: COLOR_ACCENT,
|
||||||
|
@ -325,9 +308,8 @@ GuiControl.prototype.switchery = function() {
|
||||||
});
|
});
|
||||||
$(elem).removeClass('togglemedium');
|
$(elem).removeClass('togglemedium');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
content_ready(callback) {
|
||||||
GuiControl.prototype.content_ready = function (callback) {
|
|
||||||
|
|
||||||
this.switchery();
|
this.switchery();
|
||||||
|
|
||||||
|
@ -335,11 +317,11 @@ GuiControl.prototype.content_ready = function (callback) {
|
||||||
// Build link to in-use CF version documentation
|
// Build link to in-use CF version documentation
|
||||||
const documentationButton = $('div#content #button-documentation');
|
const documentationButton = $('div#content #button-documentation');
|
||||||
documentationButton.html("Wiki");
|
documentationButton.html("Wiki");
|
||||||
documentationButton.attr("href","https://github.com/betaflight/betaflight/wiki");
|
documentationButton.attr("href", "https://github.com/betaflight/betaflight/wiki");
|
||||||
}
|
}
|
||||||
|
|
||||||
// loading tooltip
|
// loading tooltip
|
||||||
jQuery(function() {
|
jQuery(function () {
|
||||||
|
|
||||||
new jBox('Tooltip', {
|
new jBox('Tooltip', {
|
||||||
attach: '.cf_tip',
|
attach: '.cf_tip',
|
||||||
|
@ -374,28 +356,23 @@ GuiControl.prototype.content_ready = function (callback) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
selectDefaultTabWhenConnected() {
|
||||||
GuiControl.prototype.selectDefaultTabWhenConnected = function() {
|
|
||||||
const result = ConfigStorage.get(['rememberLastTab', 'lastTab']);
|
const result = ConfigStorage.get(['rememberLastTab', 'lastTab']);
|
||||||
const tab = result.rememberLastTab && result.lastTab ? result.lastTab : 'tab_setup';
|
const tab = result.rememberLastTab && result.lastTab ? result.lastTab : 'tab_setup';
|
||||||
|
|
||||||
$(`#tabs ul.mode-connected .${tab} a`).trigger('click');
|
$(`#tabs ul.mode-connected .${tab} a`).trigger('click');
|
||||||
};
|
}
|
||||||
|
isNWJS() {
|
||||||
GuiControl.prototype.isNWJS = function () {
|
|
||||||
return this.Mode === GUI_MODES.NWJS;
|
return this.Mode === GUI_MODES.NWJS;
|
||||||
};
|
}
|
||||||
|
isCordova() {
|
||||||
GuiControl.prototype.isCordova = function () {
|
|
||||||
return this.Mode === GUI_MODES.Cordova;
|
return this.Mode === GUI_MODES.Cordova;
|
||||||
};
|
}
|
||||||
GuiControl.prototype.isOther = function () {
|
isOther() {
|
||||||
return this.Mode === GUI_MODES.Other;
|
return this.Mode === GUI_MODES.Other;
|
||||||
};
|
}
|
||||||
|
showYesNoDialog(yesNoDialogSettings) {
|
||||||
|
|
||||||
GuiControl.prototype.showYesNoDialog = function(yesNoDialogSettings) {
|
|
||||||
// yesNoDialogSettings:
|
// yesNoDialogSettings:
|
||||||
// title, text, buttonYesText, buttonNoText, buttonYesCallback, buttonNoCallback
|
// title, text, buttonYesText, buttonNoText, buttonYesCallback, buttonNoCallback
|
||||||
const dialog = $(".dialogYesNo");
|
const dialog = $(".dialogYesNo");
|
||||||
|
@ -423,9 +400,8 @@ GuiControl.prototype.showYesNoDialog = function(yesNoDialogSettings) {
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog[0].showModal();
|
dialog[0].showModal();
|
||||||
};
|
}
|
||||||
|
showWaitDialog(waitDialogSettings) {
|
||||||
GuiControl.prototype.showWaitDialog = function(waitDialogSettings) {
|
|
||||||
// waitDialogSettings:
|
// waitDialogSettings:
|
||||||
// title, buttonCancelCallback
|
// title, buttonCancelCallback
|
||||||
const dialog = $(".dialogWait")[0];
|
const dialog = $(".dialogWait")[0];
|
||||||
|
@ -444,9 +420,8 @@ GuiControl.prototype.showWaitDialog = function(waitDialogSettings) {
|
||||||
|
|
||||||
dialog.showModal();
|
dialog.showModal();
|
||||||
return dialog;
|
return dialog;
|
||||||
};
|
}
|
||||||
|
showInformationDialog(informationDialogSettings) {
|
||||||
GuiControl.prototype.showInformationDialog = function(informationDialogSettings) {
|
|
||||||
// informationDialogSettings:
|
// informationDialogSettings:
|
||||||
// title, text, buttonConfirmText
|
// title, text, buttonConfirmText
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
@ -468,9 +443,8 @@ GuiControl.prototype.showInformationDialog = function(informationDialogSettings)
|
||||||
|
|
||||||
dialog[0].showModal();
|
dialog[0].showModal();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
saveToTextFileDialog(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] }];
|
||||||
|
|
||||||
|
@ -483,9 +457,8 @@ GuiControl.prototype.saveToTextFileDialog = function(textToSave, suggestedFileNa
|
||||||
entry => this._saveToTextFileDialogFileSelected(entry, textToSave, resolve, reject),
|
entry => this._saveToTextFileDialogFileSelected(entry, textToSave, resolve, reject),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
_saveToTextFileDialogFileSelected(entry, textToSave, resolve, reject) {
|
||||||
GuiControl.prototype._saveToTextFileDialogFileSelected = function(entry, textToSave, resolve, reject) {
|
|
||||||
checkChromeRuntimeError();
|
checkChromeRuntimeError();
|
||||||
|
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
|
@ -502,7 +475,7 @@ GuiControl.prototype._saveToTextFileDialogFileSelected = function(entry, textToS
|
||||||
|
|
||||||
writer.onwriteend = () => {
|
writer.onwriteend = () => {
|
||||||
if (textToSave.length > 0 && writer.length === 0) {
|
if (textToSave.length > 0 && writer.length === 0) {
|
||||||
writer.write(new Blob([textToSave], {type: 'text/plain'}));
|
writer.write(new Blob([textToSave], { type: 'text/plain' }));
|
||||||
} else {
|
} else {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
console.log('File write complete');
|
console.log('File write complete');
|
||||||
|
@ -515,13 +488,12 @@ GuiControl.prototype._saveToTextFileDialogFileSelected = function(entry, textToS
|
||||||
reject();
|
reject();
|
||||||
console.error('Failed to get file writer');
|
console.error('Failed to get file writer');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
readTextFileDialog(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) {
|
||||||
checkChromeRuntimeError();
|
checkChromeRuntimeError();
|
||||||
|
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
|
@ -541,22 +513,29 @@ GuiControl.prototype.readTextFileDialog = function(extension) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
escapeHtml(unsafe) {
|
||||||
GuiControl.prototype.escapeHtml = function(unsafe) {
|
|
||||||
return unsafe
|
return unsafe
|
||||||
.replace(/&/g, "&")
|
.replace(/&/g, "&")
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
.replace(/>/g, ">")
|
.replace(/>/g, ">")
|
||||||
.replace(/"/g, """)
|
.replace(/"/g, """)
|
||||||
.replace(/'/g, "'");
|
.replace(/'/g, "'");
|
||||||
};
|
}
|
||||||
|
addLinksTargetBlank(element) {
|
||||||
GuiControl.prototype.addLinksTargetBlank = function(element) {
|
element.find('a').each(function () {
|
||||||
element.find('a').each(function() {
|
|
||||||
$(this).attr('target', '_blank');
|
$(this).attr('target', '_blank');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GUI_checkOperatingSystem() {
|
||||||
|
return navigator?.userAgentData?.platform || 'Android';
|
||||||
|
}
|
||||||
|
|
||||||
|
const GUI = new GuiControl();
|
||||||
|
|
||||||
// initialize object into GUI variable
|
// initialize object into GUI variable
|
||||||
window.GUI = new GuiControl();
|
window.GUI = GUI;
|
||||||
|
|
||||||
|
export default GUI;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
import i18nextXHRBackend from 'i18next-xhr-backend';
|
import i18nextXHRBackend from 'i18next-xhr-backend';
|
||||||
|
import GUI from './gui.js';
|
||||||
|
|
||||||
const i18n = {};
|
const i18n = {};
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import '../components/init.js';
|
import '../components/init.js';
|
||||||
import { i18n } from './localization.js';
|
import { i18n } from './localization.js';
|
||||||
|
import GUI from './gui.js';
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const adjustments = {};
|
const adjustments = {};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const auxiliary = {};
|
const auxiliary = {};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import Clipboard from "../Clipboard";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const cli = {
|
const cli = {
|
||||||
lineDelayMs: 15,
|
lineDelayMs: 15,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const configuration = {
|
const configuration = {
|
||||||
// intended
|
// intended
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const failsafe = {};
|
const failsafe = {};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const firmware_flasher = {
|
const firmware_flasher = {
|
||||||
targets: null,
|
targets: null,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const gps = {};
|
const gps = {};
|
||||||
gps.initialize = function (callback) {
|
gps.initialize = function (callback) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const help = {};
|
const help = {};
|
||||||
help.initialize = function (callback) {
|
help.initialize = function (callback) {
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const landing = {};
|
const landing = {};
|
||||||
landing.initialize = function (callback) {
|
landing.initialize = function (callback) {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const led_strip = {
|
const led_strip = {
|
||||||
wireMode: false,
|
wireMode: false,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { millitime } from '../utils/common.js';
|
import { millitime } from '../utils/common.js';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const logging = {};
|
const logging = {};
|
||||||
logging.initialize = function (callback) {
|
logging.initialize = function (callback) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const motors = {
|
const motors = {
|
||||||
previousDshotBidir: null,
|
previousDshotBidir: null,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
let sdcardTimer;
|
let sdcardTimer;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const options = {};
|
const options = {};
|
||||||
options.initialize = function (callback) {
|
options.initialize = function (callback) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const FONT = {};
|
const FONT = {};
|
||||||
const SYM = {};
|
const SYM = {};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
import { colorTables, getColorForPercentage } from '../utils/css.js';
|
import { colorTables, getColorForPercentage } from '../utils/css.js';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const pid_tuning = {
|
const pid_tuning = {
|
||||||
RATE_PROFILE_MASK: 128,
|
RATE_PROFILE_MASK: 128,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const ports = {
|
const ports = {
|
||||||
// intentional
|
// intentional
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const power = {
|
const power = {
|
||||||
supported: false,
|
supported: false,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const MD5 = require('md5.js');
|
const MD5 = require('md5.js');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const sensors = {};
|
const sensors = {};
|
||||||
sensors.initialize = function (callback) {
|
sensors.initialize = function (callback) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const servos = {};
|
const servos = {};
|
||||||
servos.initialize = function (callback) {
|
servos.initialize = function (callback) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const setup = {
|
const setup = {
|
||||||
yaw_fix: 0.0,
|
yaw_fix: 0.0,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const setup_osd = {
|
const setup_osd = {
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from '../localization';
|
import { i18n } from '../localization';
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const staticTab = {};
|
const staticTab = {};
|
||||||
staticTab.initialize = function (staticTabName, callback) {
|
staticTab.initialize = function (staticTabName, callback) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const transponder = {
|
const transponder = {
|
||||||
available: false,
|
available: false,
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { i18n } from "../localization";
|
import { i18n } from "../localization";
|
||||||
|
import Clipboard from "../Clipboard";
|
||||||
|
import GUI from '../gui';
|
||||||
|
|
||||||
const vtx = {
|
const vtx = {
|
||||||
supported: false,
|
supported: false,
|
||||||
|
|
|
@ -90,7 +90,6 @@
|
||||||
<script type="text/javascript" src="./js/port_handler.js"></script>
|
<script type="text/javascript" src="./js/port_handler.js"></script>
|
||||||
<script type="text/javascript" src="./js/port_usage.js"></script>
|
<script type="text/javascript" src="./js/port_usage.js"></script>
|
||||||
<script type="text/javascript" src="./js/serial.js"></script>
|
<script type="text/javascript" src="./js/serial.js"></script>
|
||||||
<script type="text/javascript" src="./js/gui.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/mdns_discovery.js"></script>
|
<script type="text/javascript" src="./js/mdns_discovery.js"></script>
|
||||||
<script type="text/javascript" src="./js/huffman.js"></script>
|
<script type="text/javascript" src="./js/huffman.js"></script>
|
||||||
<script type="text/javascript" src="./js/default_huffman_tree.js"></script>
|
<script type="text/javascript" src="./js/default_huffman_tree.js"></script>
|
||||||
|
@ -113,7 +112,6 @@
|
||||||
<script type="text/javascript" src="./js/ConfigInserter.js"></script>
|
<script type="text/javascript" src="./js/ConfigInserter.js"></script>
|
||||||
<script type="text/javascript" src="./js/GitHubApi.js"></script>
|
<script type="text/javascript" src="./js/GitHubApi.js"></script>
|
||||||
<script type="module" src="./js/main.js"></script>
|
<script type="module" src="./js/main.js"></script>
|
||||||
<script type="text/javascript" src="./js/Clipboard.js"></script>
|
|
||||||
<!-- TODO: might be removed when everythign is in modules -->
|
<!-- TODO: might be removed when everythign is in modules -->
|
||||||
<script type="text/javascript" src="./tabs/presets/CliEngine.js"></script>
|
<script type="text/javascript" src="./tabs/presets/CliEngine.js"></script>
|
||||||
<script type="text/javascript" src="./tabs/presets/PickedPreset.js"></script>
|
<script type="text/javascript" src="./tabs/presets/PickedPreset.js"></script>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
import GUI from '../../js/gui';
|
||||||
|
|
||||||
import { favoritePresets } from './FavoritePresets';
|
import { favoritePresets } from './FavoritePresets';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = function(config) {
|
||||||
'./src/js/serial.js',
|
'./src/js/serial.js',
|
||||||
'./src/js/data_storage.js',
|
'./src/js/data_storage.js',
|
||||||
{ pattern: './src/js/localization.js', type: 'module', watched: false },
|
{ pattern: './src/js/localization.js', type: 'module', watched: false },
|
||||||
'./src/js/gui.js',
|
{ pattern: './src/js/gui.js', type: 'module', watched: false },
|
||||||
'./src/js/CliAutoComplete.js',
|
'./src/js/CliAutoComplete.js',
|
||||||
{ pattern: './src/js/tabs/cli.js', type: 'module', watched: false },
|
{ pattern: './src/js/tabs/cli.js', type: 'module', watched: false },
|
||||||
'./src/js/phones_ui.js',
|
'./src/js/phones_ui.js',
|
||||||
|
@ -41,6 +41,7 @@ module.exports = function(config) {
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'./src/js/localization.js': ['rollup'],
|
'./src/js/localization.js': ['rollup'],
|
||||||
'./src/js/tabs/cli.js': ['rollup'],
|
'./src/js/tabs/cli.js': ['rollup'],
|
||||||
|
'./src/js/gui.js': ['rollup'],
|
||||||
},
|
},
|
||||||
rollupPreprocessor: {
|
rollupPreprocessor: {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue