Skip to content

Commit

Permalink
fix #522
Browse files Browse the repository at this point in the history
  • Loading branch information
ldm0206 committed Dec 24, 2024
1 parent 90c4aa7 commit 3e5c28c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
],
"incompatible": ["Internet Explorer"],
"match": [
"*://czbooks.net/n/*",
"*://book.qq.com/book-detail/*",
"*://fanqienovel.com/page/*",
"*://book.sfacg.com/Novel/*/MainIndex/",
Expand Down
5 changes: 5 additions & 0 deletions src/router/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ export async function getRule(): Promise<BaseRuleClass> {
ruleClass = QQBook;
break;
}
case "czbooks.net": {
const { czbooks } = await import("../rules/onePage/czbooks");
ruleClass = czbooks();
break;
}
case "www.xiaoshuowu.com": {
const { xiaoshuowu } = await import("../rules/twoPage/xiaoshuowu");
ruleClass = xiaoshuowu();
Expand Down
22 changes: 22 additions & 0 deletions src/rules/onePage/czbooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { mkRuleClass } from "./template";

export const czbooks = () =>
mkRuleClass({
bookUrl: document.location.href,
bookname: (
document.querySelector("div.info > span.title") as HTMLElement
).innerText.trim(),
author: (
document.querySelector(
"div.info > span.author"
) as HTMLElement
).innerText.trim(),
introDom: document.querySelector("div.description") as HTMLElement,
introDomPatch: (dom) => dom,
coverUrl: (document.querySelector("div.novel-detail .thumbnail > img") as HTMLImageElement).src,
aList: document.querySelectorAll("#chapter-list li > a"),
sections: document.querySelectorAll("#chapter-list li.volume"),
getSName: (dom) => (dom as HTMLElement).innerText.trim(),
getContent: (doc) => doc.querySelector("div.content") as HTMLElement,
contentPatch: (dom) => dom,
});

0 comments on commit 3e5c28c

Please sign in to comment.