fix: Load research papers modal on all pages with navbar
The Publications button in the Research dropdown was non-functional on every page except index.html because the modal script was only loaded there. Now the navbar dynamically loads it on all pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b502d3c8ef
commit
a92e822e5c
1 changed files with 9 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ class TractatusNavbar {
|
||||||
this.render();
|
this.render();
|
||||||
this.attachEventListeners();
|
this.attachEventListeners();
|
||||||
this.setActivePageIndicator();
|
this.setActivePageIndicator();
|
||||||
|
this.loadResearchPapersModal();
|
||||||
|
|
||||||
// Dispatch event to signal navbar is ready
|
// Dispatch event to signal navbar is ready
|
||||||
window.dispatchEvent(new CustomEvent('navbarReady'));
|
window.dispatchEvent(new CustomEvent('navbarReady'));
|
||||||
|
|
@ -491,6 +492,14 @@ class TractatusNavbar {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadResearchPapersModal() {
|
||||||
|
// Dynamically load the research papers modal if not already present
|
||||||
|
if (window.researchPapersModal || document.getElementById('research-papers-modal')) return;
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = '/js/components/research-papers-modal.js?v=' + (document.querySelector('script[src*="navbar.js"]')?.src.match(/v=([^&]*)/)?.[1] || Date.now());
|
||||||
|
document.body.appendChild(script);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-initialize when DOM is ready
|
// Auto-initialize when DOM is ready
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue