From 7aacf53fd04c0770a0023fb7d797de703339e695 Mon Sep 17 00:00:00 2001 From: dteviot Date: Mon, 11 Sep 2023 11:56:28 +1200 Subject: [PATCH] Update template with common chapter fetches Add common ways of getting chapter URLs to template --- plugin/js/parsers/Template.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugin/js/parsers/Template.js b/plugin/js/parsers/Template.js index 299b4a52..fcac1982 100644 --- a/plugin/js/parsers/Template.js +++ b/plugin/js/parsers/Template.js @@ -39,6 +39,26 @@ class TemplateParser extends Parser{ // to convert the links into a list of URLs the parser will collect. let menu = dom.querySelector("div.su-tabs-panes"); return util.hyperlinksToChapterList(menu); + + // Almost as common, find links on page and convert. + return [...dom.querySelectorAll("li.wp-manga-chapter.free-chap a")] + .map(a => util.hyperLinkToChapter(a)); + + // Need to walk multiple ToC pages, page by page + return (await this.walkTocPages(dom, + TemplateParser.chaptersFromDom, + TemplateParser.nextTocPageUrl, + chapterUrlsUI + )); + + // Can get list of all ToC pages + let tocPage1chapters = TemplateParser.extractPartialChapterList(dom); + let urlsOfTocPages = TemplateParser.getUrlsOfTocPages(dom); + return (await this.getChaptersFromAllTocPages(tocPage1chapters, + TemplateParser.extractPartialChapterList, + urlsOfTocPages, + chapterUrlsUI + )); } */