MCPcopy Create free account
hub / github.com/XIU2/UserScript / directDownload_

Function directDownload_

Lanzou-Enhanced.user.js:344–365  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342 }
343 // 点击下载按钮
344 function directDownload_() {
345 if (!menu_value('menu_directDownload')) return
346 if (location.hash != '#download') return
347 let iframe = document.querySelector('iframe.ifr2, iframe.n_downlink');
348 if (iframe) { // 只有找到 iframe 框架时才会继续运行脚本
349 iframe = iframe.contentWindow;
350 let timer = setInterval(function(){
351 if (iframe.document.querySelector('.load [href]')) {
352 //iframe.document.querySelector('.load a[href]').target = '_top'
353 //iframe.document.querySelector('.load a[href]').click();
354 GM_openInTab(iframe.document.querySelector('.load a[href]').href, {active: false, insert: true, setParent: false}); // 后台打开
355 clearInterval(timer);
356 // 关闭该后台标签页
357 if (GM_info.scriptHandler === 'Violentmonkey') { // Violentmonkey 需要延迟一会儿
358 setTimeout(function(){window.top.close();}, 500)
359 } else {
360 window.top.close();
361 }
362 }
363 }, 10);
364 }
365 }
366
367
368 // 滚动条事件

Callers 1

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected