Skip to content

Commit

Permalink
Merge pull request #1625 from ImLJS/beta
Browse files Browse the repository at this point in the history
Add Site truyennhabo
  • Loading branch information
ImLJS authored Jan 11, 2025
2 parents 614b1c2 + dbddbc0 commit 706938d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
61 changes: 61 additions & 0 deletions plugin/js/parsers/TruyenParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use strict";

parserFactory.register("truyennhabo.com", () => new TruyenParser());

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

async getChapterUrls(dom) {
const chapterLinks = [...dom.querySelectorAll("#clwd ul a")]
const chapterTitles = [...dom.querySelectorAll("#clwd span.block")]
const chapterUrls = [];
for (let i = 0; i < chapterLinks.length; i++) {
const chapterLink = chapterLinks[i];
const chapterTitle = chapterTitles[i];
chapterUrls.push({
sourceUrl: chapterLink.href,
title: chapterTitle.textContent,
});
};
return chapterUrls.reverse();
}

findContent(dom) {
return (
dom.querySelector("article.blog")
);
}

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

extractAuthor(dom) {
let authorLabel = dom.querySelector("#extra-info dd");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}

findChapterTitle(dom) {
return dom.querySelector("header h1");
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "div.auto-rows-max");
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("div#synopsis")];
}

removeUnwantedElementsFromContentElement(element) {
let mark = element.querySelector("a");
mark.remove();
super.removeUnwantedElementsFromContentElement(element);
}

}



1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ <h3>Instructions</h3>
<script src="js/parsers/TravistranslationsParser.js"></script>
<script src="js/parsers/TruyenfullParser.js"></script>
<script src="js/parsers/TruyenyyParser.js"></script>
<script src="js/parsers/TruyenParser.js"></script>
<script src="js/parsers/TrxsParser.js"></script>
<script src="js/parsers/TumblrParser.js"></script>
<script src="js/parsers/UltimaguilParser.js"></script>
Expand Down

0 comments on commit 706938d

Please sign in to comment.