mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
feat: use modules in options tab
This commit is contained in:
parent
9ece824971
commit
91b583b7c8
3 changed files with 18 additions and 13 deletions
|
@ -316,7 +316,9 @@ function startProcess() {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'options':
|
case 'options':
|
||||||
TABS.options.initialize(content_ready);
|
import("./tabs/options").then(({ options }) =>
|
||||||
|
options.initialize(content_ready)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'firmware_flasher':
|
case 'firmware_flasher':
|
||||||
TABS.firmware_flasher.initialize(content_ready);
|
TABS.firmware_flasher.initialize(content_ready);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
import { i18n } from '../localization';
|
||||||
|
|
||||||
TABS.options = {};
|
const options = {};
|
||||||
TABS.options.initialize = function (callback) {
|
options.initialize = function (callback) {
|
||||||
if (GUI.active_tab !== 'options') {
|
if (GUI.active_tab !== 'options') {
|
||||||
GUI.active_tab = 'options';
|
GUI.active_tab = 'options';
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ TABS.options.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.cleanup = function (callback) {
|
options.cleanup = function (callback) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initPermanentExpertMode = function () {
|
options.initPermanentExpertMode = function () {
|
||||||
ConfigStorage.get('permanentExpertMode', function (result) {
|
ConfigStorage.get('permanentExpertMode', function (result) {
|
||||||
if (result.permanentExpertMode) {
|
if (result.permanentExpertMode) {
|
||||||
$('div.permanentExpertMode input').prop('checked', true);
|
$('div.permanentExpertMode input').prop('checked', true);
|
||||||
|
@ -43,7 +43,7 @@ TABS.options.initPermanentExpertMode = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initRememberLastTab = function () {
|
options.initRememberLastTab = function () {
|
||||||
ConfigStorage.get('rememberLastTab', function (result) {
|
ConfigStorage.get('rememberLastTab', function (result) {
|
||||||
$('div.rememberLastTab input')
|
$('div.rememberLastTab input')
|
||||||
.prop('checked', !!result.rememberLastTab)
|
.prop('checked', !!result.rememberLastTab)
|
||||||
|
@ -52,7 +52,7 @@ TABS.options.initRememberLastTab = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initCheckForConfiguratorUnstableVersions = function () {
|
options.initCheckForConfiguratorUnstableVersions = function () {
|
||||||
ConfigStorage.get('checkForConfiguratorUnstableVersions', function (result) {
|
ConfigStorage.get('checkForConfiguratorUnstableVersions', function (result) {
|
||||||
if (result.checkForConfiguratorUnstableVersions) {
|
if (result.checkForConfiguratorUnstableVersions) {
|
||||||
$('div.checkForConfiguratorUnstableVersions input').prop('checked', true);
|
$('div.checkForConfiguratorUnstableVersions input').prop('checked', true);
|
||||||
|
@ -68,7 +68,7 @@ TABS.options.initCheckForConfiguratorUnstableVersions = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initAnalyticsOptOut = function () {
|
options.initAnalyticsOptOut = function () {
|
||||||
ConfigStorage.get('analyticsOptOut', function (result) {
|
ConfigStorage.get('analyticsOptOut', function (result) {
|
||||||
if (result.analyticsOptOut) {
|
if (result.analyticsOptOut) {
|
||||||
$('div.analyticsOptOut input').prop('checked', true);
|
$('div.analyticsOptOut input').prop('checked', true);
|
||||||
|
@ -94,7 +94,7 @@ TABS.options.initAnalyticsOptOut = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initCliAutoComplete = function () {
|
options.initCliAutoComplete = function () {
|
||||||
$('div.cliAutoComplete input')
|
$('div.cliAutoComplete input')
|
||||||
.prop('checked', CliAutoComplete.configEnabled)
|
.prop('checked', CliAutoComplete.configEnabled)
|
||||||
.change(function () {
|
.change(function () {
|
||||||
|
@ -105,7 +105,7 @@ TABS.options.initCliAutoComplete = function () {
|
||||||
}).change();
|
}).change();
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initCordovaForceComputerUI = function () {
|
options.initCordovaForceComputerUI = function () {
|
||||||
if (GUI.isCordova() && cordovaUI.canChangeUI) {
|
if (GUI.isCordova() && cordovaUI.canChangeUI) {
|
||||||
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
||||||
if (result.cordovaForceComputerUI) {
|
if (result.cordovaForceComputerUI) {
|
||||||
|
@ -127,7 +127,7 @@ TABS.options.initCordovaForceComputerUI = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.options.initDarkTheme = function () {
|
options.initDarkTheme = function () {
|
||||||
$('#darkThemeSelect')
|
$('#darkThemeSelect')
|
||||||
.val(DarkTheme.configEnabled)
|
.val(DarkTheme.configEnabled)
|
||||||
.change(function () {
|
.change(function () {
|
||||||
|
@ -137,3 +137,7 @@ TABS.options.initDarkTheme = function () {
|
||||||
setDarkTheme(value);
|
setDarkTheme(value);
|
||||||
}).change();
|
}).change();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: remove when modules are in place
|
||||||
|
window.TABS.options = options;
|
||||||
|
export { options };
|
||||||
|
|
|
@ -130,7 +130,6 @@
|
||||||
<script type="text/javascript" src="./js/FirmwareCache.js"></script>
|
<script type="text/javascript" src="./js/FirmwareCache.js"></script>
|
||||||
<script type="text/javascript" src="./js/tabs/firmware_flasher.js"></script>
|
<script type="text/javascript" src="./js/tabs/firmware_flasher.js"></script>
|
||||||
<script type="text/javascript" src="./js/tabs/failsafe.js"></script>
|
<script type="text/javascript" src="./js/tabs/failsafe.js"></script>
|
||||||
<script type="text/javascript" src="./js/tabs/options.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/LogoManager.js"></script>
|
<script type="text/javascript" src="./js/LogoManager.js"></script>
|
||||||
<script type="text/javascript" src="./js/tabs/osd.js"></script>
|
<script type="text/javascript" src="./js/tabs/osd.js"></script>
|
||||||
<script type="text/javascript" src="./js/tabs/vtx.js"></script>
|
<script type="text/javascript" src="./js/tabs/vtx.js"></script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue