From 45b0080cfd1e3a35218aaa1e96780e6385afc10f Mon Sep 17 00:00:00 2001 From: dteviot Date: Sun, 23 Jul 2023 16:34:07 +1200 Subject: [PATCH] Add site https://kaystls.site See: https://github.com/dteviot/WebToEpub/issues/1006 --- plugin/js/parsers/KaystlsParser.js | 26 ++++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 27 insertions(+) create mode 100644 plugin/js/parsers/KaystlsParser.js diff --git a/plugin/js/parsers/KaystlsParser.js b/plugin/js/parsers/KaystlsParser.js new file mode 100644 index 00000000..9816e9e5 --- /dev/null +++ b/plugin/js/parsers/KaystlsParser.js @@ -0,0 +1,26 @@ +"use strict"; + +parserFactory.register("kaystls.site", () => new KaystlsParser()); + +class KaystlsParser extends Parser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + return [...dom.querySelectorAll("div.wp-block-columns a.wp-block-navigation-link__content")] + .map(a => util.hyperLinkToChapter(a)); + } + + findContent(dom) { + return dom.querySelector("div.wp-block-columns"); + } + + extractTitleImpl(dom) { + return dom.querySelector("div.wp-block-columns.alignwide h1"); + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, "div.wp-block-cover"); + } +} diff --git a/plugin/popup.html b/plugin/popup.html index 14dd1d0f..de0d40ed 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -600,6 +600,7 @@

Instructions

+