Skip to content

Commit c0f66a5

Browse files
committed
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.
1 parent a8b43e1 commit c0f66a5

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/js/gui.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,11 @@ GuiControl.prototype.content_ready = function (callback) {
373373

374374
GuiControl.prototype.selectDefaultTabWhenConnected = function() {
375375
ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) {
376-
if (!(result.rememberLastTab
377-
&& !!result.lastTab
378-
&& result.lastTab.substring(4) !== "cli")) {
376+
if (result.rememberLastTab && result.lastTab) {
377+
$(`#tabs ul.mode-connected .${result.lastTab} a`).click();
378+
} else {
379379
$('#tabs ul.mode-connected .tab_setup a').click();
380-
return;
381380
}
382-
$(`#tabs ul.mode-connected .${result.lastTab} a`).click();
383381
});
384382
};
385383

src/js/main.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,15 @@ function startProcess() {
219219
// Tabs
220220
$("#tabs ul.mode-connected li").click(function() {
221221
// store the first class of the current tab (omit things like ".active")
222-
ConfigStorage.set(
223-
{lastTab: $(this).attr("class").split(' ')[0]}
224-
);
222+
const tabName = $(this).attr("class").split(' ')[0];
223+
224+
const tabNameWithoutPrefix = tabName.substring(4);
225+
if (tabNameWithoutPrefix !== "cli") {
226+
// Don't store 'cli' otherwise you can never connect to another tab.
227+
ConfigStorage.set(
228+
{lastTab: tabName},
229+
);
230+
}
225231
});
226232

227233
if (GUI.isCordova()) {

0 commit comments

Comments
 (0)