mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-07 11:20:11 +01:00
Fixed URL hash handling with graph tabs (#1803)
Affects issues: - Fixed 1736
This commit is contained in:
parent
3ca98bb634
commit
428331de5b
@ -61,16 +61,23 @@ $('#accordionSidebar .nav-item a').click(event => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Persistent Bootstrap tabs
|
// Persistent Bootstrap tabs
|
||||||
$('.nav-tabs a.nav-link').click(event => {
|
document.querySelectorAll(".nav-tabs a.nav-link").forEach(item => {
|
||||||
const uriHash = (window.location.hash).split("&");
|
item.addEventListener("click", event => {
|
||||||
if (!uriHash) return;
|
let uriHash;
|
||||||
const currentTab = uriHash[0];
|
if (window.location.hash) {
|
||||||
const originalTargetId = event.currentTarget.href.split('#')[1];
|
uriHash = (window.location.hash).split("&");
|
||||||
if (history.replaceState) {
|
} else {
|
||||||
event.preventDefault();
|
window.location.hash = document.querySelector(".sidebar a.nav-link").href.split("#")[1]
|
||||||
history.replaceState(undefined, undefined, currentTab + '&' + originalTargetId);
|
uriHash = [window.location.hash];
|
||||||
openPage();
|
}
|
||||||
} else window.location.hash = currentTab + '&' + originalTargetId;
|
const targetTab = event.currentTarget.href.split('#')[1];
|
||||||
|
if (history.replaceState) {
|
||||||
|
event.preventDefault();
|
||||||
|
history.replaceState(undefined, undefined, uriHash[0] + '&' + targetTab);
|
||||||
|
openPage();
|
||||||
|
} else
|
||||||
|
window.location.hash = uriHash[0] + '&' + targetTab;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let oldWidth = null;
|
let oldWidth = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user