Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion static/js/tabpane-persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function tdPersistKey(key, value) {
}
}

function getActiveTabFromURL() {
const urlParams = new URLSearchParams(window.location.search);
const activeTab = urlParams.get('tab');
return activeTab ? activeTab.toLowerCase() : null;
}

// Retrieve, increment, and store tab-select event count, then returns it.
function tdGetTabSelectEventCountAndInc() {
// @requires: tdSupportsLocalStorage();
Expand Down Expand Up @@ -112,5 +118,11 @@ window.addEventListener('DOMContentLoaded', () => {

var allTabsInThisPage = document.querySelectorAll(_tdPersistCssSelector());
tdRegisterTabClickHandler(allTabsInThisPage);
tdGetAndActivatePersistedTabs(allTabsInThisPage);

const activeTabKeyFromURL = getActiveTabFromURL();
if (activeTabKeyFromURL) {
tdActivateTabsWithKey(activeTabKeyFromURL);
} else {
tdGetAndActivatePersistedTabs(allTabsInThisPage);
}
});