diff --git a/userscript/manga-bookmark.user.js b/userscript/manga-bookmark.user.js index 9f9b4a1..f8ef6ba 100644 --- a/userscript/manga-bookmark.user.js +++ b/userscript/manga-bookmark.user.js @@ -311,9 +311,11 @@ } // Highest chapter the site lists, or null when the markup yields nothing. - function computeLatestChapter(site, anchors) { + // seriesId is only consulted by adapters whose pages carry other series' + // chapter links; the rest ignore it. + function computeLatestChapter(site, anchors, seriesId) { const a = adapterFor(site); - return a ? a.latestChapterFromAnchors(anchors) : null; + return a ? a.latestChapterFromAnchors(anchors, seriesId) : null; } function currentSite() { @@ -834,7 +836,7 @@ if (!existing) return; applyLatestChapterIfChanged( existing, - computeLatestChapter(p.site, anchorsFromDocument(document)) + computeLatestChapter(p.site, anchorsFromDocument(document), p.seriesId) ); } @@ -864,7 +866,7 @@ const res = await fetch(bm.series_url, { credentials: "same-origin" }); if (!res.ok) continue; const html = await res.text(); - const latest = computeLatestChapter(bm.site, anchorsFromHTML(html)); + const latest = computeLatestChapter(bm.site, anchorsFromHTML(html), bm.series_id); await applyLatestChapterIfChanged(state.byKey[bm.key] || bm, latest); } catch (e) { /* offline or blocked — try again after the throttle window */ diff --git a/userscript/test/logic.test.js b/userscript/test/logic.test.js index 2271956..7ed1677 100644 --- a/userscript/test/logic.test.js +++ b/userscript/test/logic.test.js @@ -264,6 +264,16 @@ test("comix latest returns null when no chapter links are present", () => { assert.equal(comix.latestChapterFromAnchors(anchorsFromHTML("x"), "n8we"), null); }); +test("asura and demonic ignore the seriesId argument", () => { + const asuraAnchors = anchorsFromHTML( + `Chapter 12` + ); + assert.deepEqual(asura.latestChapterFromAnchors(asuraAnchors, "ignored"), { + num: 12, + label: "Chapter 12", + }); +}); + // ============================================================ // Shared helpers // ============================================================