fix: add URL hash handling for tab navigation
This commit is contained in:
+3
-7
@@ -228,9 +228,6 @@ function switchTab(tabName) {
|
|||||||
} else if (tabType === 'providers' && tabName === 'providers') {
|
} else if (tabType === 'providers' && tabName === 'providers') {
|
||||||
// Static providers tab
|
// Static providers tab
|
||||||
btn.classList.add('active');
|
btn.classList.add('active');
|
||||||
} else if (tabType === 'watchlist' && tabName === 'watchlist') {
|
|
||||||
// Static watchlist tab
|
|
||||||
btn.classList.add('active');
|
|
||||||
} else if (tabType === 'anime' && btn.getAttribute('data-provider') === tabName.replace('anime-', '')) {
|
} else if (tabType === 'anime' && btn.getAttribute('data-provider') === tabName.replace('anime-', '')) {
|
||||||
btn.classList.add('active');
|
btn.classList.add('active');
|
||||||
} else if (tabType === 'series' && btn.getAttribute('data-provider') === tabName.replace('series-', '')) {
|
} else if (tabType === 'series' && btn.getAttribute('data-provider') === tabName.replace('series-', '')) {
|
||||||
@@ -245,6 +242,8 @@ function switchTab(tabName) {
|
|||||||
loadHomeContent();
|
loadHomeContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle URL hash on page load
|
// Handle URL hash on page load
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
@@ -253,10 +252,9 @@ function switchTab(tabName) {
|
|||||||
switchTab(hash);
|
switchTab(hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for hash changes
|
// Listen for hash changes
|
||||||
window.addEventListener('hashchange', () => {
|
window.addEventListener('hashchange', function() {
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
const hash = window.location.hash.substring(1);
|
const hash = window.location.hash.substring(1);
|
||||||
if (hash === 'watchlist' || hash === 'anime' || hash === 'series' || hash === 'providers') {
|
if (hash === 'watchlist' || hash === 'anime' || hash === 'series' || hash === 'providers') {
|
||||||
@@ -264,5 +262,3 @@ window.addEventListener('hashchange', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user