Skip to content

Commit

Permalink
fix #90
Browse files Browse the repository at this point in the history
  • Loading branch information
ldm0206 committed Dec 26, 2024
1 parent 6b05358 commit 169dc98
Show file tree
Hide file tree
Showing 3 changed files with 43 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 @@ -23,6 +23,7 @@
"incompatible": ["Internet Explorer"],
"match": [
"*://www.po18.tw/books/*",
"*://b.faloo.com/*",
"*://www.uaa.com/novel/intro?id=*",
"*://www.lzdzw.com/*/*.html",
"*://novelpia.jp/novel/*",
Expand Down
5 changes: 5 additions & 0 deletions src/router/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,11 @@ export async function getRule(): Promise<BaseRuleClass> {
ruleClass = po18;
break;
}
case "b.faloo.com": {
const { faloo } = await import("../rules/onePage/original/faloo");
ruleClass = faloo();
break;
}
case "novelpia.jp": {
const { novelpia } = await import("../rules/special/original/novelpia");
ruleClass = novelpia;
Expand Down
37 changes: 37 additions & 0 deletions src/rules/onePage/original/faloo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { insertBrBeforeText, rm } from "../../../lib/dom";
import { mkRuleClass } from "../template";

export const faloo = () =>
mkRuleClass({
bookUrl: document.location.href,
bookname: (
document.querySelector("h1#novelName") as HTMLElement
).innerText.trim(),
author: (
document.querySelector(
"img.rentouOne"
) as HTMLAnchorElement
).innerText.trim(),
introDom: document.querySelector("div.T-L-T-C-Box1") as HTMLDivElement,
introDomPatch: (dom) => dom,
coverUrl:
(document.querySelector("img.imgcss") as HTMLImageElement)
?.src ?? null,
additionalMetadatePatch: (additionalMetadate) => {
additionalMetadate.tags = Array.from(
document.querySelectorAll("div.T-R-T-B2-Box1 a")
).map((a) => (a as HTMLAnchorElement).innerText.trim());
return additionalMetadate;
},
aList: document.querySelectorAll("div.C-Fo-Zuo div.DivTable a"),
getAName: (aElem) =>
(aElem as HTMLElement)?.innerText.trim(),
sections: document.querySelectorAll("div.C-Fo-Zuo h3 a"),
getSName: (sElem) => (sElem as HTMLElement).innerText.trim(),
getContent: (doc) => doc.querySelector("div.noveContent"),
contentPatch: (content) => {
rm("b",true,content);
return content;
},
language: "zh",
});

0 comments on commit 169dc98

Please sign in to comment.