From cd6391152b8aaed3a19aa9cac630fec54bcbf5fd Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 28 May 2023 10:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=9C=A8=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=B8=93=E5=B1=9E=E6=A0=B7=E5=BC=8F=E7=9A=84=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=93=BE=E6=8E=A5=E5=88=97=E8=A1=A8=E9=A1=B5=20[?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=9B=B4=E6=8E=A5=E4=B8=8B=E8=BD=BD=E6=96=87?= =?UTF-8?q?=E4=BB=B6]=20=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lanzou-Enhanced.user.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index b59801e..b4a7430 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 蓝奏云网盘增强 -// @version 1.5.0 +// @version 1.5.1 // @author X.I.U // @description 文件排序、刷新不回根目录、快捷返回上一级(右键网页空白处)、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 // @match *://lanzou.com/u @@ -293,9 +293,15 @@ if (!menu_value('menu_directDownload')) return if (document.getElementById('infos')) { document.getElementById('infos').addEventListener('click', function(e) { - if (e.target.tagName === 'A') { + if (e.target.tagName === 'A') { // 针对普通样式的分享链接列表页 e.preventDefault(); // 阻止默认打开链接事件 GM_openInTab(e.target.href + '#download', {active: false, insert: true, setParent: true}); // 后台打开 + } else { // 针对会员专属样式的分享链接列表页 + const link = e.target.closest('a'); // 点击 元素的子元素时,寻找最近的 父元素 + if ((link && this.contains(link))) { + e.preventDefault(); // 阻止默认打开链接事件 + GM_openInTab(link.href + '#download', {active: false, insert: true, setParent: true}); // 后台打开 + } } }); } @@ -304,7 +310,7 @@ function directDownload_() { if (!menu_value('menu_directDownload')) return if (location.hash != '#download') return - let iframe = document.querySelector('iframe.ifr2'); + let iframe = document.querySelector('iframe.ifr2, iframe.n_downlink'); if (iframe) { // 只有找到 iframe 框架时才会继续运行脚本 iframe = iframe.contentWindow; let timer = setInterval(function(){