fix: properly load watchlist in tab instead of redirecting
This commit is contained in:
+38
-14
@@ -147,7 +147,6 @@ async function loadSeriesRecommendations() {
|
||||
} else {
|
||||
container.innerHTML = '<div class="no-results">Aucune recommandation trouvée</div>';
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading series recommendations:', error);
|
||||
const container = document.getElementById('seriesRecommendationsList');
|
||||
@@ -361,11 +360,9 @@ window.showDownloadInfo = showDownloadInfo;
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Wait for main.js to be loaded
|
||||
setTimeout(() => {
|
||||
// Watchlist auto-refresh interval
|
||||
let watchlistRefreshInterval = null;
|
||||
|
||||
// Initialize watchlist tab flag
|
||||
window.watchlistTabLoaded = false;
|
||||
let watchlistRefreshInterval = null;
|
||||
|
||||
// Override switchTab to load content when opening new tabs
|
||||
const originalSwitchTab = window.switchTab;
|
||||
@@ -399,28 +396,55 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
window.providersTabLoaded = true;
|
||||
}
|
||||
} else if (tabName === 'watchlist') {
|
||||
// Clear any existing interval before starting new one
|
||||
if (watchlistRefreshInterval) {
|
||||
clearInterval(watchlistRefreshInterval);
|
||||
watchlistRefreshInterval = null;
|
||||
}
|
||||
|
||||
if (!window.watchlistTabLoaded) {
|
||||
// Load watchlist content
|
||||
if (typeof displayWatchlist === 'function') {
|
||||
displayWatchlist();
|
||||
}
|
||||
window.watchlistTabLoaded = true;
|
||||
|
||||
// Start 30-second auto-refresh interval for watchlist (only once)
|
||||
// Start 30-second auto-refresh interval
|
||||
if (typeof displayWatchlist === 'function') {
|
||||
watchlistRefreshInterval = setInterval(() => {
|
||||
displayWatchlist();
|
||||
}, 30000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Wait for main.js to be loaded
|
||||
setTimeout(() => {
|
||||
// Override switchTab to load content when opening new tabs
|
||||
const originalSwitchTab = window.switchTab;
|
||||
if (originalSwitchTab) {
|
||||
window.switchTab = function(tabName) {
|
||||
// Call original switchTab first
|
||||
originalSwitchTab(tabName);
|
||||
|
||||
// Load content for new tabs (after a small delay for DOM to update)
|
||||
setTimeout(() => {
|
||||
if (tabName === 'anime') {
|
||||
if (!window.animeTabLoaded) {
|
||||
loadAnimeReleases();
|
||||
window.animeTabLoaded = true;
|
||||
}
|
||||
} else if (tabName === 'series') {
|
||||
if (!window.seriesTabLoaded) {
|
||||
loadSeriesRecommendations();
|
||||
loadSeriesReleases();
|
||||
window.seriesTabLoaded = true;
|
||||
}
|
||||
} else if (tabName === 'providers') {
|
||||
if (!window.providersTabLoaded) {
|
||||
loadProvidersGrid();
|
||||
window.providersTabLoaded = true;
|
||||
}
|
||||
} else if (tabName === 'watchlist') {
|
||||
// Watchlist is handled by its own page
|
||||
window.location.href = '/watchlist';
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user