From cfcc62cef24830e304568bf437aa55b85423dbce Mon Sep 17 00:00:00 2001 From: maomao <1714487678@qq.com> Date: Thu, 13 Jun 2024 21:55:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(115-helper):=20=E7=82=B9=E5=87=BB=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E8=8F=9C=E5=8D=95=E4=B8=8D=E8=A7=A6=E5=8F=91=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E3=80=81=E6=8C=89=E9=92=AE=E4=BC=98=E5=8C=96=20(#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/packages/115-helper/115-helper.user.ts | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/legacy/packages/115-helper/115-helper.user.ts b/legacy/packages/115-helper/115-helper.user.ts index 40efb6d..cb5bc6d 100644 --- a/legacy/packages/115-helper/115-helper.user.ts +++ b/legacy/packages/115-helper/115-helper.user.ts @@ -2,7 +2,7 @@ // ==UserScript== // @name 115小助手 // @namespace https://github.com/maomao1996/tampermonkey-scripts -// @version 1.8.1 +// @version 1.8.2 // @description 网盘顶部菜单栏添加链接任务和云下载、SHA1 快速查重(新页面打开)、SHA1 自动查重、删除空文件夹、一键搜(快捷搜索)、SHA1 查重列表支持选中第一个元素和悬浮菜单展示、搜索列表支持悬浮菜单展示、列表显示文件 SHA1 信息、关闭侧边栏、悬浮菜单移除图标、悬浮菜单支持新标签页打开文件夹、加速转码 // @icon https://115.com/favicon.ico // @author maomao1996 @@ -368,30 +368,20 @@ * 在顶部菜单添加链接任务按钮 */ const addLinkTaskBtn = () => { - $('[rel="left_tvf"]').prepend( - /*html*/ `链接任务`, - ) + const content = /*html*/ `链接任务` + + urlHasString('mode=search') + ? $('[rel="left_tvf"]').prepend(content) + : $('a#js_filter_btn').after(content) } /** * 在顶部菜单添加云下载按钮 */ const addOfflineBtn = () => { - $('[rel="left_tvf"]') - .prepend( - /*html*/ `云下载`, - ) - .on('click', '[tab_btn]', function () { - const $this = $(this) - const tab = $this.attr('tab_btn') - const mode = $this.attr('mode-tab') - - if (mode === 'offline') { - top.oofUtil.urlMaintain.changeMode(tab, { tab: mode }) - } - - return false - }) + $('a#js_filter_btn').after( + /*html*/ `云下载`, + ) } /** @@ -433,9 +423,9 @@ move: /*html*/ `移动`, edit_name: /*html*/ `重命名`, delete: /*html*/ `删除`, - search: /*html*/ `一键搜`, - sha1: /*html*/ `SHA1查重`, - new_tab: /*html*/ `新标签页打开`, + search: /*html*/ `一键搜`, + sha1: /*html*/ `SHA1查重`, + new_tab: /*html*/ `新标签页`, } type MenuKey = keyof typeof MENU_MAP const CONTROLLED_MENU: MenuKey[] = ['new_tab', 'search', 'sha1'] @@ -582,6 +572,10 @@ cid: $(this).attr('cate_id'), }), ) + .on('mousedown', function (e) { + e.stopPropagation() + return true + }) } }) }) @@ -907,6 +901,10 @@ }), ) } + that.find('.file-opr').on('mousedown', function (e) { + e.stopPropagation() + return true + }) }) } }, $list) @@ -994,16 +992,22 @@ else if (urlHasString('mode=search') && G.get('search.addMenu')) { observerChildList(() => { $('li[rel="item"]').each(function () { - G.get('search.showSha1') && listShowSHA1($(this)) - if (!$(this).find('.mm-operation').length) { - $(this).append( + const that = $(this) + G.get('search.showSha1') && listShowSHA1(that) + if (!that.find('.mm-operation').length) { + that.append( getFloatMenu({ - fileType: $(this).attr('file_type'), + fileType: that.attr('file_type'), menuKeys: ['new_tab', 'search', 'sha1', 'move', 'edit_name', 'delete'], isAddWrap: true, - cid: $(this).attr('cate_id'), + cid: that.attr('cate_id'), }), ) + + that.find('.file-opr').on('mousedown', function (e) { + e.stopPropagation() + return true + }) } }) })