support fc2
This commit is contained in:
58
src/main.tsx
58
src/main.tsx
@@ -1,30 +1,28 @@
|
||||
import { render } from "preact";
|
||||
import { Current, matchList } from "@/utils/matchList";
|
||||
import { getCode } from "@/utils/getCode";
|
||||
|
||||
import "@/style.css";
|
||||
import App from "./components/App";
|
||||
|
||||
// !debugger 图片关
|
||||
// document.querySelectorAll("img").forEach((item) => (item.style.display = "none"));
|
||||
|
||||
function main() {
|
||||
/** 当前 macth 站点对象 */
|
||||
const current = matchList.find((item) => item.href.test(window.location.href)) as Current;
|
||||
|
||||
const CODE = getCode(current);
|
||||
if (CODE === undefined) return;
|
||||
|
||||
current.method();
|
||||
|
||||
const panel = document.querySelector<HTMLElement>(current.querys.panelQueryStr);
|
||||
if (panel === null) return;
|
||||
|
||||
const app = document.createElement("div");
|
||||
app.classList.add("jop-app");
|
||||
panel.append(app);
|
||||
|
||||
render(<App current={current} CODE={CODE} />, app);
|
||||
}
|
||||
|
||||
main();
|
||||
import { render } from "preact";
|
||||
import { Current, matchList } from "@/utils/matchList";
|
||||
import { getCode } from "@/utils/getCode";
|
||||
|
||||
import "@/style.css";
|
||||
import App from "./components/App";
|
||||
|
||||
// !debugger 图片关
|
||||
// document.querySelectorAll("img").forEach((item) => (item.style.display = "none"));
|
||||
|
||||
function main() {
|
||||
/** 当前 macth 站点对象 */
|
||||
const current = matchList.find((item) => item.href.test(window.location.href)) as Current;
|
||||
|
||||
const CODE = getCode(current);
|
||||
current.method();
|
||||
|
||||
const panel = document.querySelector<HTMLElement>(current.querys.panelQueryStr);
|
||||
if (panel === null) return;
|
||||
|
||||
const app = document.createElement("div");
|
||||
app.classList.add("jop-app");
|
||||
panel.append(app);
|
||||
|
||||
render(<App current={current} CODE={CODE} />, app);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { Current } from "./matchList";
|
||||
|
||||
export function getCode(cms: Current): string | undefined {
|
||||
const { codeQueryStr } = cms.querys;
|
||||
const codeNode = document.querySelector<HTMLElement>(codeQueryStr);
|
||||
|
||||
const codeText =
|
||||
cms.name === "javdb"
|
||||
? (codeNode?.dataset.clipboardText as string)
|
||||
: codeNode?.innerText.replace("复制", "");
|
||||
|
||||
return codeText;
|
||||
}
|
||||
import { Current } from "./matchList";
|
||||
|
||||
export function getCode(cms: Current): string {
|
||||
const { codeQueryStr } = cms.querys;
|
||||
const codeNode = document.querySelector<HTMLElement>(codeQueryStr);
|
||||
if (!codeNode) return "";
|
||||
|
||||
const codeText =
|
||||
cms.name === "javdb"
|
||||
? (codeNode.dataset.clipboardText as string)
|
||||
: codeNode.innerText.replace("复制", "");
|
||||
|
||||
if (codeText?.includes("FC2")) return codeText.split("-")[1];
|
||||
|
||||
return codeText;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user