Add support for decimal chapters (e.g., 107.5) - check after integer chapters

This commit is contained in:
小虾米 2026-03-27 16:17:01 +08:00
parent 190edb9003
commit 422d9c8a32

View File

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