diff --git a/plugin/js/parsers/MvlempyrParser.js b/plugin/js/parsers/MvlempyrParser.js new file mode 100644 index 00000000..918ced5f --- /dev/null +++ b/plugin/js/parsers/MvlempyrParser.js @@ -0,0 +1,54 @@ +"use strict"; + +parserFactory.register("mvlempyr.com", () => new MvlempyrParser()); + +class MvlempyrParser extends Parser { + constructor() { + super(); + } + + async getChapterUrls(dom) { + let imgLink = dom.querySelector("div.novel-image-wrapper img").src; + let slug = imgLink.split("/").pop().split(".")[0]; + let chapterCount = parseInt(dom.querySelector("div#chapter-count").textContent); + + let chapterList = []; + + for (let i = 1; i <= chapterCount; i++) { + let link = `https://www.mvlempyr.com/chapter/${slug}-${i}`; + chapterList.push({ + sourceUrl: link, + title: `Chapter ${i}` + }); + } + return chapterList; + } + + findContent(dom) { + return ( + dom.querySelector("div#chapter") || dom.querySelector("#chapter-content") + ); + } + + extractTitleImpl(dom) { + return dom.querySelector("h1.novel-title"); + } + + extractAuthor(dom) { + let authorLabel = dom.querySelector("div.novelinfo .text-block-9"); + return authorLabel?.textContent ?? super.extractAuthor(dom); + } + + findChapterTitle(dom) { + return dom.querySelector("#span-28-164").textContent; + } + + findCoverImageUrl(dom) { + return util.getFirstImgSrc(dom, "div.novel-image-wrapper"); + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll("div.synopsis")]; + } + +} \ No newline at end of file diff --git a/plugin/popup.html b/plugin/popup.html index 4cc29c19..d1d1bf3b 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -666,6 +666,7 @@