Skip to content

Commit

Permalink
fix Kanunu8
Browse files Browse the repository at this point in the history
  • Loading branch information
ldm0206 committed Dec 27, 2024
1 parent c2b8f39 commit b48686e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/rules/special/reprint/kanunu8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,28 @@ export class Kanunu8 extends BaseRuleClass {
let getName: ((sElem: Element) => string) | null = null;

function aListFilter(a: Element) {
const filters = ["writer", "/zj/", "index.html"];
for (const f of filters) {
const filters1 = ["writer", "/zj/", "index.html"]; //不能包含
const filters2 = [".html"]; // 必须包含的
for (const f of filters1) {
if ((a as HTMLAnchorElement).href.includes(f)) {
return false;
}
}
for (const f of filters2) {
if ((a as HTMLAnchorElement).href.includes(f) == false) {
return false;
}
}
return true;
}

if (document.querySelector("div.book")) {
if (document.querySelector(".mulu-list ul > li > a")) {
aList = Array.from(document.querySelectorAll(".mulu-list ul > li > a")).filter(
aListFilter
);
sections = document.querySelectorAll(".mulu-title > h2");
getName = (sElem: Element) => (sElem as HTMLElement).innerText;
}
else if (document.querySelector("div.book")) {
aList = Array.from(document.querySelectorAll("div.book a")).filter(
aListFilter
);
Expand Down

0 comments on commit b48686e

Please sign in to comment.