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

Function fileSha

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

Source from the content-addressed store, hash-verified

494
495 // 分享链接相关(点击文件时)
496 function fileSha() {
497 var f_sha = mainframe.document.getElementById('f_sha'); // 寻找分享链接(下载链接)信息框
498 if (f_sha && f_sha.style.display === 'block') { // 判断信息框是否存在且可见
499 let f_sha1 = mainframe.document.getElementById('f_sha1'); // 获取分享链接(下载链接)
500 if (f_sha1 && f_sha1.textContent != '') { // 确保分享链接(下载链接)不是空
501 // 自定义分享链接域名
502 if (menu_value('menu_customFileSha')) {f_sha1.innerText = f_sha1.innerText.replace(/\/\/.+\//i, '//' + menu_value('menu_customFileSha') + '/');}
503 // 打开分享链接
504 if (menu_value('menu_open_fileSha')) {f_sha.style.display = 'none';GM_openInTab(f_sha1.textContent, {active: true,insert: true,setParent: true});}
505 // 复制分享链接(并已复制的提示信息)
506 if (menu_value('menu_copy_fileSha')) {f_sha.style.display = 'none';GM_setClipboard(f_sha1.textContent, 'text');GM_notification({text: '已复制分享链接~', timeout: 2000});}
507 // 直接下载文件
508 //if (menu_value('menu_directDownload')) {f_sha.style.display = 'none';GM_openInTab(f_sha1.textContent + '#download', {active: false,insert: true,setParent: true});}
509 }
510 }
511 }
512
513
514 // 自定义分享链接域名

Callers

nothing calls this directly

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected