移除跳转播放无用的地址

This commit is contained in:
lzyme.dev@gmail.com
2026-08-30 19:09:07 +08:00
parent 03700906e5
commit e92991c365
4 changed files with 408 additions and 533 deletions
+40 -190
View File
@@ -1130,7 +1130,6 @@
if (typeof GM_info === "undefined" || GM_info.scriptHandler !== "Tampermonkey" || compareVersions(GM_info.version, "5.3.2") < 0) return; if (typeof GM_info === "undefined" || GM_info.scriptHandler !== "Tampermonkey" || compareVersions(GM_info.version, "5.3.2") < 0) return;
const GM_xmlhttpRequestOrig = GM_xmlhttpRequest; const GM_xmlhttpRequestOrig = GM_xmlhttpRequest;
const GM_xmlHttpRequestOrig = GM2.xmlHttpRequest; const GM_xmlHttpRequestOrig = GM2.xmlHttpRequest;
function compareVersions(v1, v2) { function compareVersions(v1, v2) {
const parts1 = v1.split(".").map(Number); const parts1 = v1.split(".").map(Number);
const parts2 = v2.split(".").map(Number); const parts2 = v2.split(".").map(Number);
@@ -1143,7 +1142,6 @@
} }
return 0; return 0;
} }
function GM_xmlhttpRequestWrapper(odetails) { function GM_xmlhttpRequestWrapper(odetails) {
if (odetails.redirect !== void 0) { if (odetails.redirect !== void 0) {
return GM_xmlhttpRequestOrig(odetails); return GM_xmlhttpRequestOrig(odetails);
@@ -1193,7 +1191,6 @@
}; };
return handleRedirects(details); return handleRedirects(details);
} }
function GM_xmlHttpRequestWrapper(odetails) { function GM_xmlHttpRequestWrapper(odetails) {
let abort; let abort;
const p = new Promise((resolve, reject) => { const p = new Promise((resolve, reject) => {
@@ -1234,7 +1231,6 @@
}; };
return p; return p;
} }
GM_xmlhttpRequest = GM_xmlhttpRequestWrapper; GM_xmlhttpRequest = GM_xmlhttpRequestWrapper;
scope.GM_xmlhttpRequestOrig = GM_xmlhttpRequestOrig; scope.GM_xmlhttpRequestOrig = GM_xmlhttpRequestOrig;
const gopd = Object.getOwnPropertyDescriptor(GM2, "xmlHttpRequest"); const gopd = Object.getOwnPropertyDescriptor(GM2, "xmlHttpRequest");
@@ -2692,7 +2688,6 @@ ${value}\r
return false; return false;
} }
} }
const DMM_GRAPHQL_URL = "https://api.video.dmm.co.jp/graphql"; const DMM_GRAPHQL_URL = "https://api.video.dmm.co.jp/graphql";
const dmmGraphQLKeyword = (code) => { const dmmGraphQLKeyword = (code) => {
const match = String(code || "").trim().toUpperCase().match(/^([A-Z0-9]{2,10})-(\d{1,6})$/); const match = String(code || "").trim().toUpperCase().match(/^([A-Z0-9]{2,10})-(\d{1,6})$/);
@@ -2850,13 +2845,11 @@ ${value}\r
for (const quality of priorityOrder) if (availableSet.has(quality)) return quality; for (const quality of priorityOrder) if (availableSet.has(quality)) return quality;
return dmmVideoQualityList[0]; return dmmVideoQualityList[0];
}, CACHE_KEY = "jhs_dmm_video"; }, CACHE_KEY = "jhs_dmm_video";
class DmmVideoFetcher { class DmmVideoFetcher {
constructor(carNum2, showErrorMessages = true) { constructor(carNum2, showErrorMessages = true) {
this.carNum = carNum2; this.carNum = carNum2;
this.showErrorMessages = showErrorMessages; this.showErrorMessages = showErrorMessages;
} }
_checkCache() { _checkCache() {
const cachedData = localStorage.getItem(CACHE_KEY) ? JSON.parse(localStorage.getItem(CACHE_KEY)) : {}; const cachedData = localStorage.getItem(CACHE_KEY) ? JSON.parse(localStorage.getItem(CACHE_KEY)) : {};
if (cachedData[this.carNum]) { if (cachedData[this.carNum]) {
@@ -2865,14 +2858,12 @@ ${value}\r
} }
return null; return null;
} }
_updateCache(videoMap) { _updateCache(videoMap) {
const cachedData = localStorage.getItem(CACHE_KEY) ? JSON.parse(localStorage.getItem(CACHE_KEY)) : {}; const cachedData = localStorage.getItem(CACHE_KEY) ? JSON.parse(localStorage.getItem(CACHE_KEY)) : {};
cachedData[this.carNum] = videoMap; cachedData[this.carNum] = videoMap;
clog.debug("成功解析出预览视频并已缓存:", videoMap); clog.debug("成功解析出预览视频并已缓存:", videoMap);
localStorage.setItem(CACHE_KEY, JSON.stringify(cachedData)); localStorage.setItem(CACHE_KEY, JSON.stringify(cachedData));
} }
async _searchContentIds() { async _searchContentIds() {
const carNum2 = this.carNum, carNumNoHyphen = carNum2.replace(/-/g, ""), keywordAttempts = [{ const carNum2 = this.carNum, carNumNoHyphen = carNum2.replace(/-/g, ""), keywordAttempts = [{
keyword: carNum2.replace("-", "00"), keyword: carNum2.replace("-", "00"),
@@ -2989,7 +2980,6 @@ ${value}\r
if (0 === Object.keys(finalQualityMap).length) throw new Error("未找到匹配要求的预览画质视频"); if (0 === Object.keys(finalQualityMap).length) throw new Error("未找到匹配要求的预览画质视频");
return finalQualityMap; return finalQualityMap;
} }
async _searchViaGraphQL() { async _searchViaGraphQL() {
clog.debug("尝试通过 GraphQL API 搜索视频..."); clog.debug("尝试通过 GraphQL API 搜索视频...");
const videoMap = await getDmmGraphQLVideoUrls(this.carNum); const videoMap = await getDmmGraphQLVideoUrls(this.carNum);
@@ -3007,7 +2997,6 @@ ${value}\r
} }
return null; return null;
} }
async fetchVideo() { async fetchVideo() {
const cachedResult = this._checkCache(); const cachedResult = this._checkCache();
if (cachedResult) return cachedResult; if (cachedResult) return cachedResult;
@@ -3053,7 +3042,6 @@ ${value}\r
} }
} }
} }
const getDmmVideo = async (carNum2, showErrorMessages = true) => new DmmVideoFetcher(carNum2, showErrorMessages).fetchVideo(); const getDmmVideo = async (carNum2, showErrorMessages = true) => new DmmVideoFetcher(carNum2, showErrorMessages).fetchVideo();
class AutoPagePlugin extends BasePlugin { class AutoPagePlugin extends BasePlugin {
constructor() { constructor() {
@@ -4245,12 +4233,6 @@ ${value}\r
<input id="jableUrl"> <input id="jableUrl">
</div> </div>
</div> </div>
<div class="setting-item">
<span class="setting-label">域名 - Avgle:</span>
<div class="form-content">
<input id="avgleUrl">
</div>
</div>
<div class="setting-item"> <div class="setting-item">
<span class="setting-label">域名 - JavTrailer:</span> <span class="setting-label">域名 - JavTrailer:</span>
<div class="form-content"> <div class="form-content">
@@ -4684,10 +4666,12 @@ ${value}\r
$("#enableHandleSvg").prop("checked", !settingObj.enableHandleSvg || settingObj.enableHandleSvg === YES); $("#enableHandleSvg").prop("checked", !settingObj.enableHandleSvg || settingObj.enableHandleSvg === YES);
$("#enableSiteSvg").prop("checked", !settingObj.enableSiteSvg || settingObj.enableSiteSvg === YES); $("#enableSiteSvg").prop("checked", !settingObj.enableSiteSvg || settingObj.enableSiteSvg === YES);
$("#enableCopySvg").prop("checked", !settingObj.enableCopySvg || settingObj.enableCopySvg === YES); $("#enableCopySvg").prop("checked", !settingObj.enableCopySvg || settingObj.enableCopySvg === YES);
const otherSitePlugin = this.getBean("OtherSitePlugin"), missAvUrl = await otherSitePlugin.getMissAvUrl(), jableUrl = await otherSitePlugin.getjableUrl(), avgleUrl = await otherSitePlugin.getAvgleUrl(), javTrailersUrl = await otherSitePlugin.getJavTrailersUrl(), av123Url = await otherSitePlugin.getAv123Url(), javDbUrl = await otherSitePlugin.getJavDbUrl(), javBusUrl = await otherSitePlugin.getJavBusUrl(), supJavUrl = await otherSitePlugin.getSupJavUrl(); const otherSitePlugin = this.getBean("OtherSitePlugin"), missAvUrl = await otherSitePlugin.getMissAvUrl(),
jableUrl = await otherSitePlugin.getjableUrl(), javTrailersUrl = await otherSitePlugin.getJavTrailersUrl(),
av123Url = await otherSitePlugin.getAv123Url(), javDbUrl = await otherSitePlugin.getJavDbUrl(),
javBusUrl = await otherSitePlugin.getJavBusUrl(), supJavUrl = await otherSitePlugin.getSupJavUrl();
$("#missAvUrl").val(missAvUrl); $("#missAvUrl").val(missAvUrl);
$("#jableUrl").val(jableUrl); $("#jableUrl").val(jableUrl);
$("#avgleUrl").val(avgleUrl);
$("#javTrailersUrl").val(javTrailersUrl); $("#javTrailersUrl").val(javTrailersUrl);
$("#av123Url").val(av123Url); $("#av123Url").val(av123Url);
$("#javDbUrl").val(javDbUrl); $("#javDbUrl").val(javDbUrl);
@@ -5201,7 +5185,6 @@ ${value}\r
settingObj.webDavPassword = $("#webDavPassword").val(); settingObj.webDavPassword = $("#webDavPassword").val();
settingObj.missAvUrl = $("#missAvUrl").val().replace(/\/$/, ""); settingObj.missAvUrl = $("#missAvUrl").val().replace(/\/$/, "");
settingObj.jableUrl = $("#jableUrl").val().replace(/\/$/, ""); settingObj.jableUrl = $("#jableUrl").val().replace(/\/$/, "");
settingObj.avgleUrl = $("#avgleUrl").val().replace(/\/$/, "");
settingObj.javTrailersUrl = $("#javTrailersUrl").val().replace(/\/$/, ""); settingObj.javTrailersUrl = $("#javTrailersUrl").val().replace(/\/$/, "");
settingObj.av123Url = $("#av123Url").val().replace(/\/$/, ""); settingObj.av123Url = $("#av123Url").val().replace(/\/$/, "");
settingObj.javDbUrl = $("#javDbUrl").val().replace(/\/$/, ""); settingObj.javDbUrl = $("#javDbUrl").val().replace(/\/$/, "");
@@ -5239,7 +5222,6 @@ ${value}\r
this.getBean("BlacklistPlugin").resetBtnTip(); this.getBean("BlacklistPlugin").resetBtnTip();
this.getBean("BlacklistPlugin").reloadTable(); this.getBean("BlacklistPlugin").reloadTable();
} }
async loadMarkDeleteList() { async loadMarkDeleteList() {
const markedList = await storageManager.forage.getItem("markedDeleteList") || []; const markedList = await storageManager.forage.getItem("markedDeleteList") || [];
const $list = $("#markDeleteList"); const $list = $("#markDeleteList");
@@ -7384,28 +7366,22 @@ ${value}\r
$secTitle.html(newHTML); $secTitle.html(newHTML);
} }
} }
class JavPackSubtitle { class JavPackSubtitle {
static escapeHtml(value = "") { static escapeHtml(value = "") {
return String(value).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;"); return String(value).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
} }
static sanitizeName(value = "") { static sanitizeName(value = "") {
return String(value).replace(/[\\/:*?"<>|]/g, "").replace(/\s+/g, " ").trim(); return String(value).replace(/[\\/:*?"<>|]/g, "").replace(/\s+/g, " ").trim();
} }
static isSubtitleFile(file = {}) { static isSubtitleFile(file = {}) {
return /\.(srt|ass|ssa|vtt|sub)$/i.test(file.n || ""); return /\.(srt|ass|ssa|vtt|sub)$/i.test(file.n || "");
} }
static buildDefaultKeyword(details = {}) { static buildDefaultKeyword(details = {}) {
return this.sanitizeName(details.code || "") || this.sanitizeName([details.code, details.title].filter(Boolean).join(" ")) || document.title; return this.sanitizeName(details.code || "") || this.sanitizeName([details.code, details.title].filter(Boolean).join(" ")) || document.title;
} }
static buildSearchKeywords(details = {}) { static buildSearchKeywords(details = {}) {
return [this.buildDefaultKeyword(details)].filter(Boolean); return [this.buildDefaultKeyword(details)].filter(Boolean);
} }
static buildSubtitleBaseName(details = {}) { static buildSubtitleBaseName(details = {}) {
var _a; var _a;
if ((_a = window.JavPackMatch115Console) == null ? void 0 : _a.buildRename) { if ((_a = window.JavPackMatch115Console) == null ? void 0 : _a.buildRename) {
@@ -7413,31 +7389,25 @@ ${value}\r
} }
return this.sanitizeName([details.code, details.title].filter(Boolean).join(" ")) || this.buildDefaultKeyword(details); return this.sanitizeName([details.code, details.title].filter(Boolean).join(" ")) || this.buildDefaultKeyword(details);
} }
static buildSubtitleFilename(details = {}, item = {}) { static buildSubtitleFilename(details = {}, item = {}) {
const ext = this.sanitizeName(item.ext || "srt").replace(/^\.+/, "") || "srt"; const ext = this.sanitizeName(item.ext || "srt").replace(/^\.+/, "") || "srt";
return `${this.buildSubtitleBaseName(details)}.${ext}`; return `${this.buildSubtitleBaseName(details)}.${ext}`;
} }
static clearPreviewCache() { static clearPreviewCache() {
this.previewCache.clear(); this.previewCache.clear();
} }
static async checkSubInCloud(req115, cid) { static async checkSubInCloud(req115, cid) {
if (!req115 || !cid) return false; if (!req115 || !cid) return false;
const res = await req115.filesAll(cid); const res = await req115.filesAll(cid);
return ((res == null ? void 0 : res.data) || []).some((file) => this.isSubtitleFile(file)); return ((res == null ? void 0 : res.data) || []).some((file) => this.isSubtitleFile(file));
} }
static getReq115() { static getReq115() {
return window.Req115 || null; return window.Req115 || null;
} }
static getTargetCid() { static getTargetCid() {
var _a, _b; var _a, _b;
return ((_a = document.querySelector(".x-match-cont .zymatch-item [data-cid]")) == null ? void 0 : _a.dataset.cid) || ((_b = document.querySelector(".x-match-cont .zymatch-item")) == null ? void 0 : _b.dataset.cid) || ""; return ((_a = document.querySelector(".x-match-cont .zymatch-item [data-cid]")) == null ? void 0 : _a.dataset.cid) || ((_b = document.querySelector(".x-match-cont .zymatch-item")) == null ? void 0 : _b.dataset.cid) || "";
} }
static async find115Cid(code) { static async find115Cid(code) {
if (!code) return ""; if (!code) return "";
const req115 = this.getReq115(); const req115 = this.getReq115();
@@ -7456,7 +7426,6 @@ ${value}\r
return ""; return "";
} }
} }
static async preload115Matches(code) { static async preload115Matches(code) {
this.cached115Matches = []; this.cached115Matches = [];
this.current115Cids = []; this.current115Cids = [];
@@ -7527,7 +7496,6 @@ ${value}\r
attributeFilter: ["data-has-subtitle", "data-subtitle-files"] attributeFilter: ["data-has-subtitle", "data-subtitle-files"]
}); });
} }
static modalTemplate(defaultKw) { static modalTemplate(defaultKw) {
return ` return `
<div class="pdb-sub-modal"> <div class="pdb-sub-modal">
@@ -7641,11 +7609,9 @@ ${value}\r
}); });
performSearch(defaultKw); performSearch(defaultKw);
} }
static requestText(url) { static requestText(url) {
return window.gmHttp.get(url); return window.gmHttp.get(url);
} }
static async searchXunlei(kw) { static async searchXunlei(kw) {
const root = await this.requestText(`https://api-shoulei-ssl.xunlei.com/oracle/subtitle?name=${encodeURIComponent(kw)}`); const root = await this.requestText(`https://api-shoulei-ssl.xunlei.com/oracle/subtitle?name=${encodeURIComponent(kw)}`);
if (!root || root.code !== 0 || !Array.isArray(root.data)) return []; if (!root || root.code !== 0 || !Array.isArray(root.data)) return [];
@@ -7653,7 +7619,6 @@ ${value}\r
const labeledResults = await Promise.all(results.map((item) => this.labelXunleiChineseSubtitle(item))); const labeledResults = await Promise.all(results.map((item) => this.labelXunleiChineseSubtitle(item)));
return labeledResults.filter(Boolean); return labeledResults.filter(Boolean);
} }
static normalizeXunleiResult(item = {}) { static normalizeXunleiResult(item = {}) {
const rawLanguages = item.languages ?? item.Languages ?? item.langs ?? item.Langs ?? item.language ?? item.Language ?? []; const rawLanguages = item.languages ?? item.Languages ?? item.langs ?? item.Langs ?? item.language ?? item.Language ?? [];
return { return {
@@ -7665,7 +7630,6 @@ ${value}\r
provider: "迅雷" provider: "迅雷"
}; };
} }
static async labelXunleiChineseSubtitle(item) { static async labelXunleiChineseSubtitle(item) {
if (this.isWantedChineseSubtitle(item)) return item; if (this.isWantedChineseSubtitle(item)) return item;
if (!item.url) return null; if (!item.url) return null;
@@ -7676,7 +7640,6 @@ ${value}\r
return null; return null;
} }
} }
static detectChineseSubtitleLanguage(text = "") { static detectChineseSubtitleLanguage(text = "") {
const sample = String(text).slice(0, 12e3); const sample = String(text).slice(0, 12e3);
if (!/[\u3400-\u9fff]/.test(sample)) return ""; if (!/[\u3400-\u9fff]/.test(sample)) return "";
@@ -7685,7 +7648,6 @@ ${value}\r
if (simplifiedCount === 0 && traditionalCount === 0) return ""; if (simplifiedCount === 0 && traditionalCount === 0) return "";
return traditionalCount > simplifiedCount ? "繁中" : "简中"; return traditionalCount > simplifiedCount ? "繁中" : "简中";
} }
static async searchSubtitleCat(kw) { static async searchSubtitleCat(kw) {
const searchUrl = `${this.SUBTITLECAT_ORIGIN}/index.php?search=${encodeURIComponent(kw)}`; const searchUrl = `${this.SUBTITLECAT_ORIGIN}/index.php?search=${encodeURIComponent(kw)}`;
const searchHtml = await this.requestText(searchUrl); const searchHtml = await this.requestText(searchUrl);
@@ -7699,7 +7661,6 @@ ${value}\r
})); }));
return languageGroups.flat(); return languageGroups.flat();
} }
static parseSubtitleCatSearch(html) { static parseSubtitleCatSearch(html) {
const doc = new DOMParser().parseFromString(html, "text/html"); const doc = new DOMParser().parseFromString(html, "text/html");
return [...doc.querySelectorAll("table.sub-table tbody tr")].flatMap((row) => { return [...doc.querySelectorAll("table.sub-table tbody tr")].flatMap((row) => {
@@ -7713,7 +7674,6 @@ ${value}\r
}]; }];
}); });
} }
static parseSubtitleCatLanguages(html, entry) { static parseSubtitleCatLanguages(html, entry) {
const doc = new DOMParser().parseFromString(html, "text/html"); const doc = new DOMParser().parseFromString(html, "text/html");
return [...doc.querySelectorAll(".sub-single")].flatMap((node) => { return [...doc.querySelectorAll(".sub-single")].flatMap((node) => {
@@ -7732,21 +7692,18 @@ ${value}\r
}]; }];
}); });
} }
static isWantedChineseSubtitle(item = {}) { static isWantedChineseSubtitle(item = {}) {
if (item.provider === "SubtitleCat") return this.SUBTITLECAT_CHINESE_LANGUAGES.has(item.languageCode); if (item.provider === "SubtitleCat") return this.SUBTITLECAT_CHINESE_LANGUAGES.has(item.languageCode);
const language = Array.isArray(item.languages) ? item.languages.join(" ") : String(item.languages || ""); const language = Array.isArray(item.languages) ? item.languages.join(" ") : String(item.languages || "");
const name2 = `${item.name || ""} ${item.extra_name || ""}`; const name2 = `${item.name || ""} ${item.extra_name || ""}`;
return /(zh[-_]?cn|zh[-_]?tw|chs|cht|chinese\s*(simplified|traditional)|简体|繁体|繁體|简中|繁中)/i.test(`${language} ${name2}`); return /(zh[-_]?cn|zh[-_]?tw|chs|cht|chinese\s*(simplified|traditional)|简体|繁体|繁體|简中|繁中)/i.test(`${language} ${name2}`);
} }
static sortResults(dataList, kw = "", details = {}) { static sortResults(dataList, kw = "", details = {}) {
const kwClean = kw.toLowerCase().replace(/[-_.\s]/g, ""); const kwClean = kw.toLowerCase().replace(/[-_.\s]/g, "");
const tokens = kw.toLowerCase().split(/[-_.\s]+/).filter((word) => word.length > 1); const tokens = kw.toLowerCase().split(/[-_.\s]+/).filter((word) => word.length > 1);
const codeClean = String(details.code || kw).toLowerCase().replace(/[-_.\s]/g, ""); const codeClean = String(details.code || kw).toLowerCase().replace(/[-_.\s]/g, "");
return [...dataList].filter((item) => this.isWantedChineseSubtitle(item)).sort((a, b) => this.scoreResult(b, kwClean, tokens, codeClean) - this.scoreResult(a, kwClean, tokens, codeClean)); return [...dataList].filter((item) => this.isWantedChineseSubtitle(item)).sort((a, b) => this.scoreResult(b, kwClean, tokens, codeClean) - this.scoreResult(a, kwClean, tokens, codeClean));
} }
static scoreResult(item, kwClean, tokens, codeClean = "") { static scoreResult(item, kwClean, tokens, codeClean = "") {
const name2 = (item.name || item.extra_name || "").toLowerCase(); const name2 = (item.name || item.extra_name || "").toLowerCase();
const compactName = name2.replace(/[-_.\s]/g, ""); const compactName = name2.replace(/[-_.\s]/g, "");
@@ -7793,7 +7750,6 @@ ${value}\r
})); }));
}); });
} }
static renderRow(item, index, highlightRegex) { static renderRow(item, index, highlightRegex) {
var _a; var _a;
const lang = ((_a = item.languages) == null ? void 0 : _a[0]) || "未知"; const lang = ((_a = item.languages) == null ? void 0 : _a[0]) || "未知";
@@ -7866,7 +7822,6 @@ ${value}\r
btn.style.opacity = "1"; btn.style.opacity = "1";
} }
} }
static setActivePreviewRow(overlay, btn) { static setActivePreviewRow(overlay, btn) {
overlay.querySelectorAll(".pdb-sub-tr.is-previewing").forEach((row2) => { overlay.querySelectorAll(".pdb-sub-tr.is-previewing").forEach((row2) => {
row2.classList.remove("is-previewing"); row2.classList.remove("is-previewing");
@@ -7877,13 +7832,11 @@ ${value}\r
row.classList.add("is-previewing"); row.classList.add("is-previewing");
row.setAttribute("aria-current", "true"); row.setAttribute("aria-current", "true");
} }
static decodeSubtitle(buffer) { static decodeSubtitle(buffer) {
let text = new TextDecoder("utf-8").decode(buffer); let text = new TextDecoder("utf-8").decode(buffer);
if ((text.match(/\uFFFD/g) || []).length > 3) text = new TextDecoder("gbk").decode(buffer); if ((text.match(/\uFFFD/g) || []).length > 3) text = new TextDecoder("gbk").decode(buffer);
return text; return text;
} }
static fetchBinaryCached(url) { static fetchBinaryCached(url) {
if (this.previewCache.has(url)) return Promise.resolve(this.previewCache.get(url)); if (this.previewCache.has(url)) return Promise.resolve(this.previewCache.get(url));
return this.fetchBinary(url).then((buffer) => { return this.fetchBinary(url).then((buffer) => {
@@ -7891,7 +7844,6 @@ ${value}\r
return buffer; return buffer;
}); });
} }
static fetchBinary(url) { static fetchBinary(url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
_GM_xmlhttpRequest({ _GM_xmlhttpRequest({
@@ -7906,7 +7858,6 @@ ${value}\r
}); });
}); });
} }
static downloadBuffer(buffer, filename) { static downloadBuffer(buffer, filename) {
const blob = new Blob([buffer], {type: "application/octet-stream"}); const blob = new Blob([buffer], {type: "application/octet-stream"});
const link = document.createElement("a"); const link = document.createElement("a");
@@ -7915,7 +7866,6 @@ ${value}\r
link.click(); link.click();
URL.revokeObjectURL(link.href); URL.revokeObjectURL(link.href);
} }
static uploadSubtitle(args) { static uploadSubtitle(args) {
return args.req115.queueMutation("上传字幕", () => this.uploadSubtitleNow(args)); return args.req115.queueMutation("上传字幕", () => this.uploadSubtitleNow(args));
} }
@@ -7937,7 +7887,6 @@ ${value}\r
throw new Error((uploadRes == null ? void 0 : uploadRes.error_msg) || (uploadRes == null ? void 0 : uploadRes.error) || "115 服务器拒绝接收回调"); throw new Error((uploadRes == null ? void 0 : uploadRes.error_msg) || (uploadRes == null ? void 0 : uploadRes.error) || "115 服务器拒绝接收回调");
} }
} }
__publicField(JavPackSubtitle, "BTN_ID", "x-subtitle-search-btn"); __publicField(JavPackSubtitle, "BTN_ID", "x-subtitle-search-btn");
__publicField(JavPackSubtitle, "MODAL_ID", "x-subtitle-modal"); __publicField(JavPackSubtitle, "MODAL_ID", "x-subtitle-modal");
__publicField(JavPackSubtitle, "previewCache", /* @__PURE__ */ new Map()); __publicField(JavPackSubtitle, "previewCache", /* @__PURE__ */ new Map());
@@ -7950,7 +7899,6 @@ ${value}\r
["zh-TW", "繁中"] ["zh-TW", "繁中"]
])); ]));
window.JavPackSubtitle = JavPackSubtitle; window.JavPackSubtitle = JavPackSubtitle;
class Req { class Req {
static _serializeToFormData(formData, data, parentKey = "") { static _serializeToFormData(formData, data, parentKey = "") {
Object.entries(data).forEach(([key, val]) => { Object.entries(data).forEach(([key, val]) => {
@@ -7963,7 +7911,6 @@ ${value}\r
} }
}); });
} }
static request(config) { static request(config) {
let options; let options;
if (typeof config === "string") { if (typeof config === "string") {
@@ -8021,7 +7968,6 @@ ${value}\r
signal == null ? void 0 : signal.addEventListener("abort", handleAbort, {once: true}); signal == null ? void 0 : signal.addEventListener("abort", handleAbort, {once: true});
}); });
} }
static async tasks(initial, steps, signal) { static async tasks(initial, steps, signal) {
let ctx = initial; let ctx = initial;
for (const step of steps) { for (const step of steps) {
@@ -8035,14 +7981,12 @@ ${value}\r
return ctx; return ctx;
} }
} }
__publicField(Req, "DEFAULT_GET_RESPONSE_TYPE", "document"); __publicField(Req, "DEFAULT_GET_RESPONSE_TYPE", "document");
__publicField(Req, "DEFAULT_POST_RESPONSE_TYPE", "json"); __publicField(Req, "DEFAULT_POST_RESPONSE_TYPE", "json");
__publicField(Req, "DEFAULT_TIMEOUT", 3e4); __publicField(Req, "DEFAULT_TIMEOUT", 3e4);
__publicField(Req, "DEFAULT_METHOD", "GET"); __publicField(Req, "DEFAULT_METHOD", "GET");
__publicField(Req, "_isRawBody", (v) => v instanceof FormData || v instanceof Blob || v instanceof ArrayBuffer || v instanceof URLSearchParams); __publicField(Req, "_isRawBody", (v) => v instanceof FormData || v instanceof Blob || v instanceof ArrayBuffer || v instanceof URLSearchParams);
__publicField(Req, "_isPlainObject", (v) => Object.prototype.toString.call(v) === "[object Object]"); __publicField(Req, "_isPlainObject", (v) => Object.prototype.toString.call(v) === "[object Object]");
class Drive115 extends Req { class Drive115 extends Req {
static files(cid = "0", params = {}) { static files(cid = "0", params = {}) {
return this.request({ return this.request({
@@ -8050,28 +7994,24 @@ ${value}\r
params: {cid, ...params} params: {cid, ...params}
}); });
} }
static filesSearch(search_value, params = {}) { static filesSearch(search_value, params = {}) {
return this.request({ return this.request({
url: "https://webapi.115.com/files/search", url: "https://webapi.115.com/files/search",
params: {search_value, ...params} params: {search_value, ...params}
}); });
} }
static lixianTaskLists(page = 1) { static lixianTaskLists(page = 1) {
return this.request({ return this.request({
url: "https://115.com/web/lixian/", url: "https://115.com/web/lixian/",
params: {ct: "lixian", ac: "task_lists", page} params: {ct: "lixian", ac: "task_lists", page}
}); });
} }
static labelList() { static labelList() {
return this.request({ return this.request({
url: "https://webapi.115.com/label/list", url: "https://webapi.115.com/label/list",
params: {keyword: "", limit: 11150} params: {keyword: "", limit: 11150}
}); });
} }
/** /**
* @connect 115vod.com * @connect 115vod.com
*/ */
@@ -8081,18 +8021,15 @@ ${value}\r
params: {pickcode, local: 1} params: {pickcode, local: 1}
}); });
} }
static post(details) { static post(details) {
return this.request({method: "POST", ...details}); return this.request({method: "POST", ...details});
} }
static filesAdd(cname, pid) { static filesAdd(cname, pid) {
return this.post({ return this.post({
url: "https://webapi.115.com/files/add", url: "https://webapi.115.com/files/add",
data: {cname, pid} data: {cname, pid}
}); });
} }
static lixianAddTaskUrl(url, wp_path_id) { static lixianAddTaskUrl(url, wp_path_id) {
return this.post({ return this.post({
url: "https://115.com/web/lixian/", url: "https://115.com/web/lixian/",
@@ -8100,7 +8037,6 @@ ${value}\r
data: {url, wp_path_id} data: {url, wp_path_id}
}); });
} }
/** /**
* Bulk delete offline tasks and source files * Bulk delete offline tasks and source files
* @param {string[]} hash Array of info_hashes * @param {string[]} hash Array of info_hashes
@@ -8112,7 +8048,6 @@ ${value}\r
data: {hash} data: {hash}
}); });
} }
/** /**
* Bulk delete files * Bulk delete files
* @param {string[]} fid Array of file IDs * @param {string[]} fid Array of file IDs
@@ -8124,7 +8059,6 @@ ${value}\r
data: {fid, pid, ignore_warn: 1} data: {fid, pid, ignore_warn: 1}
}); });
} }
/** /**
* Batch move files * Batch move files
* @param {string[]} fid Array of file IDs * @param {string[]} fid Array of file IDs
@@ -8136,7 +8070,6 @@ ${value}\r
data: {fid, pid, move_proid: ""} data: {fid, pid, move_proid: ""}
}); });
} }
/** /**
* Bulk label files * Bulk label files
* @param {string} file_ids fid1,fid2,fid3... * @param {string} file_ids fid1,fid2,fid3...
@@ -8148,7 +8081,6 @@ ${value}\r
data: {file_ids, file_label, action} data: {file_ids, file_label, action}
}); });
} }
/** /**
* Bulk rename files * Bulk rename files
* @param {object} files_new_name { [fid]: rename } * @param {object} files_new_name { [fid]: rename }
@@ -8166,7 +8098,6 @@ ${value}\r
data: {filename, filesize, target: `U_1_${cid}`} data: {filename, filesize, target: `U_1_${cid}`}
}); });
} }
/** /**
* @connect aliyuncs.com * @connect aliyuncs.com
*/ */
@@ -8194,7 +8125,6 @@ ${value}\r
} }
}); });
} }
static filesEdit(fid, fid_cover) { static filesEdit(fid, fid_cover) {
return this.post({ return this.post({
url: "https://webapi.115.com/files/edit", url: "https://webapi.115.com/files/edit",
@@ -8202,38 +8132,30 @@ ${value}\r
}); });
} }
} }
__publicField(Drive115, "DEFAULT_GET_RESPONSE_TYPE", "json"); __publicField(Drive115, "DEFAULT_GET_RESPONSE_TYPE", "json");
class Req115 extends Drive115 { class Req115 extends Drive115 {
static async filesAll(cid, params = {}) { static async filesAll(cid, params = {}) {
const res = await this.files(cid, params); const res = await this.files(cid, params);
const {count, page_size, data} = res; const {count, page_size, data} = res;
return count > page_size && data.length ? this.files(cid, {...params, limit: count}) : res; return count > page_size && data.length ? this.files(cid, {...params, limit: count}) : res;
} }
static filesAllVideos(cid, params = {}) { static filesAllVideos(cid, params = {}) {
return this.filesAll(cid, {...params, type: 4}); return this.filesAll(cid, {...params, type: 4});
} }
static filesAllSRTs(cid, params = {}) { static filesAllSRTs(cid, params = {}) {
return this.filesAll(cid, {...params, suffix: "srt"}); return this.filesAll(cid, {...params, suffix: "srt"});
} }
static async filesSearchAll(search_value, params = {}) { static async filesSearchAll(search_value, params = {}) {
const res = await this.filesSearch(search_value, params); const res = await this.filesSearch(search_value, params);
const {count, page_size, data} = res; const {count, page_size, data} = res;
return count > page_size && data.length ? this.filesSearch(search_value, {...params, limit: count}) : res; return count > page_size && data.length ? this.filesSearch(search_value, {...params, limit: count}) : res;
} }
static filesSearchAllVideos(search_value, params = {}) { static filesSearchAllVideos(search_value, params = {}) {
return this.filesSearchAll(search_value, {...params, type: 4}); return this.filesSearchAll(search_value, {...params, type: 4});
} }
static filesSearchAllFolders(search_value, params = {}) { static filesSearchAllFolders(search_value, params = {}) {
return this.filesSearchAll(search_value, {...params, fc: 1}); return this.filesSearchAll(search_value, {...params, fc: 1});
} }
static async handleDir(routes) { static async handleDir(routes) {
var _a; var _a;
if (routes.length === 1 && /^\d{5,}$/.test(routes[0])) return routes[0]; if (routes.length === 1 && /^\d{5,}$/.test(routes[0])) return routes[0];
@@ -8303,7 +8225,6 @@ ${value}\r
} }
return {videos: videos.filter(filter), file_id}; return {videos: videos.filter(filter), file_id};
} }
static async handleClean(keepFiles, cid) { static async handleClean(keepFiles, cid) {
const needMove = keepFiles.filter((file) => file.cid !== cid).map((file) => file.fid); const needMove = keepFiles.filter((file) => file.cid !== cid).map((file) => file.fid);
if (needMove.length) await this.filesMove(needMove, cid); if (needMove.length) await this.filesMove(needMove, cid);
@@ -8311,7 +8232,6 @@ ${value}\r
const needRemove = data.filter((item) => !keepFiles.some((file) => file.fid === item.fid)).map((item) => item.fid ?? item.cid); const needRemove = data.filter((item) => !keepFiles.some((file) => file.fid === item.fid)).map((item) => item.fid ?? item.cid);
if (needRemove.length) return this.rbDelete(needRemove, cid); if (needRemove.length) return this.rbDelete(needRemove, cid);
} }
static async handleTags(files, tags) { static async handleTags(files, tags) {
var _a; var _a;
const {data} = await this.labelList(); const {data} = await this.labelList();
@@ -8354,7 +8274,6 @@ ${value}\r
} }
return this.filesBatchRename(renameObj); return this.filesBatchRename(renameObj);
} }
static async handleCover(url, cid, filename) { static async handleCover(url, cid, filename) {
const file = await this.request({url, timeout: 6e4, responseType: "blob"}); const file = await this.request({url, timeout: 6e4, responseType: "blob"});
if (!file) return; if (!file) return;
@@ -8415,12 +8334,10 @@ ${value}\r
} }
return res; return res;
} }
static async queueMutation(name2, fn) { static async queueMutation(name2, fn) {
return fn(); return fn();
} }
} }
window.Req115 = Req115; window.Req115 = Req115;
class Fc2Plugin extends BasePlugin { class Fc2Plugin extends BasePlugin {
getName() { getName() {
@@ -8664,7 +8581,6 @@ ${value}\r
getName() { getName() {
return "HighlightMagnetPlugin"; return "HighlightMagnetPlugin";
} }
parseDateFromAttr(dateStr) { parseDateFromAttr(dateStr) {
if (!dateStr) return 0; if (!dateStr) return 0;
if (dateStr.length === 8) { if (dateStr.length === 8) {
@@ -8677,7 +8593,6 @@ ${value}\r
const d = new Date(dateStr); const d = new Date(dateStr);
return isNaN(d.getTime()) ? 0 : d.getTime(); return isNaN(d.getTime()) ? 0 : d.getTime();
} }
parseSizeToBytes(sizeText) { parseSizeToBytes(sizeText) {
if (!sizeText) return 0; if (!sizeText) return 0;
const s = sizeText.trim().toUpperCase(); const s = sizeText.trim().toUpperCase();
@@ -8689,7 +8604,6 @@ ${value}\r
if (s.includes("KB")) return num * 1024; if (s.includes("KB")) return num * 1024;
return num; return num;
} }
getRowInfo(row) { getRowInfo(row) {
const $row = $(row); const $row = $(row);
const nameText = $row.find(".name").text().toLowerCase(); const nameText = $row.find(".name").text().toLowerCase();
@@ -8713,7 +8627,6 @@ ${value}\r
isUncensored: nameText.includes("无码") || nameText.includes("無碼") || nameText.includes("-u") || nameText.includes("-uc") || tags.includes("无码") || tags.includes("無碼") isUncensored: nameText.includes("无码") || nameText.includes("無碼") || nameText.includes("-u") || nameText.includes("-uc") || tags.includes("无码") || tags.includes("無碼")
}; };
} }
getRowInfoForBus(row) { getRowInfoForBus(row) {
const $row = $(row); const $row = $(row);
const $nameCell = $row.find("td:first-child"); const $nameCell = $row.find("td:first-child");
@@ -8736,7 +8649,6 @@ ${value}\r
isUncensored: nameText.includes("无码") || nameText.includes("無碼") || nameText.includes("-u") || nameText.includes("-uc") isUncensored: nameText.includes("无码") || nameText.includes("無碼") || nameText.includes("-u") || nameText.includes("-uc")
}; };
} }
async applySortAndFilter(settings) { async applySortAndFilter(settings) {
if (isJavBus$1) { if (isJavBus$1) {
return this.applySortAndFilterForBus(settings); return this.applySortAndFilterForBus(settings);
@@ -8798,7 +8710,6 @@ ${value}\r
}); });
hiddenInfos.forEach((info) => $(info.row).hide()); hiddenInfos.forEach((info) => $(info.row).hide());
} }
applySortAndFilterForBus(settings) { applySortAndFilterForBus(settings) {
const $table = $("#magnet-table"); const $table = $("#magnet-table");
if (!$table.length) return; if (!$table.length) return;
@@ -8853,7 +8764,6 @@ ${value}\r
}); });
hiddenInfos.forEach((info) => $(info.row).hide()); hiddenInfos.forEach((info) => $(info.row).hide());
} }
showAll() { showAll() {
if (isJavDb$1) { if (isJavDb$1) {
$("#magnets-content .item[data-rank]").toArray().forEach(((el) => { $("#magnets-content .item[data-rank]").toArray().forEach(((el) => {
@@ -9770,7 +9680,6 @@ ${err.stack}` : "");
})); }));
} }
} }
const HLS_SCRIPT_URL = "https://cdn.jsdelivr.net/npm/hls.js@1.5.18/dist/hls.min.js"; const HLS_SCRIPT_URL = "https://cdn.jsdelivr.net/npm/hls.js@1.5.18/dist/hls.min.js";
let hlsLoadPromise = null; let hlsLoadPromise = null;
const getHlsClass = () => { const getHlsClass = () => {
@@ -9841,7 +9750,6 @@ ${err.stack}` : "");
this.loader = null; this.loader = null;
this.stats = this.createStats(); this.stats = this.createStats();
} }
createStats() { createStats() {
return { return {
aborted: false, aborted: false,
@@ -9858,11 +9766,9 @@ ${err.stack}` : "");
buffering: {start: 0, first: 0, end: 0} buffering: {start: 0, first: 0, end: 0}
}; };
} }
destroy() { destroy() {
this.abort(); this.abort();
} }
abort() { abort() {
if (this.stats) this.stats.aborted = true; if (this.stats) this.stats.aborted = true;
if (this.loader) { if (this.loader) {
@@ -9873,7 +9779,6 @@ ${err.stack}` : "");
} }
this.loader = null; this.loader = null;
} }
load(context, config, callbacks) { load(context, config, callbacks) {
this.context = context; this.context = context;
this.callbacks = callbacks; this.callbacks = callbacks;
@@ -9938,7 +9843,6 @@ ${err.stack}` : "");
}); });
} }
} }
return GMHlsLoader; return GMHlsLoader;
}; };
const isM3U8Url = (url) => /\.m3u8(?:[?#].*)?$/i.test(String(url || "")); const isM3U8Url = (url) => /\.m3u8(?:[?#].*)?$/i.test(String(url || ""));
@@ -10173,12 +10077,10 @@ ${err.stack}` : "");
} }
return null; return null;
}; };
class JavxyPreviewVideoPlugin extends BasePlugin { class JavxyPreviewVideoPlugin extends BasePlugin {
getName() { getName() {
return "JavxyPreviewVideoPlugin"; return "JavxyPreviewVideoPlugin";
} }
_attachVideoSrc(videoEl, src) { _attachVideoSrc(videoEl, src) {
if (!videoEl || !src) return; if (!videoEl || !src) return;
destroyHls(videoEl); destroyHls(videoEl);
@@ -10209,7 +10111,6 @@ ${err.stack}` : "");
videoEl.load && videoEl.load(); videoEl.load && videoEl.load();
} }
} }
_selectDefaultQuality(qualityList, intendedDefault) { _selectDefaultQuality(qualityList, intendedDefault) {
if (!qualityList || qualityList.length === 0) return null; if (!qualityList || qualityList.length === 0) return null;
const availableSet = new Set(qualityList); const availableSet = new Set(qualityList);
@@ -10218,7 +10119,6 @@ ${err.stack}` : "");
for (const q of priorityOrder) if (availableSet.has(q)) return q; for (const q of priorityOrder) if (availableSet.has(q)) return q;
return qualityList[0]; return qualityList[0];
} }
async initCss() { async initCss() {
return ` return `
.jhs-javxy-video-modal { .jhs-javxy-video-modal {
@@ -10257,14 +10157,12 @@ ${err.stack}` : "");
} }
`; `;
} }
async handle() { async handle() {
if (!window.isDetailPage) return; if (!window.isDetailPage) return;
const carNum2 = this.getPageInfo().carNum; const carNum2 = this.getPageInfo().carNum;
if (!carNum2) return; if (!carNum2) return;
this._addJavxyButton(carNum2); this._addJavxyButton(carNum2);
} }
_addJavxyButton(carNum2) { _addJavxyButton(carNum2) {
let $target = null; let $target = null;
if (isJavDb$1) { if (isJavDb$1) {
@@ -10300,7 +10198,6 @@ ${err.stack}` : "");
}); });
$target.after($btn); $target.after($btn);
} }
async _openJavxyPlayer(carNum2) { async _openJavxyPlayer(carNum2) {
if ($("#jhs-javxy-video-modal").length === 0) { if ($("#jhs-javxy-video-modal").length === 0) {
$("body").append(` $("body").append(`
@@ -11007,7 +10904,6 @@ ${err.stack}` : "");
return results; return results;
} }
} }
const Thumbnail = { const Thumbnail = {
sources: ["javfree", "projectjav", "javstore"], sources: ["javfree", "projectjav", "javstore"],
cacheKey(code) { cacheKey(code) {
@@ -11205,7 +11101,6 @@ ${err.stack}` : "");
} }
}; };
let previewOverlay = null; let previewOverlay = null;
function showPreviewOverlay$1(imgUrl, code, source = null) { function showPreviewOverlay$1(imgUrl, code, source = null) {
if (previewOverlay) { if (previewOverlay) {
previewOverlay.close(); previewOverlay.close();
@@ -11336,16 +11231,13 @@ ${err.stack}` : "");
document.body.appendChild(toolbar); document.body.appendChild(toolbar);
previewOverlay = {container, toolbar, close: closeOverlay}; previewOverlay = {container, toolbar, close: closeOverlay};
} }
class ScreenShotPlugin extends BasePlugin { class ScreenShotPlugin extends BasePlugin {
getName() { getName() {
return "ScreenShotPlugin"; return "ScreenShotPlugin";
} }
async handle() { async handle() {
this.loadScreenShot().then(); this.loadScreenShot().then();
} }
async loadScreenShot() { async loadScreenShot() {
if (!window.isDetailPage) return; if (!window.isDetailPage) return;
if ("yes" !== await storageManager.getSetting("enableLoadScreenShot", "yes")) return; if ("yes" !== await storageManager.getSetting("enableLoadScreenShot", "yes")) return;
@@ -11368,21 +11260,17 @@ ${err.stack}` : "");
this.showErrorFallback(carNum2, e); this.showErrorFallback(carNum2, e);
} }
} }
async getScreenshot(carNum2) { async getScreenshot(carNum2) {
const result = await Thumbnail.get(carNum2); const result = await Thumbnail.get(carNum2);
if (result.url) return result.url; if (result.url) return result.url;
throw new Error("未找到预览图"); throw new Error("未找到预览图");
} }
async getJavStoreScreenShot(carNum2) { async getJavStoreScreenShot(carNum2) {
return await Thumbnail.javstore(carNum2); return await Thumbnail.javstore(carNum2);
} }
async getJavFreeScreenShot(carNum2) { async getJavFreeScreenShot(carNum2) {
return await Thumbnail.javfree(carNum2); return await Thumbnail.javfree(carNum2);
} }
addImg(title, imgUrl, code, source) { addImg(title, imgUrl, code, source) {
if (!imgUrl) return; if (!imgUrl) return;
isJavDb$1 && $(".screen-container").html( isJavDb$1 && $(".screen-container").html(
@@ -11397,7 +11285,6 @@ ${err.stack}` : "");
showPreviewOverlay$1(imgUrl, code || title, source); showPreviewOverlay$1(imgUrl, code || title, source);
}); });
} }
showErrorFallback(carNum2, error) { showErrorFallback(carNum2, error) {
var _a, _b; var _a, _b;
console.error("获取缩略图失败:", ((_b = (_a = error == null ? void 0 : error.message) == null ? void 0 : _a.substring) == null ? void 0 : _b.call(_a, 0, 100)) || error); console.error("获取缩略图失败:", ((_b = (_a = error == null ? void 0 : error.message) == null ? void 0 : _a.substring) == null ? void 0 : _b.call(_a, 0, 100)) || error);
@@ -11427,7 +11314,6 @@ ${err.stack}` : "");
}); });
} }
} }
window.showPreviewOverlay = showPreviewOverlay$1; window.showPreviewOverlay = showPreviewOverlay$1;
const getDownPathList = async () => { const getDownPathList = async () => {
const res = await gmHttp.get("https://webapi.115.com/offine/downpath"); const res = await gmHttp.get("https://webapi.115.com/offine/downpath");
@@ -12097,14 +11983,12 @@ ${err.stack}` : "");
} }
} }
} }
async updateMarkBtnStyle($markBtn, carNum2) { async updateMarkBtnStyle($markBtn, carNum2) {
const markedList = await storageManager.forage.getItem("markedDeleteList") || []; const markedList = await storageManager.forage.getItem("markedDeleteList") || [];
const isMarked = markedList.some((item) => item.carNum === carNum2); const isMarked = markedList.some((item) => item.carNum === carNum2);
isMarked ? $markBtn.addClass("marked") : $markBtn.removeClass("marked"); isMarked ? $markBtn.addClass("marked") : $markBtn.removeClass("marked");
$markBtn.attr("title", isMarked ? "取消标记删除" : "标记删除"); $markBtn.attr("title", isMarked ? "取消标记删除" : "标记删除");
} }
async batchDeleteMarked(selectedItems, onProgress) { async batchDeleteMarked(selectedItems, onProgress) {
let deletedCount = 0; let deletedCount = 0;
let failedCount = 0; let failedCount = 0;
@@ -12166,7 +12050,6 @@ ${err.stack}` : "");
} }
return {deletedCount, failedCount}; return {deletedCount, failedCount};
} }
isRateLimited(response) { isRateLimited(response) {
if (!response) return false; if (!response) return false;
if (response.state === false) { if (response.state === false) {
@@ -12180,7 +12063,6 @@ ${err.stack}` : "");
} }
return false; return false;
} }
async _deleteOne(deleteId, isFile, batchIndex, selectedItems, item, onProgress) { async _deleteOne(deleteId, isFile, batchIndex, selectedItems, item, onProgress) {
let retryCount = 0; let retryCount = 0;
const maxRetries = 3; const maxRetries = 3;
@@ -12763,7 +12645,6 @@ ${err.stack}` : "");
$container.empty().append(items); $container.empty().append(items);
} }
} }
async initOneTimeSortBtn() { async initOneTimeSortBtn() {
const autoPage = await storageManager.getSetting("autoPage"); const autoPage = await storageManager.getSetting("autoPage");
if (autoPage !== YES) { if (autoPage !== YES) {
@@ -12779,7 +12660,6 @@ ${err.stack}` : "");
}[oneTimeMethod]; }[oneTimeMethod];
$("#one-time-sort-btn").text(`一次性排序: ${methodText}`).show(); $("#one-time-sort-btn").text(`一次性排序: ${methodText}`).show();
} }
async oneTimeSortItems() { async oneTimeSortItems() {
if (currentHref$1.includes("handle") || currentHref$1.includes("advanced_search")) return; if (currentHref$1.includes("handle") || currentHref$1.includes("advanced_search")) return;
if (isSearchPage) return; if (isSearchPage) return;
@@ -12968,70 +12848,66 @@ ${err.stack}` : "");
__publicField2(this, "warnBackgroundColor", "#d7a80c"); __publicField2(this, "warnBackgroundColor", "#d7a80c");
__publicField2(this, "domainErrorBackgroundColor", "#d7780c"); __publicField2(this, "domainErrorBackgroundColor", "#d7780c");
__publicField2(this, "asyncQueue", new AsyncQueue()); __publicField2(this, "asyncQueue", new AsyncQueue());
__publicField2(this, "siteConfigs", [{ __publicField2(this, "siteConfigs", [
id: "javTrailersBtn", {
getBaseUrl: async () => await this.getJavTrailersUrl(), id: "MissAvBtn",
itemSelector: ".videos-list .video-link", getBaseUrl: async () => await this.getMissAvUrl(),
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: ($box2) => $box2.attr("href"), getDetailPageHref: ($box2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.find("p.card-text").text() findCarNumOrTitle: ($box2) => $box2.text()
}, { },
{
id: "123AvBtn", id: "123AvBtn",
getBaseUrl: async () => await this.getAv123Url() + "/ja", getBaseUrl: async () => await this.getAv123Url() + "/ja",
itemSelector: ".box-item", itemSelector: ".box-item",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search?keyword=${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search?keyword=${carNum2}`,
getDetailPageHref: ($box2) => $box2.find(".detail a").attr("href"), getDetailPageHref: ($box2) => $box2.find(".detail a").attr("href"),
findCarNumOrTitle: ($box2) => $box2.find("img").attr("title") findCarNumOrTitle: ($box2) => $box2.find("img").attr("title")
}, { },
id: "jableBtn", {
id: "JableBtn",
getBaseUrl: async () => await this.getjableUrl(), getBaseUrl: async () => await this.getjableUrl(),
itemSelector: "#list_videos_videos_list_search_result .detail .title a", itemSelector: "#list_videos_videos_list_search_result .detail .title a",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}/`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}/`,
getDetailPageHref: ($box2) => $box2.attr("href"), getDetailPageHref: ($box2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.text() findCarNumOrTitle: ($box2) => $box2.text()
}, { },
id: "avgleBtn", {
getBaseUrl: async () => await this.getAvgleUrl(), id: "SupJavBtn",
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/vod/search.html?wd=${carNum2}`,
getDetailPageHref: ($box2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.text()
}, {
id: "missAvBtn",
getBaseUrl: async () => await this.getMissAvUrl(),
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: ($box2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.text()
}, {
id: "supJavBtn",
getBaseUrl: async () => await this.getSupJavUrl(), getBaseUrl: async () => await this.getSupJavUrl(),
itemSelector: ".posts post", itemSelector: ".posts post",
searchPath: (baseUrl, carNum2) => `${baseUrl}/?s=${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/?s=${carNum2}`,
getDetailPageHref: ($box2, baseUrl, carNum2) => $box2.attr("href"), getDetailPageHref: ($box2, baseUrl, carNum2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.attr("title") findCarNumOrTitle: ($box2) => $box2.attr("title")
}, { },
id: "javDbBtn", {
id: "JavTrailersBtn",
getBaseUrl: async () => await this.getJavTrailersUrl(),
itemSelector: ".videos-list .video-link",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: ($box2) => $box2.attr("href"),
findCarNumOrTitle: ($box2) => $box2.find("p.card-text").text()
},
{
id: "JavDbBtn",
getBaseUrl: async () => await this.getJavDbUrl(), getBaseUrl: async () => await this.getJavDbUrl(),
itemSelector: ".movie-list .item", itemSelector: ".movie-list .item",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search?q=${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search?q=${carNum2}`,
getDetailPageHref: ($box2) => $box2.find("a").attr("href"), getDetailPageHref: ($box2) => $box2.find("a").attr("href"),
findCarNumOrTitle: ($box2) => $box2.find(".video-title").text(), findCarNumOrTitle: ($box2) => $box2.find(".video-title").text(),
condition: (sourceCarNum) => isJavBus$1 condition: (sourceCarNum) => isJavBus$1
}, { },
id: "javBusBtn", {
id: "JavBusBtn",
getBaseUrl: async () => await this.getJavBusUrl(), getBaseUrl: async () => await this.getJavBusUrl(),
itemSelector: ".container h3", itemSelector: ".container h3",
searchPath: (baseUrl, carNum2) => `${baseUrl}/${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/${carNum2}`,
getDetailPageHref: ($box2, baseUrl, carNum2) => `${baseUrl}/${carNum2}`, getDetailPageHref: ($box2, baseUrl, carNum2) => `${baseUrl}/${carNum2}`,
findCarNumOrTitle: ($box2) => $box2.text(), findCarNumOrTitle: ($box2) => $box2.text(),
condition: (sourceCarNum) => isJavDb$1 && sourceCarNum && !sourceCarNum.includes("FC2") condition: (sourceCarNum) => isJavDb$1 && sourceCarNum && !sourceCarNum.includes("FC2")
}, { }
id: "fanzaBtn", ]);
noHandle: true,
initUrl: (carNum2) => `https://www.dmm.co.jp/search/=/searchstr=${carNum2}`,
condition: (sourceCarNum) => sourceCarNum && !sourceCarNum.includes("FC2")
}]);
__publicField2(this, "settingCache", null); __publicField2(this, "settingCache", null);
__publicField2(this, "lastFetchTime", 0); __publicField2(this, "lastFetchTime", 0);
__publicField2(this, "CACHE_DURATION", 1e4); __publicField2(this, "CACHE_DURATION", 1e4);
@@ -13056,7 +12932,7 @@ ${err.stack}` : "");
if (config.condition && false === config.condition(config.sourceCarNum)) return ""; if (config.condition && false === config.condition(config.sourceCarNum)) return "";
return `<a target="_blank" class="site-btn" style="${enabledSites.includes(config.id) ? "" : "display:none"}" id="${config.id}"><span>${config.id.replace("Btn", "")}</span></a>`; return `<a target="_blank" class="site-btn" style="${enabledSites.includes(config.id) ? "" : "display:none"}" id="${config.id}"><span>${config.id.replace("Btn", "")}</span></a>`;
})).join("")} })).join("")}
<a id="settingSiteBtn" class="site-btn"><span>设置</span></a> <a id="settingSiteBtn" class="site-btn"><span>跳转设置</span></a>
</div> </div>
</div> </div>
@@ -13083,23 +12959,7 @@ ${err.stack}` : "");
} }
async handleSite(carNum2, config) { async handleSite(carNum2, config) {
const $btn = $(`#${config.id}`); const $btn = $(`#${config.id}`);
if (config.initUrl) { try {
$btn.attr("href", config.initUrl(carNum2));
$btn.css("backgroundColor", this.warnBackgroundColor);
}
if (config.noHandle && true === config.noHandle) {
const dmmCacheKey = "jhs_other_site_dmm", dmmCachedResult = (localStorage.getItem(dmmCacheKey) ? JSON.parse(localStorage.getItem(dmmCacheKey)) : {})[carNum2];
if (dmmCachedResult) {
if ("single" === dmmCachedResult.type) {
$btn.attr("href", dmmCachedResult.url);
$btn.css("backgroundColor", this.okBackgroundColor);
} else if ("multiple" === dmmCachedResult.type) {
$btn.attr("href", dmmCachedResult.url);
$btn.append('<span class="site-tag" style="top:-15px">多结果</span>');
$btn.css("backgroundColor", this.okBackgroundColor);
}
}
} else try {
if ($btn.attr("href")) return; if ($btn.attr("href")) return;
if (utils.isHidden($btn)) return; if (utils.isHidden($btn)) return;
const cacheKey = "jhs_other_site", cacheData = localStorage.getItem(cacheKey) ? JSON.parse(localStorage.getItem(cacheKey)) : {}, siteKey = carNum2 + "_" + config.id.replace("Btn", ""), cachedResult = cacheData[siteKey]; const cacheKey = "jhs_other_site", cacheData = localStorage.getItem(cacheKey) ? JSON.parse(localStorage.getItem(cacheKey)) : {}, siteKey = carNum2 + "_" + config.id.replace("Btn", ""), cachedResult = cacheData[siteKey];
@@ -13188,9 +13048,6 @@ ${err.stack}` : "");
async getjableUrl() { async getjableUrl() {
return (await this.getSettingCache()).jableUrl || "https://jable.tv"; return (await this.getSettingCache()).jableUrl || "https://jable.tv";
} }
async getAvgleUrl() {
return (await this.getSettingCache()).avgleUrl || "https://jav.rs";
}
async getJavTrailersUrl() { async getJavTrailersUrl() {
return (await this.getSettingCache()).javTrailersUrl || "https://javtrailers.com"; return (await this.getSettingCache()).javTrailersUrl || "https://javtrailers.com";
} }
@@ -13592,9 +13449,6 @@ ${err.stack}` : "");
<a class="site-btn site-jable" style="color:white !important;margin-bottom: 5px;background-color:#71bb59;"> <a class="site-btn site-jable" style="color:white !important;margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;">Jable</span> <span style="opacity: 1;">Jable</span>
</a> </a>
<a class="site-btn site-avgle" style="margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;">Avgle</span>
</a>
<a class="site-btn site-miss-av" style="color:white !important;margin-bottom: 5px;background-color:#71bb59;"> <a class="site-btn site-miss-av" style="color:white !important;margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;">MissAv</span> <span style="opacity: 1;">MissAv</span>
</a> </a>
@@ -13656,9 +13510,6 @@ ${err.stack}` : "");
<a class="site-btn site-jable" style="color:white;margin-bottom: 5px;background-color:#71bb59;"> <a class="site-btn site-jable" style="color:white;margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;display: inline; color:white !important">Jable</span> <span style="opacity: 1;display: inline; color:white !important">Jable</span>
</a> </a>
<a class="site-btn site-avgle" style="margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;display: inline; color:white !important">Avgle</span>
</a>
<a class="site-btn site-miss-av" style="color:white;margin-bottom: 5px;background-color:#71bb59;"> <a class="site-btn site-miss-av" style="color:white;margin-bottom: 5px;background-color:#71bb59;">
<span style="opacity: 1;display: inline; color:white !important">MissAv</span> <span style="opacity: 1;display: inline; color:white !important">MissAv</span>
</a> </a>
@@ -13785,13 +13636,14 @@ ${err.stack}` : "");
$btn.hasClass("filterBtn") ? utils.q(event, `是否屏蔽${carNum2}?`, (() => handleAction(Status_FILTER$1))) : $btn.hasClass("favoriteBtn") ? handleAction(Status_FAVORITE$1).then() : $btn.hasClass("hasDownBtn") ? handleAction(Status_HAS_DOWN$1).then() : $btn.hasClass("hasWatchBtn") && handleAction(Status_HAS_WATCH$1).then(); $btn.hasClass("filterBtn") ? utils.q(event, `是否屏蔽${carNum2}?`, (() => handleAction(Status_FILTER$1))) : $btn.hasClass("favoriteBtn") ? handleAction(Status_FAVORITE$1).then() : $btn.hasClass("hasDownBtn") ? handleAction(Status_HAS_DOWN$1).then() : $btn.hasClass("hasWatchBtn") && handleAction(Status_HAS_WATCH$1).then();
$(".more-tools").stop(true, true).removeClass("elastic-in").addClass("elastic-out").hide(); $(".more-tools").stop(true, true).removeClass("elastic-in").addClass("elastic-out").hide();
})); }));
const otherSitePlugin = this.getBean("OtherSitePlugin"), missAvUrl = await otherSitePlugin.getMissAvUrl(), jableUrl = await otherSitePlugin.getjableUrl(), avgleUrl = await otherSitePlugin.getAvgleUrl(), av123Url = await otherSitePlugin.getAv123Url(); const otherSitePlugin = this.getBean("OtherSitePlugin"), missAvUrl = await otherSitePlugin.getMissAvUrl(),
$(document).on("click", ".site-jable, .site-avgle, .site-miss-av, .site-123-av", ((event) => { jableUrl = await otherSitePlugin.getjableUrl(), av123Url = await otherSitePlugin.getAv123Url();
$(document).on("click", ".site-jable, .site-miss-av, .site-123-av", ((event) => {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
const $currentTarget = $(event.currentTarget), $box2 = $currentTarget.closest(".item"), { carNum: carNum2 } = this.getBoxCarInfo($box2); const $currentTarget = $(event.currentTarget), $box2 = $currentTarget.closest(".item"), { carNum: carNum2 } = this.getBoxCarInfo($box2);
let url = null; let url = null;
$currentTarget.hasClass("site-jable") ? url = `${jableUrl}/search/${carNum2}/` : $currentTarget.hasClass("site-avgle") ? url = `${avgleUrl}/vod/search.html?wd=${carNum2}` : $currentTarget.hasClass("site-miss-av") ? url = `${missAvUrl}/search/${carNum2}` : $currentTarget.hasClass("site-123-av") && (url = `${av123Url}/ja/search?keyword=${carNum2}`); $currentTarget.hasClass("site-jable") ? url = `${jableUrl}/search/${carNum2}/` : $currentTarget.hasClass("site-miss-av") ? url = `${missAvUrl}/search/${carNum2}` : $currentTarget.hasClass("site-123-av") && (url = `${av123Url}/ja/search?keyword=${carNum2}`);
event && (event.ctrlKey || event.metaKey) ? _GM_openInTab(url, { event && (event.ctrlKey || event.metaKey) ? _GM_openInTab(url, {
insert: 0 insert: 0
}) : window.open(url); }) : window.open(url);
@@ -14440,7 +14292,6 @@ ${err.stack}` : "");
window.JavPackSubtitle.preload115Matches(carNum2); window.JavPackSubtitle.preload115Matches(carNum2);
this.showStatus(carNum2).then(); this.showStatus(carNum2).then();
} }
async openMagnetSortFilterPanel(highlightMagnetPlugin) { async openMagnetSortFilterPanel(highlightMagnetPlugin) {
const existingPanel = document.getElementById("magnet-sort-filter-panel"); const existingPanel = document.getElementById("magnet-sort-filter-panel");
if (existingPanel) { if (existingPanel) {
@@ -14693,7 +14544,6 @@ ${err.stack}` : "");
window.refresh(); window.refresh();
utils.closePage(); utils.closePage();
} }
/* /*
searchXunLeiSubtitle(carNum2) { searchXunLeiSubtitle(carNum2) {
let loadObj = loading(); let loadObj = loading();
File diff suppressed because one or more lines are too long
+58 -59
View File
@@ -1,6 +1,6 @@
import { BasePlugin } from '../core/base-plugin.js'; import {BasePlugin} from '../core/base-plugin.js';
import { __publicField, isJavBus, isJavDb } from '../core/constants.js'; import {__publicField, isJavBus, isJavDb} from '../core/constants.js';
import { AsyncQueue } from '../core/utils.js'; import {AsyncQueue} from '../core/utils.js';
class OtherSitePlugin extends BasePlugin { class OtherSitePlugin extends BasePlugin {
constructor() { constructor() {
@@ -10,13 +10,14 @@ class OtherSitePlugin extends BasePlugin {
__publicField(this, "warnBackgroundColor", "#d7a80c"); __publicField(this, "warnBackgroundColor", "#d7a80c");
__publicField(this, "domainErrorBackgroundColor", "#d7780c"); __publicField(this, "domainErrorBackgroundColor", "#d7780c");
__publicField(this, "asyncQueue", new AsyncQueue); __publicField(this, "asyncQueue", new AsyncQueue);
__publicField(this, "siteConfigs", [ { __publicField(this, "siteConfigs", [
id: "javTrailersBtn", {
getBaseUrl: async () => await this.getJavTrailersUrl(), id: "MissAvBtn",
itemSelector: ".videos-list .video-link", getBaseUrl: async () => await this.getMissAvUrl(),
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: $box2 => $box2.attr("href"), getDetailPageHref: $box2 => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.find("p.card-text").text() findCarNumOrTitle: $box2 => $box2.text()
}, { }, {
id: "123AvBtn", id: "123AvBtn",
getBaseUrl: async () => await this.getAv123Url() + "/ja", getBaseUrl: async () => await this.getAv123Url() + "/ja",
@@ -25,35 +26,31 @@ class OtherSitePlugin extends BasePlugin {
getDetailPageHref: $box2 => $box2.find(".detail a").attr("href"), getDetailPageHref: $box2 => $box2.find(".detail a").attr("href"),
findCarNumOrTitle: $box2 => $box2.find("img").attr("title") findCarNumOrTitle: $box2 => $box2.find("img").attr("title")
}, { }, {
id: "jableBtn", id: "JableBtn",
getBaseUrl: async () => await this.getjableUrl(), getBaseUrl: async () => await this.getjableUrl(),
itemSelector: "#list_videos_videos_list_search_result .detail .title a", itemSelector: "#list_videos_videos_list_search_result .detail .title a",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}/`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}/`,
getDetailPageHref: $box2 => $box2.attr("href"), getDetailPageHref: $box2 => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.text() findCarNumOrTitle: $box2 => $box2.text()
}, { }, {
id: "avgleBtn", id: "SupJavBtn",
getBaseUrl: async () => await this.getAvgleUrl(),
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/vod/search.html?wd=${carNum2}`,
getDetailPageHref: $box2 => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.text()
}, {
id: "missAvBtn",
getBaseUrl: async () => await this.getMissAvUrl(),
itemSelector: ".text-secondary",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: $box2 => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.text()
}, {
id: "supJavBtn",
getBaseUrl: async () => await this.getSupJavUrl(), getBaseUrl: async () => await this.getSupJavUrl(),
itemSelector: ".posts post", itemSelector: ".posts post",
searchPath: (baseUrl, carNum2) => `${baseUrl}/?s=${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/?s=${carNum2}`,
getDetailPageHref: ($box2, baseUrl, carNum2) => $box2.attr("href"), getDetailPageHref: ($box2, baseUrl, carNum2) => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.attr("title") findCarNumOrTitle: $box2 => $box2.attr("title")
}, { },
id: "javDbBtn", {
id: "JavTrailersBtn",
getBaseUrl: async () => await this.getJavTrailersUrl(),
itemSelector: ".videos-list .video-link",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search/${carNum2}`,
getDetailPageHref: $box2 => $box2.attr("href"),
findCarNumOrTitle: $box2 => $box2.find("p.card-text").text()
},
{
id: "JavDbBtn",
getBaseUrl: async () => await this.getJavDbUrl(), getBaseUrl: async () => await this.getJavDbUrl(),
itemSelector: ".movie-list .item", itemSelector: ".movie-list .item",
searchPath: (baseUrl, carNum2) => `${baseUrl}/search?q=${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/search?q=${carNum2}`,
@@ -61,47 +58,49 @@ class OtherSitePlugin extends BasePlugin {
findCarNumOrTitle: $box2 => $box2.find(".video-title").text(), findCarNumOrTitle: $box2 => $box2.find(".video-title").text(),
condition: sourceCarNum => isJavBus condition: sourceCarNum => isJavBus
}, { }, {
id: "javBusBtn", id: "JavBusBtn",
getBaseUrl: async () => await this.getJavBusUrl(), getBaseUrl: async () => await this.getJavBusUrl(),
itemSelector: ".container h3", itemSelector: ".container h3",
searchPath: (baseUrl, carNum2) => `${baseUrl}/${carNum2}`, searchPath: (baseUrl, carNum2) => `${baseUrl}/${carNum2}`,
getDetailPageHref: ($box2, baseUrl, carNum2) => `${baseUrl}/${carNum2}`, getDetailPageHref: ($box2, baseUrl, carNum2) => `${baseUrl}/${carNum2}`,
findCarNumOrTitle: $box2 => $box2.text(), findCarNumOrTitle: $box2 => $box2.text(),
condition: sourceCarNum => isJavDb && sourceCarNum && !sourceCarNum.includes("FC2") condition: sourceCarNum => isJavDb && sourceCarNum && !sourceCarNum.includes("FC2")
}, { }]);
id: "fanzaBtn",
noHandle: !0,
initUrl: carNum2 => `https://www.dmm.co.jp/search/=/searchstr=${carNum2}`,
condition: sourceCarNum => sourceCarNum && !sourceCarNum.includes("FC2")
} ]);
__publicField(this, "settingCache", null); __publicField(this, "settingCache", null);
__publicField(this, "lastFetchTime", 0); __publicField(this, "lastFetchTime", 0);
__publicField(this, "CACHE_DURATION", 1e4); __publicField(this, "CACHE_DURATION", 1e4);
} }
getName() { getName() {
return "OtherSitePlugin"; return "OtherSitePlugin";
} }
async initCss() { async initCss() {
return "\n <style>\n .site-btn {\n position: relative !important;\n min-width: 80px;\n display: inline-block;\n padding: 5px 10px;\n color: white !important;\n background-color:#938585;\n text-decoration: none;\n border-radius: 4px;\n text-align: center;\n margin-bottom: 5px;\n }\n .site-btn:hover {\n color: white;\n transform: translateY(-2px);\n box-shadow: 0 2px 5px rgba(0,0,0,0.1);\n }\n .site-tag {\n position: absolute; \n top: -15px; \n right: 0; \n background-color: #ffc107; \n color: #333; \n font-size: 12px; \n padding: 2px 6px; \n border-radius: 4px;\n }\n </style>\n "; return "\n <style>\n .site-btn {\n position: relative !important;\n min-width: 80px;\n display: inline-block;\n padding: 5px 10px;\n color: white !important;\n background-color:#938585;\n text-decoration: none;\n border-radius: 4px;\n text-align: center;\n margin-bottom: 5px;\n }\n .site-btn:hover {\n color: white;\n transform: translateY(-2px);\n box-shadow: 0 2px 5px rgba(0,0,0,0.1);\n }\n .site-tag {\n position: absolute; \n top: -15px; \n right: 0; \n background-color: #ffc107; \n color: #333; \n font-size: 12px; \n padding: 2px 6px; \n border-radius: 4px;\n }\n </style>\n ";
} }
async handle() { async handle() {
window.isDetailPage && this.loadOtherSite().then(); window.isDetailPage && this.loadOtherSite().then();
} }
async loadOtherSite(carNum2, sourceCarNum) { async loadOtherSite(carNum2, sourceCarNum) {
if ("yes" !== await storageManager.getSetting("enableLoadOtherSite", "yes")) return; if ("yes" !== await storageManager.getSetting("enableLoadOtherSite", "yes")) return;
carNum2 || (carNum2 = this.getPageInfo().carNum); carNum2 || (carNum2 = this.getPageInfo().carNum);
const enabledSites = this.getEnabledSites(), html = `\n <div id="otherSiteBox" class="panel-block" style="${isJavDb ? "margin-top:8px;font-size:13px" : "margin-top:10px;font-size:13px"}; user-select: none; ">\n <div style="display: flex;gap: 5px;flex-wrap: wrap">\n ${this.siteConfigs.map((config => { const enabledSites = this.getEnabledSites(),
html = `\n <div id="otherSiteBox" class="panel-block" style="${isJavDb ? "margin-top:8px;font-size:13px" : "margin-top:10px;font-size:13px"}; user-select: none; ">\n <div style="display: flex;gap: 5px;flex-wrap: wrap">\n ${this.siteConfigs.map((config => {
config.sourceCarNum = sourceCarNum; config.sourceCarNum = sourceCarNum;
if (config.condition && !1 === config.condition(config.sourceCarNum)) return ""; if (config.condition && !1 === config.condition(config.sourceCarNum)) return "";
return `<a target="_blank" class="site-btn" style="${enabledSites.includes(config.id) ? "" : "display:none"}" id="${config.id}"><span>${config.id.replace("Btn", "")}</span></a>`; return `<a target="_blank" class="site-btn" style="${enabledSites.includes(config.id) ? "" : "display:none"}" id="${config.id}"><span>${config.id.replace("Btn", "")}</span></a>`;
})).join("")}\n <a id="settingSiteBtn" class="site-btn"><span>设置</span></a>\n </div>\n </div>\n \n <div id="settingsArea" class="panel-block" style="display: none; margin-top:10px; margin-bottom: 10px; user-select: none; ">\n <div id="siteCheckboxes" style="display: flex;gap: 5px;flex-wrap: wrap">\n </div>\n </div>\n `; })).join("")}\n <a id="settingSiteBtn" class="site-btn"><span>跳转设置</span></a>\n </div>\n </div>\n \n <div id="settingsArea" class="panel-block" style="display: none; margin-top:10px; margin-bottom: 10px; user-select: none; ">\n <div id="siteCheckboxes" style="display: flex;gap: 5px;flex-wrap: wrap">\n </div>\n </div>\n `;
$(".movie-panel-info").append(html); $(".movie-panel-info").append(html);
$(".container .info").append(html); $(".container .info").append(html);
$("#javTrailersBtn").on("click", (async event => { $("#javTrailersBtn").on("click", (async event => {
event.preventDefault(); event.preventDefault();
let settingObj = await storageManager.getSetting(); let settingObj = await storageManager.getSetting();
const filterHotKey = settingObj.filterHotKey, favoriteHotKey = settingObj.favoriteHotKey, speedVideoHotKey = settingObj.speedVideoHotKey; const filterHotKey = settingObj.filterHotKey, favoriteHotKey = settingObj.favoriteHotKey,
let href = $("#javTrailersBtn").attr("href"), url = href + `?handle=1&filterHotKey=${filterHotKey}&favoriteHotKey=${favoriteHotKey}&speedVideoHotKey=${speedVideoHotKey}`; speedVideoHotKey = settingObj.speedVideoHotKey;
let href = $("#javTrailersBtn").attr("href"),
url = href + `?handle=1&filterHotKey=${filterHotKey}&favoriteHotKey=${favoriteHotKey}&speedVideoHotKey=${speedVideoHotKey}`;
event && (event.ctrlKey || event.metaKey) && (url = href); event && (event.ctrlKey || event.metaKey) && (url = href);
utils.openPage(url, carNum2, !1, event); utils.openPage(url, carNum2, !1, event);
})); }));
@@ -111,26 +110,15 @@ class OtherSitePlugin extends BasePlugin {
this.renderSettingsArea(); this.renderSettingsArea();
this.setupEventListeners(); this.setupEventListeners();
} }
async handleSite(carNum2, config) { async handleSite(carNum2, config) {
const $btn = $(`#${config.id}`); const $btn = $(`#${config.id}`);
if (config.initUrl) { try {
$btn.attr("href", config.initUrl(carNum2));
$btn.css("backgroundColor", this.warnBackgroundColor);
}
if (config.noHandle && !0 === config.noHandle) {
const dmmCacheKey = "jhs_other_site_dmm", dmmCachedResult = (localStorage.getItem(dmmCacheKey) ? JSON.parse(localStorage.getItem(dmmCacheKey)) : {})[carNum2];
if (dmmCachedResult) if ("single" === dmmCachedResult.type) {
$btn.attr("href", dmmCachedResult.url);
$btn.css("backgroundColor", this.okBackgroundColor);
} else if ("multiple" === dmmCachedResult.type) {
$btn.attr("href", dmmCachedResult.url);
$btn.append('<span class="site-tag" style="top:-15px">多结果</span>');
$btn.css("backgroundColor", this.okBackgroundColor);
}
} else try {
if ($btn.attr("href")) return; if ($btn.attr("href")) return;
if (utils.isHidden($btn)) return; if (utils.isHidden($btn)) return;
const cacheKey = "jhs_other_site", cacheData = localStorage.getItem(cacheKey) ? JSON.parse(localStorage.getItem(cacheKey)) : {}, siteKey = carNum2 + "_" + config.id.replace("Btn", ""), cachedResult = cacheData[siteKey]; const cacheKey = "jhs_other_site",
cacheData = localStorage.getItem(cacheKey) ? JSON.parse(localStorage.getItem(cacheKey)) : {},
siteKey = carNum2 + "_" + config.id.replace("Btn", ""), cachedResult = cacheData[siteKey];
if (cachedResult) { if (cachedResult) {
if ("single" === cachedResult.type) { if ("single" === cachedResult.type) {
$btn.attr("href", cachedResult.url); $btn.attr("href", cachedResult.url);
@@ -144,7 +132,8 @@ class OtherSitePlugin extends BasePlugin {
} }
const baseUrl = await config.getBaseUrl(), searchUrl = config.searchPath(baseUrl, carNum2); const baseUrl = await config.getBaseUrl(), searchUrl = config.searchPath(baseUrl, carNum2);
$btn.attr("href", searchUrl); $btn.attr("href", searchUrl);
const html = await gmHttp.get(searchUrl, null, config.headers, !0), $dom = utils.htmlTo$dom(html), resultUrlList = []; const html = await gmHttp.get(searchUrl, null, config.headers, !0), $dom = utils.htmlTo$dom(html),
resultUrlList = [];
$dom.find(config.itemSelector).each(((index, element) => { $dom.find(config.itemSelector).each(((index, element) => {
const $box2 = $(element); const $box2 = $(element);
if (!config.findCarNumOrTitle($box2).toLowerCase().includes(carNum2.toLowerCase())) return; if (!config.findCarNumOrTitle($box2).toLowerCase().includes(carNum2.toLowerCase())) return;
@@ -202,6 +191,7 @@ class OtherSitePlugin extends BasePlugin {
} }
} }
} }
async getSettingCache() { async getSettingCache() {
const now = Date.now(); const now = Date.now();
if (!this.settingCache || now - this.lastFetchTime > this.CACHE_DURATION) { if (!this.settingCache || now - this.lastFetchTime > this.CACHE_DURATION) {
@@ -210,37 +200,44 @@ class OtherSitePlugin extends BasePlugin {
} }
return this.settingCache; return this.settingCache;
} }
async getMissAvUrl() { async getMissAvUrl() {
return (await this.getSettingCache()).missAvUrl || "https://missav.live"; return (await this.getSettingCache()).missAvUrl || "https://missav.live";
} }
async getjableUrl() { async getjableUrl() {
return (await this.getSettingCache()).jableUrl || "https://jable.tv"; return (await this.getSettingCache()).jableUrl || "https://jable.tv";
} }
async getAvgleUrl() {
return (await this.getSettingCache()).avgleUrl || "https://jav.rs";
}
async getJavTrailersUrl() { async getJavTrailersUrl() {
return (await this.getSettingCache()).javTrailersUrl || "https://javtrailers.com"; return (await this.getSettingCache()).javTrailersUrl || "https://javtrailers.com";
} }
async getAv123Url() { async getAv123Url() {
return (await this.getSettingCache()).av123Url || "https://123av.com"; return (await this.getSettingCache()).av123Url || "https://123av.com";
} }
async getJavDbUrl() { async getJavDbUrl() {
return (await this.getSettingCache()).javDbUrl || "https://javdb.com"; return (await this.getSettingCache()).javDbUrl || "https://javdb.com";
} }
async getJavBusUrl() { async getJavBusUrl() {
return (await this.getSettingCache()).javBusUrl || "https://www.javbus.com"; return (await this.getSettingCache()).javBusUrl || "https://www.javbus.com";
} }
async getSupJavUrl() { async getSupJavUrl() {
return (await this.getSettingCache()).supJavUrl || "https://supjav.com"; return (await this.getSettingCache()).supJavUrl || "https://supjav.com";
} }
getEnabledSites() { getEnabledSites() {
const enabledSites = localStorage.getItem("jhs_enabled_sites"); const enabledSites = localStorage.getItem("jhs_enabled_sites");
return enabledSites ? JSON.parse(enabledSites) : this.siteConfigs.map((c => c.id)); return enabledSites ? JSON.parse(enabledSites) : this.siteConfigs.map((c => c.id));
} }
saveEnabledSites(sites) { saveEnabledSites(sites) {
localStorage.setItem("jhs_enabled_sites", JSON.stringify(sites)); localStorage.setItem("jhs_enabled_sites", JSON.stringify(sites));
} }
renderSettingsArea() { renderSettingsArea() {
const enabledSites = this.getEnabledSites(), checkboxesDiv = document.getElementById("siteCheckboxes"); const enabledSites = this.getEnabledSites(), checkboxesDiv = document.getElementById("siteCheckboxes");
checkboxesDiv && (checkboxesDiv.innerHTML = this.siteConfigs.map((config => { checkboxesDiv && (checkboxesDiv.innerHTML = this.siteConfigs.map((config => {
@@ -248,6 +245,7 @@ class OtherSitePlugin extends BasePlugin {
return `\n <div style="margin-right: 15px; display: flex; align-items: ${isJavDb ? "center" : "flex-start"};">\n <input type="checkbox" id="checkbox-${config.id}" data-site-id="${config.id}" ${isEnabled ? "checked" : ""} style="margin-right: 8px; cursor: pointer;">\n <label for="checkbox-${config.id}" style="color: #333; font-weight: 500; cursor: pointer;">${config.id.replace("Btn", "")}</label>\n </div>\n `; return `\n <div style="margin-right: 15px; display: flex; align-items: ${isJavDb ? "center" : "flex-start"};">\n <input type="checkbox" id="checkbox-${config.id}" data-site-id="${config.id}" ${isEnabled ? "checked" : ""} style="margin-right: 8px; cursor: pointer;">\n <label for="checkbox-${config.id}" style="color: #333; font-weight: 500; cursor: pointer;">${config.id.replace("Btn", "")}</label>\n </div>\n `;
})).join("")); })).join(""));
} }
setupEventListeners() { setupEventListeners() {
const settingsArea = document.getElementById("settingsArea"); const settingsArea = document.getElementById("settingsArea");
document.addEventListener("click", (event => { document.addEventListener("click", (event => {
@@ -261,7 +259,8 @@ class OtherSitePlugin extends BasePlugin {
const siteId = event.target.getAttribute("data-site-id"); const siteId = event.target.getAttribute("data-site-id");
if (event.target.checked) { if (event.target.checked) {
$(`#${siteId}`).show(); $(`#${siteId}`).show();
const carNum2 = this.getPageInfo().carNum, config = this.siteConfigs.find((item => item.id === siteId)); const carNum2 = this.getPageInfo().carNum,
config = this.siteConfigs.find((item => item.id === siteId));
this.handleSite(carNum2, config).then(); this.handleSite(carNum2, config).then();
} else $(`#${siteId}`).hide(); } else $(`#${siteId}`).hide();
const enabledSites = Array.from(settingsArea.querySelectorAll('input[type="checkbox"]:checked')).map((checkbox => checkbox.getAttribute("data-site-id"))); const enabledSites = Array.from(settingsArea.querySelectorAll('input[type="checkbox"]:checked')).map((checkbox => checkbox.getAttribute("data-site-id")));
@@ -272,4 +271,4 @@ class OtherSitePlugin extends BasePlugin {
} }
export { OtherSitePlugin }; export {OtherSitePlugin};
File diff suppressed because one or more lines are too long