feat: Introduce and ignore .agents directory, and add it to UI sections that skip page refresh.

This commit is contained in:
Admin9705
2026-02-22 13:50:48 -05:00
parent bb172a31af
commit 963ddd936e
6 changed files with 1170 additions and 1176 deletions

View File

@@ -6,6 +6,7 @@
# IDE / Editor
.cursor
.kiro
.agents
.vscode
.idea
*.swp

1
.gitignore vendored
View File

@@ -48,6 +48,7 @@ chrome-user-data
.cursor
*.mdc
.kiro/
.agents/
*.swp
*.swo

View File

@@ -1774,7 +1774,7 @@ window.refreshStateManagementTimezone = function() {
Object.assign(huntarrUI, {
switchSection: function(section) {
switchSection: function (section) {
console.log(`[huntarrUI] *** SWITCH SECTION CALLED *** section: ${section}, current: ${this.currentSection}`);
// Redirect legacy Movie Hunt home to Media Collection (discovery is under Requestarr)
if (section === 'movie-hunt-home') section = 'movie-hunt-collection';
@@ -1826,7 +1826,7 @@ Object.assign(huntarrUI, {
return; // User chose to stay and save changes
}
}
// Check for unsaved Settings changes if leaving Settings section
if (this.currentSection === 'settings' && window.SettingsForms && typeof window.SettingsForms.checkUnsavedChanges === 'function') {
if (!window.SettingsForms.checkUnsavedChanges()) {
@@ -1834,7 +1834,7 @@ Object.assign(huntarrUI, {
return; // User chose to stay and save changes
}
}
// Check for unsaved Notifications changes if leaving Notifications section
if (this.currentSection === 'notifications' && window.SettingsForms && typeof window.SettingsForms.checkUnsavedChanges === 'function') {
if (!window.SettingsForms.checkUnsavedChanges()) {
@@ -1842,7 +1842,7 @@ Object.assign(huntarrUI, {
return; // User chose to stay and save changes
}
}
// Check for unsaved App instance changes if leaving Apps section
const appSections = ['apps'];
if (appSections.includes(this.currentSection) && window.SettingsForms && typeof window.SettingsForms.checkUnsavedChanges === 'function') {
@@ -1851,7 +1851,7 @@ Object.assign(huntarrUI, {
return; // User chose to stay and save changes
}
}
// Check for unsaved Prowlarr changes if leaving Prowlarr section
if (this.currentSection === 'prowlarr' && window.SettingsForms && typeof window.SettingsForms.checkUnsavedChanges === 'function') {
if (!window.SettingsForms.checkUnsavedChanges()) {
@@ -1859,10 +1859,10 @@ Object.assign(huntarrUI, {
return; // User chose to stay and save changes
}
}
// Check for unsaved Profile Editor changes if leaving Profile Editor
if (this.currentSection === 'profile-editor' && section !== 'profile-editor' && window.SettingsForms && typeof window.SettingsForms.isProfileEditorDirty === 'function' && window.SettingsForms.isProfileEditorDirty()) {
window.SettingsForms.confirmLeaveProfileEditor(function(result) {
window.SettingsForms.confirmLeaveProfileEditor(function (result) {
if (result === 'save') {
window.SettingsForms.saveProfileFromEditor(section);
} else if (result === 'discard') {
@@ -1874,7 +1874,7 @@ Object.assign(huntarrUI, {
// Check for unsaved Movie Management changes if leaving Movie Management
if (this.currentSection === 'settings-media-management' && section !== 'settings-media-management' && window.MovieManagement && typeof window.MovieManagement.isDirty === 'function' && window.MovieManagement.isDirty()) {
window.MovieManagement.confirmLeave(function(result) {
window.MovieManagement.confirmLeave(function (result) {
if (result === 'save') {
window.MovieManagement.save(section);
} else if (result === 'discard') {
@@ -1886,7 +1886,7 @@ Object.assign(huntarrUI, {
// Check for unsaved TV Management changes if leaving TV Management
if (this.currentSection === 'tv-hunt-settings-tv-management' && section !== 'tv-hunt-settings-tv-management' && window.TVManagement && typeof window.TVManagement.isDirty === 'function' && window.TVManagement.isDirty()) {
window.TVManagement.confirmLeave(function(result) {
window.TVManagement.confirmLeave(function (result) {
if (result === 'save') {
window.TVManagement.save(section);
} else if (result === 'discard') {
@@ -1902,7 +1902,7 @@ Object.assign(huntarrUI, {
if (result === 'save') {
// true means navigate back after save
window.SettingsForms._instanceEditorNextSection = section;
window.SettingsForms.saveInstanceFromEditor(true);
window.SettingsForms.saveInstanceFromEditor(true);
} else if (result === 'discard') {
window.SettingsForms.cancelInstanceEditor(section);
}
@@ -1915,11 +1915,11 @@ Object.assign(huntarrUI, {
window.NzbHunt._confirmLeaveServerEditor(section);
return;
}
// Don't refresh page when navigating to/from instance editor or between app sections
const noRefreshSections = ['home', 'instance-editor', 'profile-editor', 'movie-hunt-instance-editor', 'sonarr', 'radarr', 'lidarr', 'readarr', 'whisparr', 'eros', 'prowlarr', 'swaparr', 'movie-hunt-home', 'movie-hunt-collection', 'media-hunt-collection', 'media-hunt-calendar', 'activity-queue', 'activity-history', 'activity-blocklist', 'activity-logs', 'logs-media-hunt', 'movie-hunt-settings', 'media-hunt-settings', 'media-hunt-instances', 'settings-instance-management', 'settings-media-management', 'settings-profiles', 'settings-sizes', 'settings-indexers', 'settings-clients', 'settings-import-lists', 'settings-import-media', 'settings-custom-formats', 'settings-root-folders', 'tv-hunt-collection', 'media-hunt-collection', 'tv-hunt-settings', 'media-hunt-settings', 'tv-hunt-settings-profiles', 'tv-hunt-settings-sizes', 'tv-hunt-settings-custom-formats', 'tv-hunt-settings-indexers', 'tv-hunt-settings-clients', 'tv-hunt-settings-import-lists', 'tv-hunt-settings-root-folders', 'tv-hunt-settings-tv-management', 'tv-hunt-activity-queue', 'tv-hunt-activity-history', 'tv-hunt-activity-blocklist', 'tv-hunt-instance-editor', 'logs-tv-hunt', 'system', 'hunt-manager', 'logs', 'about', 'settings', 'scheduling', 'notifications', 'backup-restore', 'settings-logs', 'user', 'nzb-hunt-home', 'nzb-hunt-activity', 'nzb-hunt-folders', 'nzb-hunt-servers', 'nzb-hunt-advanced', 'nzb-hunt-settings', 'nzb-hunt-settings-folders', 'nzb-hunt-settings-servers', 'nzb-hunt-settings-processing', 'nzb-hunt-settings-advanced', 'nzb-hunt-server-editor', 'tor-hunt-home', 'tor-hunt-settings', 'requestarr', 'requestarr-discover', 'requestarr-movies', 'requestarr-tv', 'requestarr-hidden', 'requestarr-personal-blacklist', 'requestarr-filters', 'requestarr-settings', 'requestarr-smarthunt', 'requestarr-smarthunt-settings', 'requestarr-users', 'requestarr-bundles', 'requestarr-requests', 'requestarr-global-blacklist', 'indexer-hunt', 'indexer-hunt-stats', 'indexer-hunt-history'];
const skipRefresh = noRefreshSections.includes(section) || noRefreshSections.includes(this.currentSection);
if (!skipRefresh) {
console.log(`[huntarrUI] User switching from ${this.currentSection} to ${section}, refreshing page...`);
// Store the target section in localStorage so we can navigate to it after refresh
@@ -1930,7 +1930,7 @@ Object.assign(huntarrUI, {
console.log(`[huntarrUI] Switching from ${this.currentSection} to ${section} without page refresh (app/editor navigation)`);
}
}
// Stop stats polling when leaving home section
if (window.HuntarrStats) window.HuntarrStats.stopPolling();
@@ -1959,17 +1959,17 @@ Object.assign(huntarrUI, {
s.classList.remove('active');
s.style.display = 'none';
});
// Additionally, make sure scheduling section is completely hidden
if (section !== 'scheduling' && this.elements.schedulingSection) {
this.elements.schedulingSection.style.display = 'none';
}
// Update navigation
this.elements.navItems.forEach(item => {
item.classList.remove('active');
});
// Show selected section
let newTitle = 'Home'; // Default title
const sponsorsSection = document.getElementById('sponsorsSection'); // Get sponsors section element
@@ -1981,13 +1981,13 @@ Object.assign(huntarrUI, {
if (this.elements.homeNav) this.elements.homeNav.classList.add('active');
newTitle = 'Home';
this.currentSection = 'home';
// Show main sidebar when returning to home
this.showMainSidebar();
// Disconnect logs if switching away from logs
this.disconnectAllEventSources();
this.disconnectAllEventSources();
// Check app connections when returning to home page to update status
// This will call updateEmptyStateVisibility() after all checks complete
this.checkAppConnections();
@@ -2020,7 +2020,7 @@ Object.assign(huntarrUI, {
newTitle = 'Logs';
this.currentSection = section;
this.showMovieHuntSidebar();
_checkLogsMediaHuntInstances(function(state) {
_checkLogsMediaHuntInstances(function (state) {
var noInst = document.getElementById('logs-media-hunt-no-instances');
var noIdx = document.getElementById('logs-media-hunt-no-indexers');
var noCli = document.getElementById('logs-media-hunt-no-clients');
@@ -2053,20 +2053,20 @@ Object.assign(huntarrUI, {
var systemSection = document.getElementById('systemSection');
systemSection.classList.add('active');
systemSection.style.display = 'block';
// Determine which tab to show
var activeTab = section === 'system' ? 'hunt-manager' : section;
if (window.HuntarrNavigation) window.HuntarrNavigation.switchSystemTab(activeTab);
// Set title based on active tab
var tabTitles = { 'hunt-manager': 'Hunt Manager', 'logs': 'Logs' };
newTitle = tabTitles[activeTab] || 'System';
this.currentSection = section === 'system' ? 'hunt-manager' : section;
// Expand System group in unified sidebar
if (typeof expandSidebarGroup === 'function') expandSidebarGroup('sidebar-group-system');
if (typeof setActiveNavItem === 'function') setActiveNavItem();
// Initialize the active tab's module
if (activeTab === 'hunt-manager') {
if (typeof huntManagerModule !== 'undefined') huntManagerModule.refresh();
@@ -2132,7 +2132,7 @@ Object.assign(huntarrUI, {
if (typeof window.NzbHunt.initSettings === 'function') window.NzbHunt.initSettings();
if (typeof window.NzbHunt._populateServerEditorForm === 'function') window.NzbHunt._populateServerEditorForm();
}
// ── Tor Hunt sections ─────────────────────────────────────────
// ── Tor Hunt sections ─────────────────────────────────────────
} else if (section === 'tor-hunt-home' && document.getElementById('tor-hunt-section')) {
if (this._enableMediaHunt === false) { this.switchSection('home'); return; }
document.getElementById('tor-hunt-section').classList.add('active');
@@ -2159,7 +2159,7 @@ Object.assign(huntarrUI, {
if (window.TorHunt && typeof window.TorHunt.showView === 'function') {
window.TorHunt.showView('settings');
}
// ── Indexer Hunt sections ──────────────────────────────────────
// ── Indexer Hunt sections ──────────────────────────────────────
} else if (section === 'indexer-hunt' && document.getElementById('indexer-hunt-section')) {
document.getElementById('indexer-hunt-section').classList.add('active');
document.getElementById('indexer-hunt-section').style.display = 'block';
@@ -2204,7 +2204,7 @@ Object.assign(huntarrUI, {
newTitle = 'Logs';
this.currentSection = section;
this.showTVHuntSidebar();
_checkLogsMediaHuntInstances(function(state) {
_checkLogsMediaHuntInstances(function (state) {
var noInst = document.getElementById('logs-media-hunt-no-instances');
var noIdx = document.getElementById('logs-media-hunt-no-indexers');
var noCli = document.getElementById('logs-media-hunt-no-clients');
@@ -2240,7 +2240,7 @@ Object.assign(huntarrUI, {
}
document.getElementById('mediaHuntSection').classList.add('active');
document.getElementById('mediaHuntSection').style.display = 'block';
['mediaHuntInstanceManagementSection', 'mediaHuntInstanceEditorSection', 'tvHuntSettingsCustomFormatsSection', 'mediaHuntProfilesSection', 'tvHuntSettingsIndexersSection', 'tvHuntSettingsClientsSection', 'tvHuntSettingsRootFoldersSection', 'mediaHuntSettingsImportMediaSection', 'tvHuntSettingsTVManagementSection', 'tvManagementSection', 'tvHuntSettingsImportListsSection'].forEach(function(id) {
['mediaHuntInstanceManagementSection', 'mediaHuntInstanceEditorSection', 'tvHuntSettingsCustomFormatsSection', 'mediaHuntProfilesSection', 'tvHuntSettingsIndexersSection', 'tvHuntSettingsClientsSection', 'tvHuntSettingsRootFoldersSection', 'mediaHuntSettingsImportMediaSection', 'tvHuntSettingsTVManagementSection', 'tvManagementSection', 'tvHuntSettingsImportListsSection'].forEach(function (id) {
var el = document.getElementById(id);
if (el) { el.classList.remove('active'); el.style.display = 'none'; }
});
@@ -2265,7 +2265,7 @@ Object.assign(huntarrUI, {
// ── Setup Wizard gate — show wizard if setup is incomplete ──
var _hash = window.location.hash || '';
if (window.SetupWizard && typeof window.SetupWizard.check === 'function') {
window.SetupWizard.check(function(needsWizard) {
window.SetupWizard.check(function (needsWizard) {
if (needsWizard) {
window.SetupWizard.show();
} else {
@@ -2387,7 +2387,7 @@ Object.assign(huntarrUI, {
this.currentSection = 'tv-hunt-settings-clients';
this.showTVHuntSidebar();
if (window.TVHuntInstanceDropdown && window.TVHuntInstanceDropdown.attach) {
window.TVHuntInstanceDropdown.attach('tv-hunt-settings-clients-instance-select', function() {
window.TVHuntInstanceDropdown.attach('tv-hunt-settings-clients-instance-select', function () {
if (window.TVHuntSettingsForms && typeof window.TVHuntSettingsForms.refreshClientsList === 'function') {
window.TVHuntSettingsForms.refreshClientsList();
}
@@ -2485,7 +2485,7 @@ Object.assign(huntarrUI, {
if (hNav) hNav.setAttribute('href', './#tv-hunt-activity-history');
if (bNav) bNav.setAttribute('href', './#tv-hunt-activity-blocklist');
// Hide all TV Hunt settings/main sections
['mediaHuntSection', 'mediaHuntInstanceManagementSection', 'mediaHuntInstanceEditorSection', 'tvHuntSettingsCustomFormatsSection', 'mediaHuntProfilesSection', 'tvHuntSettingsIndexersSection', 'tvHuntSettingsClientsSection', 'tvHuntSettingsRootFoldersSection', 'mediaHuntSettingsImportMediaSection', 'tvHuntSettingsTVManagementSection', 'tvManagementSection', 'tvHuntSettingsImportListsSection'].forEach(function(id) {
['mediaHuntSection', 'mediaHuntInstanceManagementSection', 'mediaHuntInstanceEditorSection', 'tvHuntSettingsCustomFormatsSection', 'mediaHuntProfilesSection', 'tvHuntSettingsIndexersSection', 'tvHuntSettingsClientsSection', 'tvHuntSettingsRootFoldersSection', 'mediaHuntSettingsImportMediaSection', 'tvHuntSettingsTVManagementSection', 'tvManagementSection', 'tvHuntSettingsImportListsSection'].forEach(function (id) {
var el = document.getElementById(id);
if (el) { el.classList.remove('active'); el.style.display = 'none'; }
});
@@ -2561,7 +2561,7 @@ Object.assign(huntarrUI, {
if (document.getElementById('tvHuntSettingsClientsSection')) { document.getElementById('tvHuntSettingsClientsSection').classList.remove('active'); document.getElementById('tvHuntSettingsClientsSection').style.display = 'none'; }
if (document.getElementById('tvHuntSettingsRootFoldersSection')) { document.getElementById('tvHuntSettingsRootFoldersSection').classList.remove('active'); document.getElementById('tvHuntSettingsRootFoldersSection').style.display = 'none'; }
if (document.getElementById('tvHuntSettingsTVManagementSection')) { document.getElementById('tvHuntSettingsTVManagementSection').classList.remove('active'); document.getElementById('tvHuntSettingsTVManagementSection').style.display = 'none'; }
if (document.getElementById('tvManagementSection')) { document.getElementById('tvManagementSection').classList.remove('active'); document.getElementById('tvManagementSection').style.display = 'none'; }
if (document.getElementById('tvManagementSection')) { document.getElementById('tvManagementSection').classList.remove('active'); document.getElementById('tvManagementSection').style.display = 'none'; }
if (document.getElementById('tvHuntSettingsImportListsSection')) { document.getElementById('tvHuntSettingsImportListsSection').classList.remove('active'); document.getElementById('tvHuntSettingsImportListsSection').style.display = 'none'; }
if (document.getElementById('mediaHuntSection')) { document.getElementById('mediaHuntSection').classList.remove('active'); document.getElementById('mediaHuntSection').style.display = 'none'; }
if (document.getElementById('mediaHuntCalendarSection')) { document.getElementById('mediaHuntCalendarSection').classList.remove('active'); document.getElementById('mediaHuntCalendarSection').style.display = 'none'; }
@@ -2589,10 +2589,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrNav')) document.getElementById('requestarrNav').classList.add('active');
newTitle = 'Discover';
this.currentSection = 'requestarr';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show discover view by default
this.runWhenRequestarrReady('discover', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2605,10 +2605,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrDiscoverNav')) document.getElementById('requestarrDiscoverNav').classList.add('active');
newTitle = 'Discover';
this.currentSection = 'requestarr-discover';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show discover view
this.runWhenRequestarrReady('discover', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2618,17 +2618,17 @@ Object.assign(huntarrUI, {
} else if (section === 'requestarr-movies' && document.getElementById('requestarr-section')) {
document.getElementById('requestarr-section').classList.add('active');
document.getElementById('requestarr-section').style.display = 'block';
// Check if we came from Movie Search in Movie Hunt sidebar
var fromMovieSearch = false;
try { fromMovieSearch = sessionStorage.getItem('requestarr-from-movie-search'); sessionStorage.removeItem('requestarr-from-movie-search'); } catch (err) {}
try { fromMovieSearch = sessionStorage.getItem('requestarr-from-movie-search'); sessionStorage.removeItem('requestarr-from-movie-search'); } catch (err) { }
if (fromMovieSearch) {
// Keep Movie Hunt sidebar group active with Movie Search highlighted
this.showMovieHuntSidebar();
// Clear all Media Hunt nav items first
var movieHuntNavItems = document.querySelectorAll('#sidebar-group-media-hunt .nav-item');
if (movieHuntNavItems.length) movieHuntNavItems.forEach(function(el) { el.classList.remove('active'); });
if (movieHuntNavItems.length) movieHuntNavItems.forEach(function (el) { el.classList.remove('active'); });
// Then highlight only Movie Search
if (document.getElementById('movieHuntMovieSearchNav')) document.getElementById('movieHuntMovieSearchNav').classList.add('active');
} else {
@@ -2636,10 +2636,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrMoviesNav')) document.getElementById('requestarrMoviesNav').classList.add('active');
this.showRequestarrSidebar();
}
newTitle = 'Movies';
this.currentSection = 'requestarr-movies';
// Force movies view layout immediately
const viewIds = [
'requestarr-discover-view',
@@ -2678,10 +2678,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrTVNav')) document.getElementById('requestarrTVNav').classList.add('active');
newTitle = 'TV Shows';
this.currentSection = 'requestarr-tv';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show TV view
this.runWhenRequestarrReady('tv', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2694,10 +2694,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrPersonalBlacklistNav')) document.getElementById('requestarrPersonalBlacklistNav').classList.add('active');
newTitle = 'Personal Blacklist';
this.currentSection = 'requestarr-personal-blacklist';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show hidden view
this.runWhenRequestarrReady('hidden', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2710,10 +2710,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrSettingsNav')) document.getElementById('requestarrSettingsNav').classList.add('active');
newTitle = 'Filters';
this.currentSection = 'requestarr-filters';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show settings view
this.runWhenRequestarrReady('settings', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2726,10 +2726,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrSmartHuntNav')) document.getElementById('requestarrSmartHuntNav').classList.add('active');
newTitle = 'Smart Hunt';
this.currentSection = 'requestarr-smarthunt';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show Smart Hunt view
this.runWhenRequestarrReady('smarthunt', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2742,10 +2742,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrSmartHuntSettingsNav')) document.getElementById('requestarrSmartHuntSettingsNav').classList.add('active');
newTitle = 'Smart Hunt';
this.currentSection = 'requestarr-smarthunt-settings';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show Smart Hunt settings view
this.runWhenRequestarrReady('smarthunt-settings', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2758,10 +2758,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrUsersNav')) document.getElementById('requestarrUsersNav').classList.add('active');
newTitle = 'Users';
this.currentSection = 'requestarr-users';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show users view
this.runWhenRequestarrReady('users', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2774,10 +2774,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrBundlesNav')) document.getElementById('requestarrBundlesNav').classList.add('active');
newTitle = 'Bundles';
this.currentSection = 'requestarr-bundles';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show bundles view
this.runWhenRequestarrReady('bundles', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2790,10 +2790,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrRequestsNav')) document.getElementById('requestarrRequestsNav').classList.add('active');
newTitle = 'Requests';
this.currentSection = 'requestarr-requests';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show requests view
this.runWhenRequestarrReady('requests', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2806,10 +2806,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('requestarrGlobalBlacklistNav')) document.getElementById('requestarrGlobalBlacklistNav').classList.add('active');
newTitle = 'Global Blacklist';
this.currentSection = 'requestarr-global-blacklist';
// Switch to Requestarr sidebar
this.showRequestarrSidebar();
// Show global blacklist view
this.runWhenRequestarrReady('global-blacklist', () => {
if (window.RequestarrDiscover && typeof window.RequestarrDiscover.switchView === 'function') {
@@ -2828,10 +2828,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsSonarrNav')) document.getElementById('appsSonarrNav').classList.add('active');
newTitle = 'Sonarr';
this.currentSection = 'sonarr';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for sonarr
if (typeof appsModule !== 'undefined') {
appsModule.init('sonarr');
@@ -2842,10 +2842,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsRadarrNav')) document.getElementById('appsRadarrNav').classList.add('active');
newTitle = 'Radarr';
this.currentSection = 'radarr';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for radarr
if (typeof appsModule !== 'undefined') {
appsModule.init('radarr');
@@ -2856,10 +2856,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsLidarrNav')) document.getElementById('appsLidarrNav').classList.add('active');
newTitle = 'Lidarr';
this.currentSection = 'lidarr';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for lidarr
if (typeof appsModule !== 'undefined') {
appsModule.init('lidarr');
@@ -2870,10 +2870,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsReadarrNav')) document.getElementById('appsReadarrNav').classList.add('active');
newTitle = 'Readarr';
this.currentSection = 'readarr';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for readarr
if (typeof appsModule !== 'undefined') {
appsModule.init('readarr');
@@ -2884,10 +2884,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsWhisparrNav')) document.getElementById('appsWhisparrNav').classList.add('active');
newTitle = 'Whisparr V2';
this.currentSection = 'whisparr';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for whisparr
if (typeof appsModule !== 'undefined') {
appsModule.init('whisparr');
@@ -2898,10 +2898,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsErosNav')) document.getElementById('appsErosNav').classList.add('active');
newTitle = 'Whisparr V3';
this.currentSection = 'eros';
// Switch to Apps sidebar
this.showAppsSidebar();
// Initialize app module for eros
if (typeof appsModule !== 'undefined') {
appsModule.init('eros');
@@ -2912,10 +2912,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsSwaparrNav')) document.getElementById('appsSwaparrNav').classList.add('active');
newTitle = 'Swaparr';
this.currentSection = 'swaparr';
// Show Apps sidebar (Swaparr lives under Apps)
this.showAppsSidebar();
// Initialize Swaparr section
this.initializeSwaparr();
} else if (section === 'settings' && document.getElementById('settingsSection')) {
@@ -3181,28 +3181,13 @@ Object.assign(huntarrUI, {
}
this.switchSection('indexer-hunt');
return;
} else if (section === 'settings-clients' && document.getElementById('settingsClientsSection')) {
document.getElementById('settingsClientsSection').classList.add('active');
document.getElementById('settingsClientsSection').style.display = 'block';
if (document.getElementById('movieHuntClientsMainNav')) document.getElementById('movieHuntClientsMainNav').classList.add('active');
if (document.getElementById('mediaHuntInstanceManagementSection')) {
document.getElementById('mediaHuntInstanceManagementSection').classList.remove('active');
document.getElementById('mediaHuntInstanceManagementSection').style.display = 'none';
}
if (document.getElementById('movieManagementSection')) {
document.getElementById('movieManagementSection').classList.remove('active');
document.getElementById('movieManagementSection').style.display = 'none';
}
if (document.getElementById('settingsSizesSection')) {
document.getElementById('settingsSizesSection').classList.remove('active');
document.getElementById('settingsSizesSection').style.display = 'none';
}
newTitle = 'Clients';
this.currentSection = 'settings-clients';
this.showMovieHuntSidebar();
if (window.SettingsForms && typeof window.SettingsForms.refreshClientsList === 'function') {
window.SettingsForms.refreshClientsList();
} else if (section === 'settings-clients') {
/* Clients page removed; redirect to Root Folders which now includes Remote Path Mappings */
if (window.location.hash !== '#settings-root-folders') {
window.history.replaceState(null, document.title, window.location.pathname + (window.location.search || '') + '#settings-root-folders');
}
this.switchSection('settings-root-folders');
return;
} else if (section === 'settings-import-lists' && document.getElementById('settingsImportListsSection')) {
if (document.getElementById('tvHuntSettingsImportListsSection')) { document.getElementById('tvHuntSettingsImportListsSection').classList.remove('active'); document.getElementById('tvHuntSettingsImportListsSection').style.display = 'none'; }
document.getElementById('settingsImportListsSection').classList.add('active');
@@ -3259,6 +3244,10 @@ Object.assign(huntarrUI, {
if (window.RootFolders && typeof window.RootFolders.initOrRefresh === 'function') {
window.RootFolders.initOrRefresh('movie');
}
// Also refresh remote path mappings (now part of root folders page)
if (window.RemoteMappings && typeof window.RemoteMappings.refreshList === 'function') {
window.RemoteMappings.refreshList();
}
} else if (section === 'settings-logs' && document.getElementById('settingsLogsSection')) {
document.getElementById('settingsLogsSection').classList.add('active');
document.getElementById('settingsLogsSection').style.display = 'block';
@@ -3295,10 +3284,10 @@ Object.assign(huntarrUI, {
if (document.getElementById('appsProwlarrNav')) document.getElementById('appsProwlarrNav').classList.add('active');
newTitle = 'Prowlarr';
this.currentSection = 'prowlarr';
// Switch to Apps sidebar for prowlarr
this.showAppsSidebar();
// Initialize prowlarr settings if not already done
this.initializeProwlarr();
} else if (section === 'user' && document.getElementById('userSection')) {
@@ -3320,8 +3309,8 @@ Object.assign(huntarrUI, {
this.showMovieHuntSidebar();
this._highlightMovieHuntNavForEditor('indexer');
} else if (window.SettingsForms && window.SettingsForms._currentEditing && window.SettingsForms._currentEditing.appType === 'client') {
var ct = (window.SettingsForms._currentEditing.originalInstance && window.SettingsForms._currentEditing.originalInstance.type) ? String(window.SettingsForms._currentEditing.originalInstance.type).toLowerCase() : 'nzbget';
newTitle = (ct === 'nzbhunt' ? 'NZB Hunt (Built-in)' : ct === 'sabnzbd' ? 'SABnzbd' : ct === 'nzbget' ? 'NZBGet' : ct) + ' Connection Settings';
var ct = (window.SettingsForms._currentEditing.originalInstance && window.SettingsForms._currentEditing.originalInstance.type) ? String(window.SettingsForms._currentEditing.originalInstance.type).toLowerCase() : 'nzbhunt';
newTitle = (ct === 'nzbhunt' ? 'NZB Hunt (Built-in)' : ct === 'torhunt' ? 'Tor Hunt (Built-in)' : ct === 'qbittorrent' ? 'qBittorrent' : ct) + ' Connection Settings';
this.showMovieHuntSidebar();
this._highlightMovieHuntNavForEditor('client');
} else {
@@ -3342,7 +3331,7 @@ Object.assign(huntarrUI, {
if (this.elements.homeNav) this.elements.homeNav.classList.add('active');
newTitle = 'Home';
this.currentSection = 'home';
// Show main sidebar
this.showMainSidebar();
}

View File

@@ -578,13 +578,13 @@ window.HuntarrNotifications = {
window.HuntarrNavigation = {
// Handle navigation clicks
handleNavigation: function(e) {
handleNavigation: function (e) {
e.preventDefault();
const target = e.currentTarget;
const href = target.getAttribute('href');
const isInternalLink = href && href.startsWith('#');
// Check for unsaved changes before navigating
if (window.huntarrUI && typeof window.huntarrUI.suppressUnsavedChangesCheck === 'boolean') {
if (window.huntarrUI.suppressUnsavedChangesCheck) {
@@ -592,7 +592,7 @@ window.HuntarrNavigation = {
window.huntarrUI.suppressUnsavedChangesCheck = false;
}
}
// Add special handling for apps section - clear global app module flags
if (window.huntarrUI && window.huntarrUI.currentSection === 'apps' && href && !href.includes('apps')) {
// Reset the app module flags when navigating away
@@ -616,8 +616,8 @@ window.HuntarrNavigation = {
window.location.href = href;
}
},
handleHashNavigation: function(hash) {
handleHashNavigation: function (hash) {
let section = (hash || '').replace(/^#+/, '').trim();
if (section.indexOf('%23') >= 0) section = section.split('%23').pop() || section;
if (section.indexOf('./') === 0) section = section.replace(/^\.?\/*/, '');
@@ -746,7 +746,7 @@ window.HuntarrNavigation = {
'tv-hunt-settings-custom-formats': 'settings-custom-formats',
'tv-hunt-settings-profiles': 'settings-profiles',
'tv-hunt-settings-indexers': 'indexer-hunt',
'tv-hunt-settings-clients': 'settings-clients',
'tv-hunt-settings-clients': 'settings-root-folders',
'tv-hunt-settings-root-folders': 'settings-root-folders',
'settings-import-media-tv': 'settings-import-media',
'tv-hunt-settings-sizes': 'settings-sizes',
@@ -782,31 +782,31 @@ window.HuntarrNavigation = {
// switchSection is handled by huntarrUI.switchSection() in app.js.
// This module only provides handleHashNavigation() which delegates to it.
// System tab management
switchSystemTab: function(tab) {
switchSystemTab: function (tab) {
// Update tab buttons
document.querySelectorAll('#systemSection .system-tab').forEach(function(t) {
document.querySelectorAll('#systemSection .system-tab').forEach(function (t) {
t.classList.toggle('active', t.getAttribute('data-system-tab') === tab);
});
// Update tab panels
document.querySelectorAll('#systemSection .system-tab-panel').forEach(function(p) {
document.querySelectorAll('#systemSection .system-tab-panel').forEach(function (p) {
var isActive = p.getAttribute('data-system-panel') === tab;
p.style.display = isActive ? 'block' : 'none';
p.classList.toggle('active', isActive);
});
// Toggle page header bars
document.querySelectorAll('#systemSection .system-page-header').forEach(function(h) {
document.querySelectorAll('#systemSection .system-page-header').forEach(function (h) {
h.style.display = 'none';
});
var hdr = document.getElementById('system-header-' + tab);
if (hdr) hdr.style.display = 'block';
},
setupSystemTabs: function() {
setupSystemTabs: function () {
var self = this;
document.querySelectorAll('#systemSection .system-tab').forEach(function(tab) {
tab.addEventListener('click', function() {
document.querySelectorAll('#systemSection .system-tab').forEach(function (tab) {
tab.addEventListener('click', function () {
var t = tab.getAttribute('data-system-tab');
if (t) {
// Update the hash to reflect the tab
@@ -822,7 +822,7 @@ window.HuntarrNavigation = {
// Each function now expands the relevant accordion group instead
// of toggling display on separate sidebar divs.
showMainSidebar: function() {
showMainSidebar: function () {
// Home page — collapse all groups
if (typeof expandSidebarGroup === 'function') {
// Let setActiveNavItem handle it via hashchange
@@ -830,77 +830,77 @@ window.HuntarrNavigation = {
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
showAppsSidebar: function() {
showAppsSidebar: function () {
if (typeof expandSidebarGroup === 'function') expandSidebarGroup('sidebar-group-apps');
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
showSettingsSidebar: function() {
showSettingsSidebar: function () {
if (typeof expandSidebarGroup === 'function') expandSidebarGroup('sidebar-group-settings');
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
showRequestarrSidebar: function() {
showRequestarrSidebar: function () {
if (typeof expandSidebarGroup === 'function') expandSidebarGroup('sidebar-group-requests');
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
showMovieHuntSidebar: function() {
showMovieHuntSidebar: function () {
if (typeof expandSidebarGroup === 'function') expandSidebarGroup('sidebar-group-media-hunt');
this.updateMovieHuntSidebarActive();
},
showTVHuntSidebar: function() {
showTVHuntSidebar: function () {
this.showMovieHuntSidebar();
},
updateMovieHuntSidebarActive: function() {
updateMovieHuntSidebarActive: function () {
// Sub-group expansion is handled exclusively by setActiveNavItem() in sidebar.html.
// This function only manages the activity-view CSS class (used by CSS to hide items)
// and delegates active-item highlighting to setActiveNavItem().
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
updateTVHuntSidebarActive: function() {
updateTVHuntSidebarActive: function () {
// TV Hunt sidebar removed; no-op
},
updateAppsSidebarActive: function() {
updateAppsSidebarActive: function () {
// Active state is handled by setActiveNavItem() in the inline script
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
updateSettingsSidebarActive: function() {
updateSettingsSidebarActive: function () {
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
updateRequestarrSidebarActive: function() {
updateRequestarrSidebarActive: function () {
if (typeof setActiveNavItem === 'function') setActiveNavItem();
},
setupAppsNavigation: function() {
setupAppsNavigation: function () {
// Navigation is handled by hash links — no extra click listeners needed with unified sidebar
},
setupSettingsNavigation: function() {
setupSettingsNavigation: function () {
// Navigation is handled by hash links
},
// setupRequestarrNavigation: handled by HuntarrRequestarr.setupRequestarrNavigation() in requestarr-controller.js
setupMovieHuntNavigation: function() {
setupMovieHuntNavigation: function () {
// Navigation is handled by hash links
},
setupTVHuntNavigation: function() {
setupTVHuntNavigation: function () {
// TV Hunt sidebar removed; no-op
},
setupNzbHuntNavigation: function() {
setupNzbHuntNavigation: function () {
// Navigation is handled by hash links
},
updateRequestarrNavigation: function(view) {
updateRequestarrNavigation: function (view) {
if (!window.RequestarrDiscover || !window.RequestarrDiscover.switchView) {
console.warn('[Navigation] RequestarrDiscover not available');
return;

View File

@@ -696,7 +696,7 @@
* Media Hunt unified discover for Movie Hunt and TV Hunt.
* Mode from window._mediaHuntSectionMode ('movie' | 'tv'). Uses #media-hunt-* elements.
*/
(function() {
(function () {
'use strict';
const SEARCH_DEBOUNCE_MS = 500;
@@ -730,8 +730,8 @@
if (betaEl) {
betaEl.innerHTML = mode === 'movie'
? '<strong>Beta feature:</strong> Movie Hunt is in active development. Things may be broken and will change quickly. There is little to no support until it is officially released. Only USENET (SABnzbd, NZBGet) is supported for now. <a href="https://plexguide.github.io/Huntarr.io/apps/movie-hunt.html#docker" target="_blank" rel="noopener">Wiki &amp; Docker setup <i class="fas fa-external-link-alt" style="font-size: 0.85em;"></i></a>'
: '<strong>Beta feature:</strong> TV Hunt is in active development. Things may be broken and will change quickly. Only USENET (SABnzbd, NZBGet) is supported for now.';
? '<strong>Beta feature:</strong> Movie Hunt is in active development. Things may be broken and will change quickly. There is little to no support until it is officially released. <a href="https://plexguide.github.io/Huntarr.io/apps/movie-hunt.html#docker" target="_blank" rel="noopener">Wiki &amp; Docker setup <i class="fas fa-external-link-alt" style="font-size: 0.85em;"></i></a>'
: '<strong>Beta feature:</strong> TV Hunt is in active development. Things may be broken and will change quickly.';
}
if (searchInput) searchInput.placeholder = mode === 'movie' ? 'Search Movies' : 'Search TV Shows';
if (loadingText) loadingText.textContent = mode === 'movie' ? 'Loading movies...' : 'Loading TV shows...';
@@ -756,7 +756,7 @@
{ v: 'name.asc', l: 'Title (A-Z)' },
{ v: 'name.desc', l: 'Title (Z-A)' }
];
opts.forEach(function(o) {
opts.forEach(function (o) {
const opt = document.createElement('option');
opt.value = o.v;
opt.textContent = o.l;
@@ -828,7 +828,7 @@
const self = this;
const input = document.getElementById('media-hunt-search-input');
if (!input) return;
input.addEventListener('input', function() {
input.addEventListener('input', function () {
if (self.searchTimeout) clearTimeout(self.searchTimeout);
const query = (input.value || '').trim();
if (!query) {
@@ -837,7 +837,7 @@
else self.loadDiscover();
return;
}
self.searchTimeout = setTimeout(function() { self.performSearch(query); }, SEARCH_DEBOUNCE_MS);
self.searchTimeout = setTimeout(function () { self.performSearch(query); }, SEARCH_DEBOUNCE_MS);
});
},
@@ -854,32 +854,32 @@
if (mode === 'movie') {
fetch('./api/requestarr/search?q=' + encodeURIComponent(query) + '&app_type=radarr&instance_name=search')
.then(function(r) { return r.json(); })
.then(function(data) {
.then(function (r) { return r.json(); })
.then(function (data) {
const results = data.results || [];
grid.innerHTML = '';
if (results.length > 0) {
results.forEach(function(item) { grid.appendChild(window.MediaHunt.createCard(item)); });
results.forEach(function (item) { grid.appendChild(window.MediaHunt.createCard(item)); });
} else {
grid.innerHTML = '<p style="color: #888; text-align: center; padding: 60px; width: 100%;">No movies found</p>';
}
})
.catch(function() {
.catch(function () {
grid.innerHTML = '<p style="color: #ef4444; text-align: center; padding: 60px; width: 100%;">Search failed</p>';
});
} else {
fetch('./api/tv-hunt/search?q=' + encodeURIComponent(query))
.then(function(r) { return r.json(); })
.then(function(data) {
.then(function (r) { return r.json(); })
.then(function (data) {
const results = data.results || [];
grid.innerHTML = '';
if (results.length > 0) {
results.forEach(function(show) { grid.appendChild(window.MediaHunt.createShowCard(show)); });
results.forEach(function (show) { grid.appendChild(window.MediaHunt.createShowCard(show)); });
} else {
grid.innerHTML = '<p style="color: #888; text-align: center; padding: 60px; width: 100%;">No results found.</p>';
}
})
.catch(function() {
.catch(function () {
grid.innerHTML = '<p style="color: #ef4444; text-align: center; padding: 60px; width: 100%;">Search failed</p>';
});
}
@@ -896,7 +896,7 @@
const self = this;
const sortSelect = document.getElementById('media-hunt-sort');
if (!sortSelect) return;
sortSelect.addEventListener('change', function() {
sortSelect.addEventListener('change', function () {
self._currentSort = sortSelect.value;
self.page = 1;
self.hasMore = true;
@@ -915,7 +915,7 @@
setupFilterButton() {
const btn = document.getElementById('media-hunt-filter-btn');
if (btn) {
btn.addEventListener('click', function() {
btn.addEventListener('click', function () {
if (window.MediaHuntFilters && window.MediaHuntFilters.openFiltersModal) {
window.MediaHuntFilters.openFiltersModal();
}
@@ -943,8 +943,8 @@
else url += '&sort_by=' + encodeURIComponent(this.getSortParam());
fetch(url)
.then(function(r) { return r.json(); })
.then(function(data) {
.then(function (r) { return r.json(); })
.then(function (data) {
if (token !== window.MediaHunt.requestToken) return;
if (page === 1) grid.innerHTML = '';
else {
@@ -953,17 +953,17 @@
}
const results = data.results || [];
if (results.length > 0) {
results.forEach(function(item) { grid.appendChild(window.MediaHunt.createCard(item)); });
results.forEach(function (item) { grid.appendChild(window.MediaHunt.createCard(item)); });
} else if (page === 1) {
grid.innerHTML = '<p style="color: #888; text-align: center; width: 100%; padding: 40px;">No movies found</p>';
}
window.MediaHunt.hasMore = data.has_more !== false && results.length >= 20;
})
.catch(function() {
.catch(function () {
if (page === 1) grid.innerHTML = '<p style="color: #ef4444; text-align: center; width: 100%; padding: 40px;">Failed to load movies</p>';
window.MediaHunt.hasMore = false;
})
.finally(function() {
.finally(function () {
window.MediaHunt.loading = false;
window.MediaHunt.page = page;
const sentinel = document.getElementById('media-hunt-scroll-sentinel');
@@ -987,15 +987,15 @@
const self = this;
const sortParam = (document.getElementById('media-hunt-sort') && document.getElementById('media-hunt-sort').value) || 'popularity.desc';
fetch('./api/tv-hunt/discover/tv?page=' + this.page + '&sort_by=' + encodeURIComponent(sortParam))
.then(function(r) { return r.json(); })
.then(function(data) {
.then(function (r) { return r.json(); })
.then(function (data) {
const results = data.results || [];
if (self.page === 1) grid.innerHTML = '';
results.forEach(function(show) { grid.appendChild(window.MediaHunt.createShowCard(show)); });
results.forEach(function (show) { grid.appendChild(window.MediaHunt.createShowCard(show)); });
self.hasMore = results.length >= 20;
self.loading = false;
})
.catch(function() {
.catch(function () {
if (self.page === 1) grid.innerHTML = '<p style="color: #ef4444; text-align: center; width: 100%; padding: 40px;">Failed to load TV shows.</p>';
self.loading = false;
});
@@ -1007,8 +1007,8 @@
const self = this;
const scrollRoot = document.querySelector('.main-content') || null;
this.observer = new IntersectionObserver(
function(entries) {
entries.forEach(function(entry) {
function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) return;
if (getMode() === 'movie') {
if (self.hasMore && !self.loading) self.loadMovies(self.page + 1);
@@ -1064,7 +1064,7 @@
status: inLibrary ? 'available' : (partial ? 'requested' : 'requested'),
hasFile: inLibrary,
appType: 'movie_hunt',
onDeleted: function() { window.MediaUtils.animateCardRemoval(cardElement); }
onDeleted: function () { window.MediaUtils.animateCardRemoval(cardElement); }
});
},
@@ -1107,7 +1107,7 @@
const requestBtn = card.querySelector('.media-card-request-btn');
const hideBtnEl = card.querySelector('.media-card-hide-btn');
const deleteBtnEl = card.querySelector('.media-card-delete-btn');
const openRequestModal = function() {
const openRequestModal = function () {
const id = item.tmdb_id || item.id;
if (id && window.RequestarrDiscover && window.RequestarrDiscover.modal) {
let suggestedInstance = null;
@@ -1120,7 +1120,7 @@
window.RequestarrDiscover.modal.openModal(id, 'movie', suggestedInstance);
}
};
const openDetailPage = function() {
const openDetailPage = function () {
if (window.RequestarrDetail) {
window.RequestarrDetail.openDetail(item);
} else {
@@ -1129,10 +1129,10 @@
};
// When not in library and not requested: any click opens modal. When requested or in library: click opens detail page.
const shouldOpenModal = !inLibrary && !partial;
if (hideBtnEl) hideBtnEl.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); window.MediaHunt.hideMediaFromHome(item, card); });
if (deleteBtnEl) deleteBtnEl.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); window.MediaHunt.openDeleteModalFromHome(item, card); });
if (hideBtnEl) hideBtnEl.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); window.MediaHunt.hideMediaFromHome(item, card); });
if (deleteBtnEl) deleteBtnEl.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); window.MediaHunt.openDeleteModalFromHome(item, card); });
card.style.cursor = 'pointer';
card.addEventListener('click', function(e) {
card.addEventListener('click', function (e) {
if (hideBtnEl && (e.target === hideBtnEl || hideBtnEl.contains(e.target))) return;
if (deleteBtnEl && (e.target === deleteBtnEl || deleteBtnEl.contains(e.target))) return;
if (requestBtn && (e.target === requestBtn || requestBtn.contains(e.target))) { e.preventDefault(); e.stopPropagation(); openRequestModal(); return; }
@@ -1174,13 +1174,13 @@
instance_id: instId,
})
})
.then(function(r) { return r.json(); })
.then(function(data) {
.then(function (r) { return r.json(); })
.then(function (data) {
if (data.exists && window.huntarrUI) window.huntarrUI.showNotification('Series already in collection.', 'info');
else if (data.success && window.huntarrUI) window.huntarrUI.showNotification('Added to collection!', 'success');
else if (window.huntarrUI) window.huntarrUI.showNotification(data.error || 'Failed to add.', 'error');
})
.catch(function() {
.catch(function () {
if (window.huntarrUI) window.huntarrUI.showNotification('Network error adding to collection.', 'error');
});
},
@@ -1201,12 +1201,12 @@
const addBtn = card.querySelector('.add-to-collection-btn');
if (addBtn) {
addBtn.addEventListener('click', function(e) {
addBtn.addEventListener('click', function (e) {
e.stopPropagation();
if (window.MediaHunt && window.MediaHunt.addToCollection) window.MediaHunt.addToCollection(show);
});
}
card.addEventListener('click', function() {
card.addEventListener('click', function () {
if (window.RequestarrTVDetail) {
window.RequestarrTVDetail.openDetail({ tmdb_id: show.id, id: show.id, title: show.name || show.title, poster_path: show.poster_path });
}

File diff suppressed because it is too large Load Diff