Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
See: #1100
  • Loading branch information
dteviot committed Dec 8, 2023
1 parent c03866c commit bd79630
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions plugin/js/parsers/TimotxtParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict";

parserFactory.register("timotxt.com", () => new TimotxtParser());

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

async getChapterUrls(dom) {
let tocUrl = dom.baseURI + "dir";
let tocDom = (await HttpClient.fetchHtml(tocUrl)).responseXML;
let menu = tocDom.querySelector("ul.all");
return util.hyperlinksToChapterList(menu);
}

findContent(dom) {
return dom.querySelector(".chapter-content");
}

extractTitleImpl(dom) {
return dom.querySelector("h1");
}

extractAuthor(dom) {
return dom.querySelector("#detail span.author")?.textContent ?? super.extractAuthor(dom);
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "#detail");
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll(".intro")];
}
}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ <h3>Instructions</h3>
<script src="js/parsers/TeenficParser.js"></script>
<script src="js/parsers/Taffygirl13Parser.js"></script>
<script src="js/parsers/TigertranslationsParser.js"></script>
<script src="js/parsers/TimotxtParser.js"></script>
<script src="js/parsers/TomotranslationsParser.js"></script>
<script src="js/parsers/TravistranslationsParser.js"></script>
<script src="js/parsers/TruyenfullParser.js"></script>
Expand Down

0 comments on commit bd79630

Please sign in to comment.