Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
See: #1038
  • Loading branch information
dteviot committed Oct 28, 2023
1 parent 8b1d306 commit 55e030d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions plugin/js/parsers/ShubaowbParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"use strict";

parserFactory.register("shubaowb.com", () => new ShubaowbParser());

class ShubaowbParser extends Parser{
constructor() {
super();
}

async getChapterUrls(dom, chapterUrlsUI) {
let urlsOfTocPages = this.getUrlsOfTocPages(dom);
return (await this.getChaptersFromAllTocPages([],
this.chaptersFromDom,
urlsOfTocPages,
chapterUrlsUI
));
}

chaptersFromDom(dom) {
return [...dom.querySelectorAll(".book_last dd a")]
.map(a => util.hyperLinkToChapter(a));
}

getUrlsOfTocPages(dom) {
let optionToUrl = (o) => {
let v = o.value;
if (!v.startsWith("/novel")) {
v = "/novel" + v;
}
return "https://shubaowb.com" + v;
}

let listpage = dom.querySelector(".listpage");
return [...listpage.querySelectorAll("option")]
.map(optionToUrl);
}

findContent(dom) {
return dom.querySelector("#chaptercontent");
}

extractTitleImpl(dom) {
return dom.querySelector("span.title1");
}

findChapterTitle(dom) {
return dom.querySelector("span.title1");
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll(".book_about")];
}
}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ <h3>Instructions</h3>
<script src="js/parsers/ShinsoriParser.js"></script>
<script src="js/parsers/ShintranslationsParser.js"></script>
<script src="js/parsers/ShirokunsParser.js"></script>
<script src="js/parsers/ShubaowbParser.js"></script>
<script src="js/parsers/ShubaowParser.js"></script>
<script src="js/parsers/SitesGoogleParser.js"></script>
<script src="js/parsers/Sjks88Parser.js"></script>
Expand Down

0 comments on commit 55e030d

Please sign in to comment.