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

Allows the user to always open the last tab that was used *before* the

CLI tab.

This simply avoids storing 'tab_cli' as the last tab in the first place.
This commit is contained in:
Hydra 2020-12-02 20:08:40 +01:00 committed by Dominic Clifton
parent a8b43e1e7c
commit c0f66a5aca
2 changed files with 12 additions and 8 deletions

View file

@ -373,13 +373,11 @@ GuiControl.prototype.content_ready = function (callback) {
GuiControl.prototype.selectDefaultTabWhenConnected = function() { GuiControl.prototype.selectDefaultTabWhenConnected = function() {
ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) { ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) {
if (!(result.rememberLastTab if (result.rememberLastTab && result.lastTab) {
&& !!result.lastTab $(`#tabs ul.mode-connected .${result.lastTab} a`).click();
&& result.lastTab.substring(4) !== "cli")) { } else {
$('#tabs ul.mode-connected .tab_setup a').click(); $('#tabs ul.mode-connected .tab_setup a').click();
return;
} }
$(`#tabs ul.mode-connected .${result.lastTab} a`).click();
}); });
}; };

View file

@ -219,9 +219,15 @@ function startProcess() {
// Tabs // Tabs
$("#tabs ul.mode-connected li").click(function() { $("#tabs ul.mode-connected li").click(function() {
// store the first class of the current tab (omit things like ".active") // store the first class of the current tab (omit things like ".active")
ConfigStorage.set( const tabName = $(this).attr("class").split(' ')[0];
{lastTab: $(this).attr("class").split(' ')[0]}
); const tabNameWithoutPrefix = tabName.substring(4);
if (tabNameWithoutPrefix !== "cli") {
// Don't store 'cli' otherwise you can never connect to another tab.
ConfigStorage.set(
{lastTab: tabName},
);
}
}); });
if (GUI.isCordova()) { if (GUI.isCordova()) {