Skip to content

Commit

Permalink
Merge pull request #1507 from gamebeaker/Add-book18.org
Browse files Browse the repository at this point in the history
Add Book18Parser
  • Loading branch information
gamebeaker authored Sep 24, 2024
2 parents 46c2512 + 3d646d2 commit 97d5b69
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ eslint/*.zip
eslint/packed.js
eslint/index.csv
node_modules
plugin/**/*.*
!plugin/jszip/dist/jszip.min.js
plugin/jszip/dist/jszip.min.js
29 changes: 29 additions & 0 deletions plugin/js/parsers/Book18Parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Parses files on www.book18.org
*/
"use strict";

parserFactory.register("book18.org", () => new Book18Parser());

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

async getChapterUrls(dom) {
let menu = dom.querySelector(".list-group");
return util.hyperlinksToChapterList(menu);
}

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

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

removeUnwantedElementsFromContentElement(element) {
util.removeChildElementsMatchingCss(element, "span.d-none");
}
}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ <h3>Instructions</h3>
<script src="js/parsers/BakaTsukiSeriesPageParser.js"></script>
<script src="js/parsers/BetwixtedbutterflyParser.js"></script>
<script src="js/parsers/BlogspotParser.js"></script>
<script src="js/parsers/Book18Parser.js"></script>
<script src="js/parsers/BookswithqianyaParser.js"></script>
<script src="js/parsers/Booktoki152Parser.js"></script>
<script src="js/parsers/BotitranslationParser.js"></script>
Expand Down

0 comments on commit 97d5b69

Please sign in to comment.