bug fixes

This commit is contained in:
2025-11-28 13:12:42 +01:00
parent 2b29beeeb5
commit df1b9a5edd
4 changed files with 70 additions and 25 deletions

View File

@@ -8,6 +8,7 @@ async function init() {
try {
const res = await fetch(`/api/book/${bookId}`);
const data = await res.json();
console.log(data)
if (data.error) {
const titleEl = document.getElementById('title');

View File

@@ -448,12 +448,16 @@ document.querySelectorAll('[data-direction]').forEach(btn => {
});
prevBtn.addEventListener('click', () => {
const newChapter = String(parseInt(chapter) - 1);
const current = parseInt(chapter);
if (current <= 0) return;
const newChapter = String(current - 1);
updateURL(newChapter);
window.scrollTo(0, 0);
loadChapter();
});
nextBtn.addEventListener('click', () => {
const newChapter = String(parseInt(chapter) + 1);
updateURL(newChapter);