release: 1.1.6

This commit is contained in:
mrbunker
2023-03-11 13:45:54 +08:00
parent 6d87fbc0a4
commit cde6f34286
2 changed files with 48 additions and 46 deletions

86
dist/jop.user.js vendored
View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name JAV 添加跳转在线观看
// @namespace https://greasyfork.org/zh-CN/scripts/429173
// @version 1.1.5
// @version 1.1.6
// @author mission522
// @description [高效寻找最佳的在线资源] 在影片详情页添加跳转在线播放的按钮,并注是否提供在线播放资源或无码资源、字幕资源等信息。支持 JavDB、JavBus 以及 JavLibrary
// @license MIT
@@ -32,7 +32,6 @@
// @connect javlibrary.com
// @connect javdb007.com
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// ==/UserScript==
@@ -40,7 +39,7 @@
const o = document.createElement("style");
(o.dataset.source = "vite-plugin-monkey"), (o.innerText = t), document.head.appendChild(o);
})(
".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:50px}.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}.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}",
".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:50px}.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;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 (preact2) {
@@ -166,18 +165,18 @@
var o2 = d(t++, 3);
!preact2.options.__s && z$1(o2.__H, i2) && ((o2.__ = u2), (o2.i = i2), r.__H.__h.push(o2));
}
function _$1(n) {
return (
(o$1 = 5),
F$1(function () {
return { current: n };
}, [])
);
}
function F$1(n, r2) {
var u2 = d(t++, 7);
return z$1(u2.__H, r2) ? ((u2.__V = n()), (u2.i = r2), (u2.__h = n), u2.__V) : u2.__;
}
function T$1(n, t2) {
return (
(o$1 = 8),
F$1(function () {
return n;
}, t2)
);
}
function b() {
for (var t2; (t2 = f.shift()); )
if (t2.__P && t2.__H)
@@ -557,10 +556,6 @@
preact2.options.__r = function (n) {
en && en(n), n.__c;
};
var monkeyWindow = window;
var GM_setValue = /* @__PURE__ */ (() => monkeyWindow.GM_setValue)();
var GM_xmlhttpRequest = /* @__PURE__ */ (() => monkeyWindow.GM_xmlhttpRequest)();
var GM_getValue = /* @__PURE__ */ (() => monkeyWindow.GM_getValue)();
var _ = 0;
function o(o2, e2, n, t2, f2) {
var l2,
@@ -588,9 +583,18 @@
for (s in l2) void 0 === u2[s] && (u2[s] = l2[s]);
return preact2.options.vnode && preact2.options.vnode(a2), a2;
}
const Setting = ({ sites, setSites, disables: disable }) => {
const Setting = ({ sites, setDisables, disables }) => {
const [showSetting, setShowSetting] = p(false);
const newDisable = _$1(disable);
const changeCheck = T$1(
(item, isHidden) => {
if (isHidden) {
setDisables(disables.filter((disItem) => disItem !== item.name));
} else {
setDisables([...disables, item.name]);
}
},
[sites],
);
return o(preact2.Fragment, {
children: [
!showSetting
@@ -612,38 +616,29 @@
className: "jop-setting",
children: o("div", {
className: "jop-setting-list",
children: sites.map((item, index) =>
o("div", {
children: sites.map((item) => {
const isHidden = disables.includes(item.name);
return o("div", {
className: "jop-setting-item",
onClick: () => {
changeCheck(item, isHidden);
},
children: [
item.name,
o("input", {
type: "checkbox",
className: "jop-setting-checkbox",
checked: !disable.includes(item.name),
onChange: (e2) => {
const checked = e2.target.checked;
sites[index].disable = !checked;
if (!checked) {
newDisable.current.push(item.name);
} else {
newDisable.current = newDisable.current.filter((disableItem) => {
return disableItem !== item.name;
});
}
},
checked: !isHidden,
}),
],
});
}),
),
}),
}),
o("div", {
className: "jop-button_def",
onClick: (e2) => {
onClick: () => {
setShowSetting(!showSetting);
GM_setValue("disable", newDisable.current);
setSites([...sites]);
},
children: "保存",
}),
@@ -652,6 +647,9 @@
],
});
};
var monkeyWindow = window;
var GM_xmlhttpRequest = /* @__PURE__ */ (() => monkeyWindow.GM_xmlhttpRequest)();
var GM_getValue = /* @__PURE__ */ (() => monkeyWindow.GM_getValue)();
function videoPageParser(responseText, { subQuery, leakQuery, videoQuery }) {
const doc = new DOMParser().parseFromString(responseText, "text/html");
const subNode = subQuery ? doc.querySelector(subQuery) : "";
@@ -678,9 +676,9 @@
const isSuccess = linkNode && titleNode && titleNodeText.includes(formatCode);
if (isSuccess) {
const targetLinkText = linkNode.href.replace(linkNode.hostname, siteHostName);
const meSub = checkTextFn ? checkTextFn(targetLinkText) : false;
const checkResult = checkTextFn ? checkTextFn(targetLinkText) : false;
const hasSubtitle =
titleNodeText.includes("字幕") || titleNodeText.includes("subtitle") || meSub;
titleNodeText.includes("字幕") || titleNodeText.includes("subtitle") || checkResult;
return {
isSuccess: true,
targetLink: targetLinkText,
@@ -753,7 +751,7 @@
});
return xhrPromise;
}
const SiteButton = R(({ siteItem, CODE }) => {
const SiteBtn = R(({ siteItem, CODE }) => {
const { name } = siteItem;
const link = siteItem.url.replace("{{code}}", CODE);
const [status, setStatus] = p({
@@ -1035,7 +1033,7 @@
];
const App = R(function ({ current, CODE }) {
const defDisables = ["AvJoy", "baihuse", "GGJAV", "AV01", "JavBus", "JavDB", "JAVLib"];
const disables = GM_getValue("disable", defDisables);
const [disables, setDisables] = p(GM_getValue("disable", defDisables));
const [sites, setSites] = p(siteList);
const sitesDisHost = sites.filter(
(item) => item.disableHostname !== current.name && !item.disable,
@@ -1048,16 +1046,20 @@
o("div", {
class: "jop-list",
children: filter.map((item) =>
o(SiteButton, {
o(
SiteBtn,
{
siteItem: item,
CODE,
}),
},
item.name,
),
),
}),
o("div", {
children: o(Setting, {
sites,
setSites,
setDisables,
disables,
}),
}),

View File

@@ -7,7 +7,7 @@ const connectList = siteList.map((site) => site.hostname).concat(["javdb007.com"
const UserscriptConfig: MonkeyUserScript = {
author: "mission522",
version: "1.1.5",
version: "1.1.6",
license: "MIT",
name: "JAV 添加跳转在线观看",
match: ["*://*/cn/?v=jav*"],