From ed1820352aa4b2ada1a556440caa3a3551a9e3b6 Mon Sep 17 00:00:00 2001 From: Leone Jacob Sunil <109210868+ImLJS@users.noreply.github.com> Date: Thu, 5 Dec 2024 02:18:48 +0530 Subject: [PATCH] Add Site readernovel.net --- plugin/js/parsers/ReaderNovelParser.js | 51 ++++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 52 insertions(+) create mode 100644 plugin/js/parsers/ReaderNovelParser.js diff --git a/plugin/js/parsers/ReaderNovelParser.js b/plugin/js/parsers/ReaderNovelParser.js new file mode 100644 index 00000000..6b3ee8b4 --- /dev/null +++ b/plugin/js/parsers/ReaderNovelParser.js @@ -0,0 +1,51 @@ +"use strict"; + +parserFactory.register("readernovel.net", () => new ReaderNovelParser()); + +class ReaderNovelParser extends Parser { + constructor() { + super(); + } + + async getChapterUrls(dom) { + return [...dom.querySelectorAll(".chapter-list-wrapper a")] + .map(link => this.linkToChapter(link)) + .reverse(); + } + + linkToChapter(link) { + let title = link.getAttribute("title"); + return ({ + sourceUrl: link.href, + title: title, + }); + } + + findContent(dom) { + return ( + dom.querySelector("div#chapter-container") || dom.querySelector("#chapter-content") + ); + } + + extractTitleImpl(dom) { + return dom.querySelector(".page-title"); + } + + extractAuthor(dom) { + let authorLabel = dom.querySelector("li.list-group-item a"); + return authorLabel?.textContent ?? super.extractAuthor(dom); + } + + findChapterTitle(dom) { + return dom.querySelector("span.chapter-title"); + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, ".manga-image"); + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll("div#collapseSummary")]; + } + +} \ No newline at end of file diff --git a/plugin/popup.html b/plugin/popup.html index cb28eba9..4cc29c19 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -727,6 +727,7 @@