mirror of
https://github.com/fireinrain/JHS-enhance.git
synced 2026-10-02 00:46:38 +08:00
新增下载高清封面
This commit is contained in:
Vendored
+74
-3
@@ -1253,6 +1253,15 @@ System.register("./__entry.js", ['jquery', 'localforage', 'toastify-js', 'blueim
|
||||
);
|
||||
insertStyle(mainCss);
|
||||
insertStyle(subtitleModalCss);
|
||||
const isEligibleDmmCoverCode = (value) => {
|
||||
const raw = String(value || "").trim().toUpperCase();
|
||||
if (!/^[A-Z0-9]{2,10}-\d{1,6}$/.test(raw)) return false;
|
||||
const code = raw.replace(/\s+/g, "-").toUpperCase();
|
||||
if (!/^[A-Z0-9]{2,10}-\d{1,6}$/.test(code) || /^FC2-/.test(code)) return false;
|
||||
if (/^\d{6}[-_]\d{2,3}$/.test(code)) return false;
|
||||
if (/^(DUGA|MYWIFE|HEYZO|PACO|10MU|1PONDO|CARIBBEAN|CARIB|TOKYO|GACHI|REAL|JUKU|AKA|NTR)-/.test(code)) return false;
|
||||
return true;
|
||||
};
|
||||
window.$ = window.jQuery = $$1;
|
||||
if (typeof $$1.trim !== "function") {
|
||||
$$1.trim = function (text) {
|
||||
@@ -10418,6 +10427,27 @@ ${err.stack}` : "");
|
||||
return qualityMap;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const fromJavxyCover = async (code) => {
|
||||
const query = String(code || "").trim();
|
||||
if (!query) return null;
|
||||
for (const endpoint of JAVXY_ENDPOINTS) {
|
||||
const params = new URLSearchParams({client: "laosiji-new"});
|
||||
const apiUrl2 = `https://${endpoint.host}/covers/${encodeURIComponent(query)}?${params}`;
|
||||
let r;
|
||||
try {
|
||||
r = await gmHttp.get(apiUrl2, null, {
|
||||
"Accept": "application/json,text/plain,*/*",
|
||||
"X-Javxy-Token": JAVXY_TOKEN
|
||||
}, {timeout: 15e3});
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
if (!r) continue;
|
||||
if ((r == null ? void 0 : r.found) && (r.url || r.cover || r.highCover)) return r;
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
class JavxyPreviewVideoPlugin extends BasePlugin {
|
||||
getName() {
|
||||
@@ -12590,9 +12620,11 @@ ${err.stack}` : "");
|
||||
$(".buttons button[data-clipboard-text*='magnet:']").each(((i, el) => {
|
||||
const $copyBtn = $(el);
|
||||
const magnet = $copyBtn.attr("data-clipboard-text");
|
||||
$copyBtn.css("margin-right", parseInt($copyBtn.css("margin-right")) - 5 + "px");
|
||||
$copyBtn.css("margin-right", parseInt($copyBtn.css("margin-right")) - 4 + "px");
|
||||
const $downloadBtn = $copyBtn.siblings("a.button, button").first();
|
||||
$downloadBtn.length && $downloadBtn.css("margin-right", parseInt($downloadBtn.css("margin-right")) - 5 + "px");
|
||||
if ($downloadBtn.length) {
|
||||
$downloadBtn.css("margin-right", parseInt($downloadBtn.css("margin-right")) + 3 + "px");
|
||||
}
|
||||
$("<button>").text("验车").addClass("button is-info is-small").click(((event) => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
@@ -15618,7 +15650,7 @@ ${err.stack}` : "");
|
||||
}
|
||||
async createMenuBtn() {
|
||||
const pageInfo = this.getPageInfo(), carNum2 = pageInfo.carNum,
|
||||
buttonsHtml = '\n <div style="margin: 10px auto; display: flex; justify-content: space-between; align-items: center; flex-wrap:wrap;gap: 20px;">\n <div style="display: flex; gap: 10px; flex-wrap:wrap;">\n <a id="filterBtn" class="menu-btn" style="width: 120px; background-color:#de3333; color: white; text-align: center; padding: 8px 0;">\n <span>🚫 屏蔽</span>\n </a>\n <a id="favoriteBtn" class="menu-btn" style="width: 120px; background-color:#25b1dc; color: white; text-align: center; padding: 8px 0;">\n <span>⭐ 收藏</span>\n </a>\n <a id="hasDownBtn" class="menu-btn" style="width: 120px; background-color:#7bc73b; color: white; text-align: center; padding: 8px 0;">\n <span>📥️ 已下载</span>\n </a>\n <a id="hasWatchBtn" class="menu-btn" style="width: 120px; background-color:#d7a80c; color: white; text-align: center; padding: 8px 0;">\n <span>🔍 已观看</span>\n </a>\n </div>\n \n <div style="display: flex; gap: 10px; flex-wrap:wrap;">\n <a id="enable-magnets-filter" class="menu-btn" style="width: 140px; background-color: #c2bd4c; color: white; text-align: center; padding: 8px 0;">\n <span id="magnets-span">排序与过滤</span>\n </a>\n <a id="magnetSearchBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to right, rgb(245,140,1), rgb(84,161,29)); color: white; text-align: center; padding: 8px 0;">\n <span>磁力搜索</span>\n </a>\n <a id="subtitleSearchBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to left, #375f7c, #2196F3); color: white; text-align: center; padding: 8px 0;">\n <span>字幕搜索</span>\n </a>\n <!--\n <a id="xunLeiSubtitleBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to left, #375f7c, #2196F3); color: white; text-align: center; padding: 8px 0;">\n <span>字幕 (迅雷)</span>\n </a>\n <a id="search-subtitle-btn" class="menu-btn" style="width: 160px; background: linear-gradient(to bottom, #8d5656, rgb(196,159,91)); color: white; text-align: center; padding: 8px 0;">\n <span>字幕 (SubTitleCat)</span>\n </a>\n -->\n </div>\n </div>\n ';
|
||||
buttonsHtml = '\n <div style="margin: 10px auto; display: flex; justify-content: space-between; align-items: center; flex-wrap:wrap;gap: 20px;">\n <div style="display: flex; gap: 10px; flex-wrap:wrap;">\n <a id="filterBtn" class="menu-btn" style="width: 120px; background-color:#de3333; color: white; text-align: center; padding: 8px 0;">\n <span>🚫 屏蔽</span>\n </a>\n <a id="favoriteBtn" class="menu-btn" style="width: 120px; background-color:#25b1dc; color: white; text-align: center; padding: 8px 0;">\n <span>⭐ 收藏</span>\n </a>\n <a id="hasDownBtn" class="menu-btn" style="width: 120px; background-color:#7bc73b; color: white; text-align: center; padding: 8px 0;">\n <span>📥️ 已下载</span>\n </a>\n <a id="hasWatchBtn" class="menu-btn" style="width: 120px; background-color:#d7a80c; color: white; text-align: center; padding: 8px 0;">\n <span>🔍 已观看</span>\n </a>\n </div>\n \n <div style="display: flex; gap: 10px; flex-wrap:wrap;">\n <a id="downloadCoverBtn" class="menu-btn" style="width: 140px; background-color: #9b59b6; color: white; text-align: center; padding: 8px 0;">\n <span>下载高清封面</span>\n </a>\n <a id="enable-magnets-filter" class="menu-btn" style="width: 140px; background-color: #c2bd4c; color: white; text-align: center; padding: 8px 0;">\n <span id="magnets-span">排序与过滤</span>\n </a>\n <a id="magnetSearchBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to right, rgb(245,140,1), rgb(84,161,29)); color: white; text-align: center; padding: 8px 0;">\n <span>磁力搜索</span>\n </a>\n <a id="subtitleSearchBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to left, #375f7c, #2196F3); color: white; text-align: center; padding: 8px 0;">\n <span>字幕搜索</span>\n </a>\n <!--\n <a id="xunLeiSubtitleBtn" class="menu-btn" style="width: 120px; background: linear-gradient(to left, #375f7c, #2196F3); color: white; text-align: center; padding: 8px 0;">\n <span>字幕 (迅雷)</span>\n </a>\n <a id="search-subtitle-btn" class="menu-btn" style="width: 160px; background: linear-gradient(to bottom, #8d5656, rgb(196,159,91)); color: white; text-align: center; padding: 8px 0;">\n <span>字幕 (SubTitleCat)</span>\n </a>\n -->\n </div>\n </div>\n ';
|
||||
isJavDb$1 && $(".tabs").after(buttonsHtml);
|
||||
isJavBus$1 && $("#mag-submit-show").before(buttonsHtml);
|
||||
$("#favoriteBtn").on("click", (() => this.favoriteOne()));
|
||||
@@ -15679,6 +15711,45 @@ ${err.stack}` : "");
|
||||
}));
|
||||
$("#subtitleSearchBtn").on("click", (() => {
|
||||
window.JavPackSubtitle.openSearchModal({details: {code: carNum2}});
|
||||
}));
|
||||
$("#downloadCoverBtn").on("click", (async () => {
|
||||
if (!isEligibleDmmCoverCode(carNum2)) {
|
||||
layer.msg("当前番号不支持下载高清封面");
|
||||
return;
|
||||
}
|
||||
const $btn = $("#downloadCoverBtn");
|
||||
$btn.addClass("is-loading").prop("disabled", true);
|
||||
try {
|
||||
const coverData = await fromJavxyCover(carNum2);
|
||||
if (!coverData) {
|
||||
layer.msg("未找到高清封面");
|
||||
return;
|
||||
}
|
||||
const coverUrl = coverData.url || coverData.highCover || coverData.cover;
|
||||
if (!coverUrl) {
|
||||
layer.msg("封面链接为空");
|
||||
return;
|
||||
}
|
||||
const fileName = `${carNum2}-cover.jpg`;
|
||||
_GM_xmlhttpRequest({
|
||||
method: "GET",
|
||||
url: coverUrl,
|
||||
responseType: "blob",
|
||||
onload: (response) => {
|
||||
if (response.status === 200) {
|
||||
utils.download(response.response, fileName);
|
||||
} else {
|
||||
layer.msg(`封面下载失败: ${response.status}`);
|
||||
}
|
||||
},
|
||||
onerror: () => layer.msg("封面下载网络错误"),
|
||||
ontimeout: () => layer.msg("封面下载超时")
|
||||
});
|
||||
} catch (e) {
|
||||
layer.msg("获取封面信息失败");
|
||||
} finally {
|
||||
$btn.removeClass("is-loading").prop("disabled", false);
|
||||
}
|
||||
}));
|
||||
window.JavPackSubtitle.preload115Matches(carNum2);
|
||||
this.showStatus(carNum2).then();
|
||||
|
||||
Reference in New Issue
Block a user