From e3135c99cbe04aff8d312442d39e863623de7104 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 09:10:26 +0000 Subject: [PATCH] fix: add URL hash handling for tab navigation --- static/js/main.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 7585139..c3b6799 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -228,9 +228,6 @@ function switchTab(tabName) { } else if (tabType === 'providers' && tabName === 'providers') { // Static providers tab 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-', '')) { btn.classList.add('active'); } else if (tabType === 'series' && btn.getAttribute('data-provider') === tabName.replace('series-', '')) { @@ -245,24 +242,23 @@ function switchTab(tabName) { loadHomeContent(); } } +} - // Handle URL hash on page load - if (window.location.hash) { - const hash = window.location.hash.substring(1); - if (hash === 'watchlist' || hash === 'anime' || hash === 'series' || hash === 'providers') { - switchTab(hash); - } + +// Handle URL hash on page load +if (window.location.hash) { + const hash = window.location.hash.substring(1); + if (hash === 'watchlist' || hash === 'anime' || hash === 'series' || hash === 'providers') { + switchTab(hash); } } // Listen for hash changes -window.addEventListener('hashchange', () => { +window.addEventListener('hashchange', function() { if (window.location.hash) { const hash = window.location.hash.substring(1); if (hash === 'watchlist' || hash === 'anime' || hash === 'series' || hash === 'providers') { switchTab(hash); } } -}); -} -} +}); \ No newline at end of file