feat: integrate watchlist as tab on /web page

This commit is contained in:
root
2026-02-26 16:06:21 +00:00
parent 36ec4a0eee
commit e22bc4191c
8 changed files with 494 additions and 358 deletions
+33 -2
View File
@@ -147,6 +147,7 @@ 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');
@@ -360,10 +361,22 @@ 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;
// Override switchTab to load content when opening new tabs
const originalSwitchTab = window.switchTab;
if (originalSwitchTab) {
window.switchTab = function(tabName) {
// Clear watchlist interval when switching away from watchlist
if (tabName !== 'watchlist' && watchlistRefreshInterval) {
clearInterval(watchlistRefreshInterval);
watchlistRefreshInterval = null;
}
// Call original switchTab first
originalSwitchTab(tabName);
@@ -386,8 +399,26 @@ document.addEventListener('DOMContentLoaded', () => {
window.providersTabLoaded = true;
}
} else if (tabName === 'watchlist') {
// Watchlist is handled by its own page
window.location.href = '/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
if (typeof displayWatchlist === 'function') {
watchlistRefreshInterval = setInterval(() => {
displayWatchlist();
}, 30000);
}
}
}, 100);
};