🔧 configurable comic title
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
'use strict';
|
||||
|
||||
let totalComics = 0;
|
||||
let comicName = ''; // Will be extracted from initial page title
|
||||
|
||||
// Fetch and display a comic
|
||||
async function loadComic(comicId) {
|
||||
@@ -109,7 +110,7 @@
|
||||
updateNavButtons(comic.number, comic.formatted_date);
|
||||
|
||||
// Update page title
|
||||
document.title = `${title} - Sunday Comics`;
|
||||
document.title = `${title} - ${comicName}`;
|
||||
|
||||
// Update URL without reload
|
||||
history.pushState({ comicId: comic.number }, '', `/comic/${comic.number}`);
|
||||
@@ -231,6 +232,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract comic name from initial page title (e.g., "Latest Comic - Sunday Comics" -> "Sunday Comics")
|
||||
const titleParts = document.title.split(' - ');
|
||||
if (titleParts.length > 1) {
|
||||
comicName = titleParts[titleParts.length - 1];
|
||||
}
|
||||
|
||||
// Get total comics count from the page
|
||||
totalComics = parseInt(document.querySelector('.comic-container').dataset.totalComics || 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user