score
This commit is contained in:
13
index.html
13
index.html
@@ -1,13 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
/>
|
||||
<title>jop</title>
|
||||
<!-- /index.html 必须存在, 否则 vite 无法注入 hmr 代码, plugin-monkey 以及其他插件 也无法注入相关辅助代码 -->
|
||||
<!-- /index.html must exist, if not, vite will not inject hmr code, plugin-monkey and others will not inject theirs related auxiliary code -->
|
||||
</head>
|
||||
</html>
|
||||
@@ -13,7 +13,7 @@
|
||||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.4.0",
|
||||
"typescript": "^4.8.4",
|
||||
"vite": "^3.1.4",
|
||||
"vite-plugin-monkey": "^2.5.1"
|
||||
"vite": "^3.1.7",
|
||||
"vite-plugin-monkey": "^2.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
55
pnpm-lock.yaml
generated
55
pnpm-lock.yaml
generated
@@ -5,7 +5,7 @@ specifiers:
|
||||
preact: 10.11.0
|
||||
typescript: ^4.8.4
|
||||
vite: ^3.1.7
|
||||
vite-plugin-monkey: ^2.7.0
|
||||
vite-plugin-monkey: ^2.7.2
|
||||
|
||||
dependencies:
|
||||
preact: 10.11.0
|
||||
@@ -14,7 +14,7 @@ devDependencies:
|
||||
'@preact/preset-vite': 2.4.0_preact@10.11.0+vite@3.1.7
|
||||
typescript: 4.8.4
|
||||
vite: 3.1.7
|
||||
vite-plugin-monkey: 2.7.0_vite@3.1.7
|
||||
vite-plugin-monkey: 2.7.2_vite@3.1.7
|
||||
|
||||
packages:
|
||||
|
||||
@@ -402,14 +402,14 @@ packages:
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001418
|
||||
electron-to-chromium: 1.4.276
|
||||
caniuse-lite: 1.0.30001419
|
||||
electron-to-chromium: 1.4.281
|
||||
node-releases: 2.0.6
|
||||
update-browserslist-db: 1.0.10_browserslist@4.21.4
|
||||
dev: true
|
||||
|
||||
/caniuse-lite/1.0.30001418:
|
||||
resolution: {integrity: sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg==}
|
||||
/caniuse-lite/1.0.30001419:
|
||||
resolution: {integrity: sha512-aFO1r+g6R7TW+PNQxKzjITwLOyDhVRLjW0LcwS/HCZGUUKTGNp9+IwLC4xyDSZBygVL/mxaFR3HIV6wEKQuSzw==}
|
||||
dev: true
|
||||
|
||||
/chalk/2.4.2:
|
||||
@@ -498,8 +498,8 @@ packages:
|
||||
domhandler: 5.0.3
|
||||
dev: true
|
||||
|
||||
/electron-to-chromium/1.4.276:
|
||||
resolution: {integrity: sha512-EpuHPqu8YhonqLBXHoU6hDJCD98FCe6KDoet3/gY1qsQ6usjJoHqBH2YIVs8FXaAtHwVL8Uqa/fsYao/vq9VWQ==}
|
||||
/electron-to-chromium/1.4.281:
|
||||
resolution: {integrity: sha512-yer0w5wCYdFoZytfmbNhwiGI/3cW06+RV7E23ln4490DVMxs7PvYpbsrSmAiBn/V6gode8wvJlST2YfWgvzWIg==}
|
||||
dev: true
|
||||
|
||||
/entities/4.4.0:
|
||||
@@ -832,18 +832,6 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/node-fetch/2.6.7:
|
||||
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
peerDependencies:
|
||||
encoding: ^0.1.0
|
||||
peerDependenciesMeta:
|
||||
encoding:
|
||||
optional: true
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
dev: true
|
||||
|
||||
/node-releases/2.0.6:
|
||||
resolution: {integrity: sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==}
|
||||
dev: true
|
||||
@@ -875,8 +863,8 @@ packages:
|
||||
engines: {node: '>=8.6'}
|
||||
dev: true
|
||||
|
||||
/postcss/8.4.17:
|
||||
resolution: {integrity: sha512-UNxNOLQydcOFi41yHNMcKRZ39NeXlr8AxGuZJsdub8vIb12fHzcq37DTU/QtbI6WLxNg2gF9Z+8qtRwTj1UI1Q==}
|
||||
/postcss/8.4.18:
|
||||
resolution: {integrity: sha512-Wi8mWhncLJm11GATDaQKobXSNEYGUHeQLiQqDFG1qQ5UTDPTEvKw0Xt5NsTpktGTwLps3ByrWsBrG0rB8YQ9oA==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.4
|
||||
@@ -943,10 +931,6 @@ packages:
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/tr46/0.0.3:
|
||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||
dev: true
|
||||
|
||||
/typescript/4.8.4:
|
||||
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
@@ -964,8 +948,8 @@ packages:
|
||||
picocolors: 1.0.0
|
||||
dev: true
|
||||
|
||||
/vite-plugin-monkey/2.7.0_vite@3.1.7:
|
||||
resolution: {integrity: sha512-jHYKW+L0twUyIork10EMtxBfkTWMHBs2uPF4SWm35haT8HIHzdcioclMOf+1ByBRHLEr47LQR8bJj7o7uSJfbQ==}
|
||||
/vite-plugin-monkey/2.7.2_vite@3.1.7:
|
||||
resolution: {integrity: sha512-/dwLK+w6txpDI1vozNJT0aOAGaoBsR0wPji86qbBJKlbKvr9wekhxOMgJls50e4utZpxVag30X7yxQx4bIEM0Q==}
|
||||
engines: {node: ^14.18 || >= 16, pnpm: '>=6'}
|
||||
peerDependencies:
|
||||
vite: ^2.0.0 || ^3.0.0
|
||||
@@ -974,12 +958,10 @@ packages:
|
||||
detect-port: 1.5.1
|
||||
htmlparser2: 8.0.1
|
||||
mrmime: 1.0.1
|
||||
node-fetch: 2.6.7
|
||||
open: 8.4.0
|
||||
picocolors: 1.0.0
|
||||
vite: 3.1.7
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
@@ -1003,24 +985,13 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
esbuild: 0.15.10
|
||||
postcss: 8.4.17
|
||||
postcss: 8.4.18
|
||||
resolve: 1.22.1
|
||||
rollup: 2.78.1
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/webidl-conversions/3.0.1:
|
||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||
dev: true
|
||||
|
||||
/whatwg-url/5.0.0:
|
||||
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
||||
dependencies:
|
||||
tr46: 0.0.3
|
||||
webidl-conversions: 3.0.1
|
||||
dev: true
|
||||
|
||||
/which/2.0.2:
|
||||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { memo } from "preact/compat";
|
||||
/** 从原 info panel 抄一点精简的信息 */
|
||||
export type Infos = {
|
||||
codeText?: string;
|
||||
score?: string;
|
||||
actorList: {
|
||||
text: string;
|
||||
link: string;
|
||||
@@ -11,34 +12,36 @@ export type Infos = {
|
||||
};
|
||||
|
||||
const Info = memo(({ infos }: { infos: Infos }) => {
|
||||
const { codeText, score, actorList } = infos;
|
||||
return (
|
||||
<div className="jop-info">
|
||||
<span
|
||||
className="jop-info-code"
|
||||
title="点击复制"
|
||||
onClick={() => infos.codeText && navigator.clipboard.writeText(infos.codeText)}
|
||||
onClick={() => codeText && navigator.clipboard.writeText(codeText)}
|
||||
>
|
||||
{infos.codeText ? infos.codeText : "暂无"}
|
||||
{codeText ? codeText : "暂无"}
|
||||
</span>
|
||||
|
||||
<div class="jop-info-actor">
|
||||
{infos.actorList.length !== 0 ? (
|
||||
<>
|
||||
<a
|
||||
class="jop-info-actor-item"
|
||||
target="_blank"
|
||||
href={infos.actorList[0].link}
|
||||
>
|
||||
{infos.actorList[0].text}
|
||||
</a>
|
||||
<span> 等</span>
|
||||
</>
|
||||
) : (
|
||||
<div>无演员信息</div>
|
||||
)}
|
||||
<div className="jop-info-more">
|
||||
<span className="jop-info-actor-item">
|
||||
{actorList.length !== 0 ? (
|
||||
<>
|
||||
<a
|
||||
className=" jop-tag"
|
||||
target="_blank"
|
||||
href={actorList[0].link}
|
||||
>
|
||||
{actorList[0].text}
|
||||
</a>
|
||||
<span> 等</span>
|
||||
</>
|
||||
) : (
|
||||
<div>无演员信息</div>
|
||||
)}
|
||||
</span>
|
||||
{score && <span className="jop-tag">{score} 分</span>}
|
||||
</div>
|
||||
|
||||
{/* {info.actorList.map((item, index) => { const length = info.actorList.length; return ( <a href={item.link} style={{ paddingRight: length !== 1 && index !== length - 1 ? 16 : 0 }} > {item.text} </a> ); })} */}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
1
src/components/ListSetting.tsx
Normal file
1
src/components/ListSetting.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export const fname = () => {};
|
||||
@@ -9,10 +9,10 @@ import App from "./components/App";
|
||||
// !debugger 图片关
|
||||
// document.querySelectorAll("img").forEach((item) => (item.style.display = "none"));
|
||||
|
||||
function main() {
|
||||
async function main() {
|
||||
/** 当前 macth 站点对象 */
|
||||
const cms = matchList.find((item) => item.href.test(window.location.href)) as Cms;
|
||||
const infos = getInfos(cms);
|
||||
const infos = await getInfos(cms);
|
||||
const CODE = infos.codeText;
|
||||
if (CODE === undefined) return;
|
||||
cms.method();
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
background-color: white;
|
||||
/* box-shadow: rgb(0 0 0 / 26%) -3px 0px 8px; */
|
||||
transition: right 200ms ease-in-out;
|
||||
font-family: Roboto, Helvetica, Arial, sans-serif;
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* */
|
||||
@@ -64,9 +66,7 @@
|
||||
}
|
||||
/* */
|
||||
.jop-info {
|
||||
color: black;
|
||||
/* text-align: right; */
|
||||
height: 30px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.jop-info-code {
|
||||
margin-bottom: 20px;
|
||||
@@ -77,28 +77,25 @@
|
||||
font-weight: bolder;
|
||||
font-style: italic;
|
||||
}
|
||||
.jop-info-actor {
|
||||
margin-top: 6px;
|
||||
.jop-info-more {
|
||||
margin: 14px 0;
|
||||
}
|
||||
.jop-info-actor-item {
|
||||
padding: 3px 6px;
|
||||
color: #409eff;
|
||||
background: #ecf5ff;
|
||||
border: 1px solid #d9ecff;
|
||||
border-radius: 4px;
|
||||
margin-right: 13px;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
.jop-list {
|
||||
position: absolute;
|
||||
top: 115px;
|
||||
width: 80%;
|
||||
/* position: absolute; */
|
||||
/* top: 115px; */
|
||||
width: 85%;
|
||||
min-width: 226px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
gap: 12px;
|
||||
gap: 6px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.jop-button {
|
||||
@@ -110,7 +107,6 @@
|
||||
/* min-width: 50px; */
|
||||
padding: 3px 10px;
|
||||
border-radius: 4px;
|
||||
font-family: Roboto, Helvetica, Arial, sans-serif;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
border: 1px solid #dcdfe6;
|
||||
@@ -177,3 +173,12 @@
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
.jop-tag {
|
||||
padding: 3px 6px;
|
||||
color: #409eff;
|
||||
background: #ecf5ff;
|
||||
border: 1px solid #d9ecff;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getDbScore } from "@/utils/xhr";
|
||||
import { parserJavdb } from "@/utils/xhr";
|
||||
import { Infos } from "@/components/Info";
|
||||
import { Cms } from "./matchList";
|
||||
|
||||
export function getInfos(cms: Cms): Infos {
|
||||
export async function getInfos(cms: Cms): Promise<Infos> {
|
||||
const { codeQueryStr, actorQueryStr } = cms.querys;
|
||||
const codeNode = document.querySelector<HTMLElement>(codeQueryStr);
|
||||
const actorNodeList = document.querySelectorAll<HTMLAnchorElement>(actorQueryStr);
|
||||
@@ -10,14 +10,16 @@ export function getInfos(cms: Cms): Infos {
|
||||
return { text: item.innerHTML, link: item.href };
|
||||
});
|
||||
|
||||
// !todo 需要写一个 jdb parser ,来填下面的 url
|
||||
const score = getDbScore("https://javdb.com/v/RwRw4");
|
||||
const codeText =
|
||||
cms.name === "javdb"
|
||||
? (codeNode?.dataset.clipboardText as string)
|
||||
: codeNode?.innerText.replace("复制", "");
|
||||
|
||||
const { score, release } = await parserJavdb(codeText);
|
||||
console.log("| ", score, release);
|
||||
return {
|
||||
codeText:
|
||||
cms.name === "javdb"
|
||||
? (codeNode?.dataset.clipboardText as string)
|
||||
: codeNode?.innerText.replace("复制", ""),
|
||||
codeText,
|
||||
actorList,
|
||||
score,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,7 +123,9 @@ async function xhr(siteItem: SiteItem, targetLink: string, CODE: string) {
|
||||
return xhrPromise;
|
||||
}
|
||||
|
||||
/** 获取 javdb 的分数 */
|
||||
/** 获取 javdb 的分数
|
||||
* 没用了,白写
|
||||
*/
|
||||
export function getDbScore(url: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
GM_xmlhttpRequest({
|
||||
@@ -148,4 +150,40 @@ export function getDbScore(url: string): Promise<string> {
|
||||
});
|
||||
}
|
||||
|
||||
interface dbResult {
|
||||
score: string;
|
||||
release: string;
|
||||
}
|
||||
export function parserJavdb(code?: string): Promise<dbResult> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!code) reject("没找到");
|
||||
GM_xmlhttpRequest({
|
||||
url: `https://javdb005.com/search?q=${code}`,
|
||||
method: "GET",
|
||||
onload: (response) => {
|
||||
const doc = new DOMParser().parseFromString(response.responseText, "text/html");
|
||||
const firstItem = doc.querySelectorAll<HTMLElement>(`.movie-list>.item`)[0];
|
||||
const titleString = firstItem.querySelector<HTMLElement>(`.video-title>strong`)?.innerHTML;
|
||||
const releaseString = firstItem.querySelector<HTMLElement>(`.meta`)?.innerHTML.trim();
|
||||
|
||||
if (titleString !== code || !releaseString) {
|
||||
reject("没找到");
|
||||
} else {
|
||||
const fullScoreText = firstItem.querySelector<HTMLElement>(`.score .value`)?.innerHTML;
|
||||
const matchResult = fullScoreText?.match(/\d\.\d分/);
|
||||
if (!matchResult) reject("没找到");
|
||||
else
|
||||
resolve({
|
||||
// score: matchResult[0],
|
||||
score: matchResult[0].replace("分", ""),
|
||||
release: releaseString,
|
||||
});
|
||||
}
|
||||
},
|
||||
onerror(error) {
|
||||
reject(error);
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
export default xhr;
|
||||
|
||||
@@ -3,7 +3,7 @@ import monkey, { cdn, MonkeyUserScript } from "vite-plugin-monkey";
|
||||
import preact from "@preact/preset-vite";
|
||||
|
||||
import { siteList } from "./src/utils/siteList";
|
||||
const connectList = siteList.map((site) => site.hostname);
|
||||
const connectList = siteList.map((site) => site.hostname).concat("javdb005.com");
|
||||
|
||||
const UserscriptConfig: MonkeyUserScript = {
|
||||
author: "mission522",
|
||||
|
||||
Reference in New Issue
Block a user