Add option to reopen last tab on connect
parent
863708ad94
commit
1488f1c6c0
|
@ -60,6 +60,9 @@
|
||||||
"permanentExpertMode": {
|
"permanentExpertMode": {
|
||||||
"message": "Permanently enable Expert Mode"
|
"message": "Permanently enable Expert Mode"
|
||||||
},
|
},
|
||||||
|
"rememberLastTab": {
|
||||||
|
"message": "Reopen last tab on connect"
|
||||||
|
},
|
||||||
"userLanguageSelect": {
|
"userLanguageSelect": {
|
||||||
"message": "Language (need to restart the application for the changes to take effect)"
|
"message": "Language (need to restart the application for the changes to take effect)"
|
||||||
},
|
},
|
||||||
|
|
|
@ -321,5 +321,21 @@ GUI_control.prototype.content_ready = function (callback) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUI_control.prototype.selectDefaultTabWhenConnected = function() {
|
||||||
|
chrome.storage.local.get(['rememberLastTab', 'lastTab'], function (result) {
|
||||||
|
let fallbackTab = '#tabs ul.mode-connected .tab_setup a';
|
||||||
|
if (!(result.rememberLastTab && !!result.lastTab)) {
|
||||||
|
$(fallbackTab).click();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let $savedTab = $("#tabs ul.mode-connected ." + result.lastTab + " a");
|
||||||
|
if (!!$savedTab.data("ignore-reopen")) {
|
||||||
|
$(fallbackTab).click();
|
||||||
|
} else {
|
||||||
|
$savedTab.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// initialize object into GUI variable
|
// initialize object into GUI variable
|
||||||
var GUI = new GUI_control();
|
var GUI = new GUI_control();
|
||||||
|
|
|
@ -91,7 +91,14 @@ function startProcess() {
|
||||||
GUI.tab_switch_cleanup(function () {
|
GUI.tab_switch_cleanup(function () {
|
||||||
// disable previously active tab highlight
|
// disable previously active tab highlight
|
||||||
$('li', ui_tabs).removeClass('active');
|
$('li', ui_tabs).removeClass('active');
|
||||||
|
|
||||||
|
// store last active tab only when connected
|
||||||
|
if (GUI.connected_to) {
|
||||||
|
chrome.storage.local.set({
|
||||||
|
lastTab: $(self).parent().attr("class")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Highlight selected tab
|
// Highlight selected tab
|
||||||
$(self).parent().addClass('active');
|
$(self).parent().addClass('active');
|
||||||
|
|
||||||
|
@ -217,6 +224,13 @@ function startProcess() {
|
||||||
}).change();
|
}).change();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
chrome.storage.local.get('rememberLastTab', function (result) {
|
||||||
|
$('div.rememberLastTab input')
|
||||||
|
.prop('checked', !!result.rememberLastTab)
|
||||||
|
.change(function() { chrome.storage.local.set({rememberLastTab: $(this).is(':checked')}) })
|
||||||
|
.change();
|
||||||
|
});
|
||||||
|
|
||||||
if (GUI.operating_system !== 'ChromeOS') {
|
if (GUI.operating_system !== 'ChromeOS') {
|
||||||
chrome.storage.local.get('checkForConfiguratorUnstableVersions', function (result) {
|
chrome.storage.local.get('checkForConfiguratorUnstableVersions', function (result) {
|
||||||
if (result.checkForConfiguratorUnstableVersions) {
|
if (result.checkForConfiguratorUnstableVersions) {
|
||||||
|
|
|
@ -299,7 +299,7 @@ function finishOpen() {
|
||||||
|
|
||||||
onConnect();
|
onConnect();
|
||||||
|
|
||||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
GUI.selectDefaultTabWhenConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectCli() {
|
function connectCli() {
|
||||||
|
|
|
@ -268,7 +268,9 @@
|
||||||
-->
|
-->
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="mode-connected mode-connected-cli">
|
<ul class="mode-connected mode-connected-cli">
|
||||||
<li class="tab_cli"><a href="#" i18n="tabCLI" class="tabicon ic_cli" i18n_title="tabCLI"></a></li>
|
<li class="tab_cli">
|
||||||
|
<a href="#" i18n="tabCLI" class="tabicon ic_cli" i18n_title="tabCLI" data-ignore-reopen="true"></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
<div class="checkForConfiguratorUnstableVersions">
|
<div class="checkForConfiguratorUnstableVersions">
|
||||||
<label><input type="checkbox" /><span i18n="checkForConfiguratorUnstableVersions"></span></label>
|
<label><input type="checkbox" /><span i18n="checkForConfiguratorUnstableVersions"></span></label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="rememberLastTab">
|
||||||
|
<label><input type="checkbox" /><span i18n="rememberLastTab"></span></label>
|
||||||
|
</div>
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
<div class="userLanguage">
|
<div class="userLanguage">
|
||||||
<label>
|
<label>
|
||||||
|
|
Loading…
Reference in New Issue