feat: show current chapter in Continue reading cards

Each card in the Continue reading section now displays the saved chapter
number (e.g. 'Chapter 42') in amber below the author line, read from
localStorage.reading_progress.
This commit is contained in:
Admin
2026-03-01 18:55:26 +05:00
parent 07fbfe5555
commit afa457cedd

View File

@@ -202,6 +202,22 @@ const homeTmpl = `
var card = document.querySelector('[data-slug="' + slug + '"]');
if (!card) return;
var clone = card.cloneNode(true);
// Inject "Chapter N" line into the cloned card
var chapterNum = progress[slug];
var meta = clone.querySelector('.min-w-0');
if (meta && chapterNum) {
var chLine = document.createElement('p');
chLine.className = 'text-xs text-amber-400 mt-1';
chLine.textContent = 'Chapter ' + chapterNum;
// Insert after the author line (second child) or after the title
var author = meta.querySelector('p');
if (author) {
author.insertAdjacentElement('afterend', chLine);
} else {
var title = meta.querySelector('h2');
if (title) title.insertAdjacentElement('afterend', chLine);
}
}
continueGrid.appendChild(clone);
card.parentNode.removeChild(card);
moved++;