From 0756aa35a434134a2dc75acb7686ff06a0244c03 Mon Sep 17 00:00:00 2001 From: dteviot Date: Sun, 28 Jan 2024 11:39:37 +1300 Subject: [PATCH] Add site https://czbooks.net/ See: https://github.com/dteviot/WebToEpub/issues/1187 --- plugin/js/parsers/CzbooksParser.js | 39 ++++++++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 40 insertions(+) create mode 100644 plugin/js/parsers/CzbooksParser.js diff --git a/plugin/js/parsers/CzbooksParser.js b/plugin/js/parsers/CzbooksParser.js new file mode 100644 index 00000000..7e4c899a --- /dev/null +++ b/plugin/js/parsers/CzbooksParser.js @@ -0,0 +1,39 @@ +"use strict"; + +parserFactory.register("czbooks.net", () => new CzbooksParser()); + +class CzbooksParser extends Parser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + let menu = dom.querySelector("ul.chapter-list"); + return util.hyperlinksToChapterList(menu); + } + + findContent(dom) { + return dom.querySelector(".content"); + } + + extractTitleImpl(dom) { + return dom.querySelector(".novel-detail .title"); + } + + extractAuthor(dom) { + let authorLabel = dom.querySelector(".novel-detail span.author a"); + return authorLabel?.textContent ?? super.extractAuthor(dom); + } + + findChapterTitle(dom) { + return dom.querySelector(".name"); + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, ".novel-detail"); + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll(".description")]; + } +} diff --git a/plugin/popup.html b/plugin/popup.html index bc1e71e6..d43c80de 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -561,6 +561,7 @@

Instructions

+