Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
See: #1175
  • Loading branch information
dteviot committed Jan 23, 2024
1 parent 19d9a8a commit 6b4934e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
30 changes: 30 additions & 0 deletions plugin/js/parsers/MidnightramblesParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict";

parserFactory.register("midnightrambles.in", () => new MidnightramblesParser());

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

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

findContent(dom) {
return dom.querySelector(".amp-wp-article-content");
}

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

findChapterTitle(dom) {
return dom.querySelector(".amp-wp-title");
}

findCoverImageUrl(dom) {
return dom.querySelector(".amp-wp-article-content amp-img")?.getAttribute("src") ?? null;
}
}
4 changes: 2 additions & 2 deletions plugin/js/parsers/Template.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class TemplateParser extends Parser{
// Major points to note
// 1. Return the Author's name as a string, not a HTML element
// 2. If can't find Author, call the base implementation
let authorLabel = util.getElement(dom, "strong", e => e.textContent === "Author:");
return (authorLabel === null) ? super.extractAuthor(dom) : authorLabel.nextElementSibling.textContent;
let authorLabel = dom.querySelector(".meta span a");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}
*/

Expand Down
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ <h3>Instructions</h3>
<script src="js/parsers/MeionovelParser.js"></script>
<script src="js/parsers/MetanovelParser.js"></script>
<script src="js/parsers/MMyWwuxiaWorldParser.js"></script>
<script src="js/parsers/MidnightramblesParser.js"></script>
<script src="js/parsers/MtledNovelsParser.js"></script>
<script src="js/parsers/MtlnationParser.js"></script>
<script src="js/parsers/MtlnovelParser.js"></script>
Expand Down

0 comments on commit 6b4934e

Please sign in to comment.