From b02ecdc5e4f37c64ad8b7f6be2d02467df8ebdea Mon Sep 17 00:00:00 2001 From: ImLJS <109210868+ImLJS@users.noreply.github.com> Date: Thu, 30 Jan 2025 02:51:55 +0530 Subject: [PATCH] Add Site novelsonline.net --- plugin/js/parsers/NovelsOnlineParser.js | 43 +++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 44 insertions(+) create mode 100644 plugin/js/parsers/NovelsOnlineParser.js diff --git a/plugin/js/parsers/NovelsOnlineParser.js b/plugin/js/parsers/NovelsOnlineParser.js new file mode 100644 index 00000000..e83f6f5d --- /dev/null +++ b/plugin/js/parsers/NovelsOnlineParser.js @@ -0,0 +1,43 @@ +"use strict"; + +parserFactory.register("novelsonline.net", () => new NovelsOnlineParser()); + +class NovelsOnlineParser extends Parser { + constructor() { + super(); + } + + async getChapterUrls(dom) { + return [...dom.querySelectorAll(".chapter-chs a")] + .map(link => this.linkToChapter(link)); + } + + linkToChapter(link) { + return ({ + sourceUrl: link.href, + title: link.textContent, + }); + } + + findContent(dom) { + return ( + dom.querySelector("div#contentall") + ); + } + + extractTitleImpl(dom) { + return dom.querySelector("h1"); + } + + findChapterTitle(dom) { + return dom.querySelector("h1"); + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, "div.novel-cover"); + } + + getInformationEpubItemChildNodes(dom) { + return [dom.querySelector(".novel-right .novel-detail-body")]; + } +} \ No newline at end of file diff --git a/plugin/popup.html b/plugin/popup.html index bb5eb812..aa04ab19 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -690,6 +690,7 @@