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