From 2383406ede14ff8da869a1544082115747709201 Mon Sep 17 00:00:00 2001 From: "lzyme.dev@gmail.com" Date: Sat, 29 Aug 2026 18:04:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BD=9C=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=8B=E5=88=A0=E9=99=A4=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/jhs-enhance.user.js | 63 +++++++++++++++++++++++++++++++++++-- src/plugins/cover-button.js | 43 +++++++++++++++++++++++-- src/plugins/wangpan-115.js | 22 ++++++++++++- 3 files changed, 122 insertions(+), 6 deletions(-) diff --git a/dist/jhs-enhance.user.js b/dist/jhs-enhance.user.js index b81f5bc..523c01c 100644 --- a/dist/jhs-enhance.user.js +++ b/dist/jhs-enhance.user.js @@ -2,7 +2,7 @@ // @name JAV-JHS // @namespace JAV-JHS // @version 3.3.6-fix -// @author xie bro +// @author xie bro,fireinrain // @description Jav-鉴黄师 收藏、屏蔽、标记已下载; 屏蔽标签、屏蔽演员、同步收藏演员、新作品检测; 免VIP查看热播、Top250排行榜、Fc2ppv、可查看所有评论信息、相关清单; 支持云盘备份; 以图识图; 字幕搜索; JavDb|JavBus // @license MIT // @icon https://www.google.com/s2/favicons?sz=64&domain=javdb.com @@ -8666,11 +8666,25 @@ ${err.stack}` : ""); } } updateMatchStatus($box2, carNum2, matchList) { - matchList.length > 0 ? $box2.find(".jhs-match-btn").replaceWith(` 0) { + $box2.find(".jhs-match-btn").replaceWith(`匹配${matchList.length}个`) : $box2.find(".jhs-match-btn").replaceWith(`匹配${matchList.length}个`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0 && matchList[0].dirId) { + $deleteBtn.attr("data-dir-id", matchList[0].dirId); + $deleteBtn.show(); + } + } else { + $box2.find(".jhs-match-btn").replaceWith(`未匹配`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0) { + $deleteBtn.removeAttr("data-dir-id"); + $deleteBtn.hide(); + } + } } async handleLoginRedirect() { window.open("https://115.com"); @@ -8680,6 +8694,7 @@ ${err.stack}` : ""); let searchKeyword = carNum2.toLowerCase().replace("fc2-", ""); return (null == (_a2 = (await searchFiles(searchKeyword)).data) ? void 0 : _a2.map(((data) => ({ folderId: data.fid, + dirId: data.cid, videoId: data.pc, name: data.n, createTime: utils.formatDate(new Date(1e3 * data.te)), @@ -8729,6 +8744,11 @@ ${err.stack}` : ""); data-keyword="${carNum2}" data-match='${JSON.stringify(matchList)}' title="${title}">匹配${matchList.length}个`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0 && matchList[0].dirId) { + $deleteBtn.attr("data-dir-id", matchList[0].dirId); + $deleteBtn.show(); + } } else $box2.find(".video-title").prepend(`未匹配`); @@ -9805,6 +9825,7 @@ ${err.stack}` : ""); if (!($box2.find(".tool-box").length > 0)) { isJavDb$1 && $box2.find(".tags").append(`
+ ${this.screenSvg} ${this.videoSvg} @@ -9867,6 +9888,7 @@ ${err.stack}` : ""); if ($box2.find(".avatar-box").length > 0) return; $box2.find(".photo-info").append(`
+ ${this.screenSvg} ${this.videoSvg} @@ -10039,6 +10061,41 @@ ${err.stack}` : ""); utils.download(blob, carNum2 + " " + title + ".jpg"); })); })); + $(document).on("click", ".delete115Svg", (async (event) => { + event.preventDefault(); + event.stopPropagation(); + const $btn = $(event.currentTarget); + const dirId = $btn.attr("data-dir-id"); + if (!dirId) { + show.error("未找到115目录ID"); + return; + } + const $box2 = $btn.closest(".item"); + const { carNum: carNum2 } = this.getBoxCarInfo($box2); + utils.q(event, `确认删除115中作品 "${carNum2}" 的整个目录吗?此操作不可撤销!`, (async () => { + let loadObj = loading(); + try { + const result = await gmHttp.postForm("https://webapi.115.com/rb/delete", { + pid: 0, + "fid[0]": dirId + }); + loadObj.close(); + if (result && result.state) { + show.ok(`作品 "${carNum2}" 已从115删除`); + const matchPlugin = this.getBean("WangPan115MatchPlugin"); + const matchList = await matchPlugin.searchFiles(carNum2); + matchPlugin.updateMatchStatus($box2, carNum2, matchList); + } else { + const errMsg = result && result.error_msg ? result.error_msg : "未知错误"; + show.error(`删除失败: ${errMsg}`); + } + } catch (error) { + loadObj.close(); + console.error("删除115文件失败:", error); + show.error(`删除失败: ${error.message || "网络错误"}`); + } + })); + })); } showImg($svgElement, $img, carNum2) { $svgElement.html(this.videoSvg).attr("title", "播放视频"); diff --git a/src/plugins/cover-button.js b/src/plugins/cover-button.js index a2302e8..c25a3d8 100644 --- a/src/plugins/cover-button.js +++ b/src/plugins/cover-button.js @@ -19,10 +19,10 @@ class CoverButtonPlugin extends BasePlugin { $(this.getSelector().itemSelector).toArray().forEach((ele => { let $box2 = $(ele); if (!($box2.find(".tool-box").length > 0)) { - isJavDb && $box2.find(".tags").append(`\n
\n ${this.screenSvg}\n \n ${this.videoSvg}\n \n
\n
${this.handleSvg}
\n \n \n
\n \n
\n
${this.siteSvg}
\n \n \n
\n \n
\n
${this.copySvg}
\n \n
\n ${this.carNumSvg}\n ${this.titleSvg}\n ${this.downSvg}\n
\n
\n
\n `); + isJavDb && $box2.find(".tags").append(`\n
\n \n ${this.screenSvg}\n \n ${this.videoSvg}\n \n
\n
${this.handleSvg}
\n \n \n
\n \n
\n
${this.siteSvg}
\n \n \n
\n \n
\n
${this.copySvg}
\n \n
\n ${this.carNumSvg}\n ${this.titleSvg}\n ${this.downSvg}\n
\n
\n
\n `); if (isJavBus) { if ($box2.find(".avatar-box").length > 0) return; - $box2.find(".photo-info").append(`\n
\n ${this.screenSvg}\n\n ${this.videoSvg}\n \n
\n
${this.handleSvg}
\n \n \n
\n \n
\n
${this.siteSvg}
\n \n \n
\n \n
\n
${this.copySvg}
\n \n
\n ${this.carNumSvg}\n ${this.titleSvg}\n ${this.downSvg}\n
\n
\n
\n `); + $box2.find(".photo-info").append(`\n
\n \n ${this.screenSvg}\n\n ${this.videoSvg}\n \n
\n
${this.handleSvg}
\n \n \n
\n \n
\n
${this.siteSvg}
\n \n \n
\n \n
\n
${this.copySvg}
\n \n
\n ${this.carNumSvg}\n ${this.titleSvg}\n ${this.downSvg}\n
\n
\n
\n `); } } })); @@ -135,6 +135,45 @@ class CoverButtonPlugin extends BasePlugin { utils.download(blob, carNum2 + " " + title + ".jpg"); })); })); + $(document).on("click", ".delete115Svg", (async event => { + event.preventDefault(); + event.stopPropagation(); + const $btn = $(event.currentTarget); + const dirId = $btn.attr("data-dir-id"); + if (!dirId) { + show.error("未找到115目录ID"); + return; + } + const $box2 = $btn.closest(".item"); + const {carNum: carNum2} = this.getBoxCarInfo($box2); + utils.q(event, `确认删除115中作品 "${carNum2}" 的整个目录吗?此操作不可撤销!`, (async () => { + let loadObj = loading(); + try { + // 使用旧版115删除API删除整个作品目录 + // 注意:此处仅删除文件目录,不会删除离线下载任务记录 + // 原因:旧版任务删除接口(task_del)已失效,新版接口需要安全验证(如验证码),脚本无法绕过 + // 如需重新下载同一作品,请先在115离线下载页面手动删除对应的任务记录,否则会提示"任务已存在" + const result = await gmHttp.postForm("https://webapi.115.com/rb/delete", { + pid: 0, + "fid[0]": dirId + }); + loadObj.close(); + if (result && result.state) { + show.ok(`作品 "${carNum2}" 已从115删除`); + const matchPlugin = this.getBean("WangPan115MatchPlugin"); + const matchList = await matchPlugin.searchFiles(carNum2); + matchPlugin.updateMatchStatus($box2, carNum2, matchList); + } else { + const errMsg = result && result.error_msg ? result.error_msg : "未知错误"; + show.error(`删除失败: ${errMsg}`); + } + } catch (error) { + loadObj.close(); + console.error("删除115文件失败:", error); + show.error(`删除失败: ${error.message || "网络错误"}`); + } + })); + })); } showImg($svgElement, $img, carNum2) { $svgElement.html(this.videoSvg).attr("title", "播放视频"); diff --git a/src/plugins/wangpan-115.js b/src/plugins/wangpan-115.js index 3bc2ac7..8014177 100644 --- a/src/plugins/wangpan-115.js +++ b/src/plugins/wangpan-115.js @@ -341,7 +341,21 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin { } } updateMatchStatus($box2, carNum2, matchList) { - matchList.length > 0 ? $box2.find(".jhs-match-btn").replaceWith(`匹配${matchList.length}个`) : $box2.find(".jhs-match-btn").replaceWith(`未匹配`); + if (matchList.length > 0) { + $box2.find(".jhs-match-btn").replaceWith(`匹配${matchList.length}个`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0 && matchList[0].dirId) { + $deleteBtn.attr("data-dir-id", matchList[0].dirId); + $deleteBtn.show(); + } + } else { + $box2.find(".jhs-match-btn").replaceWith(`未匹配`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0) { + $deleteBtn.removeAttr("data-dir-id"); + $deleteBtn.hide(); + } + } } async handleLoginRedirect() { window.open("https://115.com"); @@ -351,6 +365,7 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin { let searchKeyword = carNum2.toLowerCase().replace("fc2-", ""); return (null == (_a2 = (await searchFiles(searchKeyword)).data) ? void 0 : _a2.map((data => ({ folderId: data.fid, + dirId: data.cid, videoId: data.pc, name: data.n, createTime: utils.formatDate(new Date(1e3 * data.te)), @@ -392,6 +407,11 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin { if (!($box2.find("[class^='jhs-match-']").length > 0)) if (this.loginStatus === _WangPan115MatchPlugin.LoginStatus.LOGGED_OUT) $box2.find(".video-title").prepend(``); else if (matchList.length > 0) { const title = 1 === matchList.length ? "点击直接播放" : `点击查看${matchList.length}个匹配结果`; $box2.find(".video-title").prepend(`匹配${matchList.length}个`); + const $deleteBtn = $box2.find(".delete115Svg"); + if ($deleteBtn.length > 0 && matchList[0].dirId) { + $deleteBtn.attr("data-dir-id", matchList[0].dirId); + $deleteBtn.show(); + } } else $box2.find(".video-title").prepend(`未匹配`); } formatSize(bytes) {