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
|
||||
$('.nav-tabs a.nav-link').click(event => {
|
||||
const uriHash = (window.location.hash).split("&");
|
||||
if (!uriHash) return;
|
||||
const currentTab = uriHash[0];
|
||||
const originalTargetId = event.currentTarget.href.split('#')[1];
|
||||
if (history.replaceState) {
|
||||
event.preventDefault();
|
||||
history.replaceState(undefined, undefined, currentTab + '&' + originalTargetId);
|
||||
openPage();
|
||||
} else window.location.hash = currentTab + '&' + originalTargetId;
|
||||
document.querySelectorAll(".nav-tabs a.nav-link").forEach(item => {
|
||||
item.addEventListener("click", event => {
|
||||
let uriHash;
|
||||
if (window.location.hash) {
|
||||
uriHash = (window.location.hash).split("&");
|
||||
} else {
|
||||
window.location.hash = document.querySelector(".sidebar a.nav-link").href.split("#")[1]
|
||||
uriHash = [window.location.hash];
|
||||
}
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user