diff --git a/plugin/js/parsers/4kswParser.js b/plugin/js/parsers/4kswParser.js new file mode 100644 index 00000000..41a1917a --- /dev/null +++ b/plugin/js/parsers/4kswParser.js @@ -0,0 +1,35 @@ +"use strict"; + +parserFactory.register("4ksw.com", () => new _4kswParser()); + +class _4kswParser extends Parser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + let menu = dom.querySelector("ul.list-charts"); + return util.hyperlinksToChapterList(menu); + } + + findContent(dom) { + return dom.querySelector(".content-body"); + } + + findChapterTitle(dom) { + return dom.querySelector(".panel-heading").textContent; + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, ".info1"); + } + + async fetchChapter(url) { + let options = { makeTextDecoder: () => new TextDecoder("gbk") }; + return (await HttpClient.wrapFetch(url, options)).responseXML; + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll(".info2 div")]; + } +} diff --git a/plugin/popup.html b/plugin/popup.html index a2bedec7..79dbc403 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -524,6 +524,7 @@

Instructions

+