From 422d9c8a32ac0514716ef0d7cab2bd496c1ae62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=99=BE=E7=B1=B3?= Date: Fri, 27 Mar 2026 16:17:01 +0800 Subject: [PATCH] Add support for decimal chapters (e.g., 107.5) - check after integer chapters --- alacarte-novel-website/js/app.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/alacarte-novel-website/js/app.js b/alacarte-novel-website/js/app.js index 58b5336..3058804 100644 --- a/alacarte-novel-website/js/app.js +++ b/alacarte-novel-website/js/app.js @@ -47,6 +47,30 @@ async function loadChaptersData() { } } + // 额外检查小数章节(如107.5) + for (let i = 1; i <= chapterNum + 10; i++) { + try { + const decimalId = i + 0.5; + const response = await fetch(`data/chapter-${decimalId}.json`, { + cache: 'no-store', + headers: { + 'Cache-Control': 'no-cache', + 'Pragma': 'no-cache' + } + }); + + if (response.ok) { + const data = await response.json(); + chapters.push(normalizeChapterData(data, decimalId)); + } + } catch (error) { + // 忽略错误 + } + } + + // 按id排序 + chapters.sort((a, b) => parseFloat(a.id) - parseFloat(b.id)); + chaptersData = chapters; isDataLoaded = true;