🔧 configurable comic title

This commit is contained in:
mi
2025-11-13 14:43:24 +10:00
parent 59707d3572
commit 899f2060f3
6 changed files with 24 additions and 13 deletions

View File

@@ -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);

View File

@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: Sunday Comics API
description: API for accessing webcomic data from the Sunday Comics platform
title: Webcomic API
description: API for accessing webcomic data
version: 1.0.0
contact:
url: http://127.0.0.1:3000