fix: properly load watchlist in tab instead of redirecting
This commit is contained in:
+37
-13
@@ -147,7 +147,6 @@ async function loadSeriesRecommendations() {
|
|||||||
} else {
|
} else {
|
||||||
container.innerHTML = '<div class="no-results">Aucune recommandation trouvée</div>';
|
container.innerHTML = '<div class="no-results">Aucune recommandation trouvée</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading series recommendations:', error);
|
console.error('Error loading series recommendations:', error);
|
||||||
const container = document.getElementById('seriesRecommendationsList');
|
const container = document.getElementById('seriesRecommendationsList');
|
||||||
@@ -361,11 +360,9 @@ window.showDownloadInfo = showDownloadInfo;
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Wait for main.js to be loaded
|
// Wait for main.js to be loaded
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Watchlist auto-refresh interval
|
|
||||||
let watchlistRefreshInterval = null;
|
|
||||||
|
|
||||||
// Initialize watchlist tab flag
|
// Initialize watchlist tab flag
|
||||||
window.watchlistTabLoaded = false;
|
window.watchlistTabLoaded = false;
|
||||||
|
let watchlistRefreshInterval = null;
|
||||||
|
|
||||||
// Override switchTab to load content when opening new tabs
|
// Override switchTab to load content when opening new tabs
|
||||||
const originalSwitchTab = window.switchTab;
|
const originalSwitchTab = window.switchTab;
|
||||||
@@ -399,20 +396,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
window.providersTabLoaded = true;
|
window.providersTabLoaded = true;
|
||||||
}
|
}
|
||||||
} else if (tabName === 'watchlist') {
|
} else if (tabName === 'watchlist') {
|
||||||
// Clear any existing interval before starting new one
|
|
||||||
if (watchlistRefreshInterval) {
|
|
||||||
clearInterval(watchlistRefreshInterval);
|
|
||||||
watchlistRefreshInterval = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.watchlistTabLoaded) {
|
if (!window.watchlistTabLoaded) {
|
||||||
// Load watchlist content
|
|
||||||
if (typeof displayWatchlist === 'function') {
|
if (typeof displayWatchlist === 'function') {
|
||||||
displayWatchlist();
|
displayWatchlist();
|
||||||
}
|
}
|
||||||
window.watchlistTabLoaded = true;
|
window.watchlistTabLoaded = true;
|
||||||
|
// Start 30-second auto-refresh interval
|
||||||
// Start 30-second auto-refresh interval for watchlist (only once)
|
|
||||||
if (typeof displayWatchlist === 'function') {
|
if (typeof displayWatchlist === 'function') {
|
||||||
watchlistRefreshInterval = setInterval(() => {
|
watchlistRefreshInterval = setInterval(() => {
|
||||||
displayWatchlist();
|
displayWatchlist();
|
||||||
@@ -420,7 +409,42 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, 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);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user