🐛 fix content loading for comic nav
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
// Show/hide header based on plain mode
|
||||
const header = document.querySelector('.comic-header');
|
||||
let header = document.querySelector('.comic-header');
|
||||
if (comic.plain) {
|
||||
if (header) {
|
||||
header.style.display = 'none';
|
||||
@@ -60,10 +60,11 @@
|
||||
newHeader.className = 'comic-header';
|
||||
newHeader.innerHTML = '<h1></h1><p class="comic-date"></p>';
|
||||
container.insertBefore(newHeader, container.firstChild);
|
||||
header = newHeader; // Update reference to the newly created element
|
||||
}
|
||||
// Update title and date
|
||||
document.querySelector('.comic-header h1').textContent = title;
|
||||
document.querySelector('.comic-date').textContent = comic.date;
|
||||
// Update title and date using the header reference
|
||||
header.querySelector('h1').textContent = title;
|
||||
header.querySelector('.comic-date').textContent = comic.date;
|
||||
}
|
||||
|
||||
// Update image and its link
|
||||
@@ -74,7 +75,7 @@
|
||||
updateComicImageLink(comic.number);
|
||||
|
||||
// Update author note
|
||||
const transcriptDiv = document.querySelector('.comic-transcript');
|
||||
let transcriptDiv = document.querySelector('.comic-transcript');
|
||||
if (comic.author_note) {
|
||||
if (!transcriptDiv) {
|
||||
const container = document.querySelector('.comic-container');
|
||||
@@ -82,6 +83,7 @@
|
||||
newDiv.className = 'comic-transcript';
|
||||
newDiv.innerHTML = '<h3>Author Note</h3>';
|
||||
container.appendChild(newDiv);
|
||||
transcriptDiv = newDiv; // Update reference to the newly created element
|
||||
}
|
||||
|
||||
// Clear existing content after the h3
|
||||
|
||||
Reference in New Issue
Block a user