From dfca832641f664461df7cb10f6391dcde4866cd0 Mon Sep 17 00:00:00 2001 From: Leone Jacob Sunil <109210868+ImLJS@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:25:06 +0530 Subject: [PATCH] Add Site www.cyborg-tl.com --- plugin/js/parsers/CyborgParser.js | 49 +++++++++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 50 insertions(+) create mode 100644 plugin/js/parsers/CyborgParser.js diff --git a/plugin/js/parsers/CyborgParser.js b/plugin/js/parsers/CyborgParser.js new file mode 100644 index 00000000..037bc8aa --- /dev/null +++ b/plugin/js/parsers/CyborgParser.js @@ -0,0 +1,49 @@ +"use strict"; + +parserFactory.register("cyborg-tl.com", function () {return new CyborgParser();}); + +class CyborgParser extends Parser { + constructor() { + super(); + } + + async getChapterUrls(dom) { + return ([...dom.querySelectorAll("div.lightnovel-episode a")] + .map(link => ({ + sourceUrl: link.href, + title: link.title, + }))).reverse(); + } + + findContent(dom) { + return ( + dom.querySelector(".entry-content") || dom.querySelector("#chapter-content") + ); + } + + extractTitleImpl(dom) { + return dom.querySelector(".entry-title"); + } + + findChapterTitle(dom) { + return dom.querySelector("strong"); + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, "div.lightnovel-thumb"); + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll("div.lightnovel-synopsis")]; + } + + removeUnwantedElementsFromContentElement(element) { + let mark = [...element.querySelectorAll("#hpk")]; + mark[0].nextElementSibling.remove(); + mark[0].remove() + super.removeUnwantedElementsFromContentElement(element); + } +} + + + diff --git a/plugin/popup.html b/plugin/popup.html index 2c379208..c303e1ad 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -550,6 +550,7 @@

Instructions

+