Skip to content

Commit cd63911

Browse files
committed
修复 在会员专属样式的分享链接列表页 [点击直接下载文件] 失效的问题
1 parent d116dce commit cd63911

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

Lanzou-Enhanced.user.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 蓝奏云网盘增强
3-
// @version 1.5.0
3+
// @version 1.5.1
44
// @author X.I.U
55
// @description 文件排序、刷新不回根目录、快捷返回上一级(右键网页空白处)、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小
66
// @match *://lanzou.com/u
@@ -293,9 +293,15 @@
293293
if (!menu_value('menu_directDownload')) return
294294
if (document.getElementById('infos')) {
295295
document.getElementById('infos').addEventListener('click', function(e) {
296-
if (e.target.tagName === 'A') {
296+
if (e.target.tagName === 'A') { // 针对普通样式的分享链接列表页
297297
e.preventDefault(); // 阻止默认打开链接事件
298298
GM_openInTab(e.target.href + '#download', {active: false, insert: true, setParent: true}); // 后台打开
299+
} else { // 针对会员专属样式的分享链接列表页
300+
const link = e.target.closest('a'); // 点击 <a> 元素的子元素时,寻找最近的 <a> 父元素
301+
if ((link && this.contains(link))) {
302+
e.preventDefault(); // 阻止默认打开链接事件
303+
GM_openInTab(link.href + '#download', {active: false, insert: true, setParent: true}); // 后台打开
304+
}
299305
}
300306
});
301307
}
@@ -304,7 +310,7 @@
304310
function directDownload_() {
305311
if (!menu_value('menu_directDownload')) return
306312
if (location.hash != '#download') return
307-
let iframe = document.querySelector('iframe.ifr2');
313+
let iframe = document.querySelector('iframe.ifr2, iframe.n_downlink');
308314
if (iframe) { // 只有找到 iframe 框架时才会继续运行脚本
309315
iframe = iframe.contentWindow;
310316
let timer = setInterval(function(){

0 commit comments

Comments
 (0)