feat: upadte sitelist

This commit is contained in:
mrbunker
2024-06-23 00:01:19 +08:00
parent 274245f8ff
commit de2ab8f506
8 changed files with 831 additions and 711 deletions

2
dist/jop.user.js vendored
View File

@@ -52,7 +52,7 @@
const t = document.createElement("style");
(t.textContent = o), document.head.append(t);
})(
" .jop-list{box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:10px;width:100%;height:100%;z-index:1;background-color:#fff;transition:right .2s ease-in-out;font-family:Roboto,Helvetica,Arial,sans-serif;color:#000}.jop-button,.jop-button_def{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:3px 10px;border-radius:4px;font-weight:500;font-size:14px;border:1px solid #dcdfe6;color:#606266;cursor:pointer}.jop-button_def{margin:10px 0;width:100px}.jop-button:visited{color:#606266}.jop-button:hover{text-decoration:none;color:#409eff;border:1px solid #c6e2ff;background-color:#ecf5ff}.jop-button_label{position:absolute;font-size:10px;padding:4px;border-radius:4px;top:-13px;right:-10px;line-height:.75;color:#67c23a;border:1px solid #e1f3d8;background:white}.jop-button_green{color:#fff!important;background-color:#67c23a}.jop-button_green:hover{color:#fff!important;background-color:#95d475}.jop-button_red{color:#fff!important;background-color:#f56c6c}.jop-button_red:hover{color:#fff!important;background-color:#f89898}.jop-loading{display:inline-block;width:14px;height:14px;margin-right:10px;border:2px dashed #dcdfe6;border-top-color:transparent;border-radius:100%;animation:btnLoading infinite 1s linear}@keyframes btnLoading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.jop-tag{padding:3px 6px;color:#409eff!important;background:#ecf5ff;border:1px solid #d9ecff;border-radius:4px}.jop-setting-list{display:flex;flex-wrap:wrap;background-color:#fff}.jop-setting-title{margin:10px 0 5px}.jop-setting-item{display:flex;height:20px;justify-content:center;align-items:center;margin-right:15px;-webkit-user-select:none;user-select:none;cursor:pointer}.db-panel .movie-panel-info div.panel-block{padding:5.5px 12px}.db-panel .jop-app{padding:15px 12px}.lib-panel .jop-app{padding:20px 30px;margin-top:10px}input[type=checkbox],input[type=radio]{margin:0 0 0 5px;cursor:pointer} ",
" .jop-list{box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:10px;width:100%;height:100%;z-index:1;transition:right .2s ease-in-out;font-family:Roboto,Helvetica,Arial,sans-serif;color:#000}.jop-button,.jop-button_def{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:3px 10px;border-radius:4px;font-weight:500;font-size:14px;border:1px solid #dcdfe6;color:#606266;cursor:pointer}.jop-button_def{margin:10px 0;width:100px}.jop-button:visited{color:#606266}.jop-button:hover{text-decoration:none;color:#409eff;border:1px solid #c6e2ff;background-color:#ecf5ff}.jop-button_label{position:absolute;font-size:10px;padding:4px;border-radius:4px;top:-13px;right:-10px;line-height:.75;color:#67c23a;border:1px solid #e1f3d8;background:white}.jop-button_green{color:#fff!important;background-color:#67c23a}.jop-button_green:hover{color:#fff!important;background-color:#95d475}.jop-button_red{color:#fff!important;background-color:#f56c6c}.jop-button_red:hover{color:#fff!important;background-color:#f89898}.jop-loading{display:inline-block;width:14px;height:14px;margin-right:10px;border:2px dashed #dcdfe6;border-top-color:transparent;border-radius:100%;animation:btnLoading infinite 1s linear}@keyframes btnLoading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.jop-tag{padding:3px 6px;color:#409eff!important;background:#ecf5ff;border:1px solid #d9ecff;border-radius:4px}.jop-setting-list{display:flex;flex-wrap:wrap;background-color:#fff}.jop-setting-title{margin:10px 0 5px}.jop-setting-item{display:flex;height:20px;justify-content:center;align-items:center;margin-right:15px;-webkit-user-select:none;user-select:none;cursor:pointer}.db-panel .movie-panel-info div.panel-block{padding:5.5px 12px}.db-panel .jop-app{padding:15px 12px}.lib-panel .jop-app{padding:20px 30px;margin-top:10px}input[type=checkbox],input[type=radio]{margin:0 0 0 5px;cursor:pointer} ",
);
(function (preact) {

View File

@@ -9,7 +9,7 @@
"build": "tsc && vite build"
},
"dependencies": {
"preact": "10.15.1"
"preact": "10.22.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.6.0",

1482
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
import { StateUpdater, useState } from "preact/hooks";
import { Dispatch, StateUpdater, useState } from "preact/hooks";
import { SiteItem } from "@/utils/siteList";
const Setting = ({
@@ -7,7 +7,7 @@ const Setting = ({
disables,
}: {
siteList: SiteItem[];
setDisables: StateUpdater<string[]>;
setDisables: Dispatch<StateUpdater<string[]>>;
disables: SiteItem["name"][];
}) => {
const [showSetting, setShowSetting] = useState(false);

View File

@@ -8,7 +8,6 @@
width: 100%;
height: 100%;
z-index: 1;
background-color: white;
transition: right 200ms ease-in-out;
font-family: Roboto, Helvetica, Arial, sans-serif;
color: black;
@@ -110,7 +109,6 @@
.jop-setting-list {
display: flex;
flex-wrap: wrap;
background-color: white;
}
.jop-setting-title {
margin: 10px 0 5px 0;

View File

@@ -15,21 +15,21 @@ export const libSites: LibItem[] = [
{
name: "javdb",
enable: true,
href: /^https?:\/\/(\w*\.)?javdb(\d)*\.com.*$/,
href: /^https?:\/\/(\w*\.)?javdb(\d)*\.com\/v.*$/,
querys: {
panelQueryStr: ".video-meta-panel>.columns.is-desktop .panel.movie-panel-info",
codeQueryStr: `[data-clipboard-text]`,
},
method() {
// 一些样式调整
const columnVideoCover = document.querySelector<HTMLElement>(
".column-video-cover",
) as HTMLElement;
columnVideoCover.style.width = "60%";
const columnVideoCover = document.querySelector<HTMLElement>(".column-video-cover");
if (columnVideoCover) {
columnVideoCover.style.width = "60%";
}
const panel = document.querySelector<HTMLElement>(
".video-meta-panel>.columns.is-desktop>.column:not(.column-video-cover)",
) as HTMLElement;
panel.classList.add("db-panel");
);
panel?.classList.add("db-panel");
},
},
{
@@ -51,8 +51,8 @@ export const libSites: LibItem[] = [
codeQueryStr: `#video_id td.text`,
},
method() {
const panel = document.querySelector<HTMLElement>("#video_info") as HTMLElement;
panel.classList.add("lib-panel");
const panel = document.querySelector<HTMLElement>("#video_info");
panel?.classList.add("lib-panel");
},
},
];

View File

@@ -261,20 +261,6 @@ export const siteList: SiteItem[] = [
fetchType: "get",
domQuery: {},
},
{
name: "7mm002",
hostname: "7mm002.com",
url: "https://7mm002.com/zh/searchform_search/all/index.html",
fetchType: "post",
postParams: {
search_type: "searchall",
op: "search",
},
domQuery: {
linkQuery: ".content .video-title>a[href]",
titleQuery: ".content .video-title>a[href]",
},
},
{
name: "18av",
hostname: "18av.mm-cg.com",
@@ -282,6 +268,13 @@ export const siteList: SiteItem[] = [
fetchType: "parser",
domQuery: { linkQuery: ".posts h3>a[href]", titleQuery: ".posts h3>a[href]" },
},
{
name: "javgo",
hostname: "javgo.to",
url: "https://javgo.to/zh/v/{{code}}",
fetchType: "get",
domQuery: {},
},
{
name: "JavBus",
disableLibItemName: "javbus",

View File

@@ -1,4 +1,4 @@
import { gmGet, gmPost, isCaseInsensitiveEqual, isErrorCode, regEnum } from "./";
import { gmGet, isCaseInsensitiveEqual, isErrorCode, regEnum } from "./";
import type { DomQuery_get, DomQuery_parser, SiteItem } from "./siteList";
export type FetchResult = {
@@ -68,15 +68,6 @@ export const handleFetch = async (
CODE: string,
): Promise<FetchResult> => {
try {
if (siteItem.fetchType === "post") {
const response = await gmPost({
url: targetLink,
data: { search_keyword: CODE, ...siteItem.postParams },
});
return {
...serachPageParser(response.responseText, siteItem.domQuery, siteItem.hostname, CODE),
};
}
const response = await gmGet({ url: targetLink });
if (isErrorCode(response.status)) {
// 请求 404大概是对应网站没有资源