From 87847c06cd5581be43dad3d390a866ffea4fd944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Fri, 6 Dec 2024 16:46:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GithubEnhanced-High-Speed-Download.user.js | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index e4d95de..af9fabf 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -4,8 +4,8 @@ * * @name Github 增强 - 高速下载(Github油猴脚本) * @name:en Github Enhancement - High Speed Download(Github Greasemonkey Script) - * @version 2.6.9_1 - * @since 2024-10-15 14:23 + * @version 2.6.10_1 + * @since 2024-12-06 16:44 * @author X.I.U * @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件 (公益加速)、项目列表单文件快捷下载 (☁)、添加 git clone 命令 * @description:en High-speed download of Git Clone/SSH, Release, Raw, Code(ZIP) and other files (Based on public welfare), project list file quick download (☁) @@ -75,7 +75,7 @@ document.addEventListener("DOMContentLoaded", () => { ['https://hub.whtrys.space', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [FastGit 群组成员] 提供'], ['https://dgithub.xyz', '美国', '[美国 西雅图] - 该公益加速源由 [dgithub.xyz] 提供'], ['https://gh-proxy.ygxz.in/https://github.com', '美国', '[美国 洛杉矶] - 该公益加速源由 [@一个小站 www.ygxz.in] 提供'], - ['https://download.ixnic.net', '美国', '[美国 洛杉矶] - 该公益加速源由 [@黃埔興國] 提供'] + ['https://download.ixnic.net', '美国', '[美国 洛杉矶] - 该公益加速源由 [@黃埔興國] 提供'], ], download_url = [ ['https://ghproxy.net/https://github.com', '英国', '[英国伦敦] - 该公益加速源由 [ghproxy] 提供 提示:希望大家尽量多使用美国节点(每次随机 负载均衡), 避免流量都集中到亚洲公益节点,减少成本压力,公益才能更持久~'], ['https://ghp.ci/https://github.com', '韩国', '[日本、韩国、新加坡、美国、德国等](CDN 不固定) - 该公益加速源由 [ghproxy] 提供 提示:希望大家尽量多使用美国节点(每次随机 负载均衡), 避免流量都集中到亚洲公益节点,减少成本压力,公益才能更持久~'], @@ -207,17 +207,15 @@ document.addEventListener("DOMContentLoaded", () => { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType !== 1) return - if (target.tagName === 'DIV' && target.parentElement.id === '__primerPortalRoot__') { + if (target.tagName === 'DIV' && target.parentElement && target.parentElement.id === '__primerPortalRoot__') { addDownloadZIP(target); - if (addGitClone(target) === false) return; - if (addGitCloneSSH(target) === false) return; - } else if (target.tagName === 'DIV' && target.className.indexOf('Box-sc-') !== -1) { + addGitClone(target); + addGitCloneSSH(target); + } else if (target.tagName === 'DIV' && target.className.indexOf('Box-sc-') != -1) { if (target.querySelector('input[value^="https:"]')) { - addGitCloneClear('.XIU2-GCS'); - if (addGitClone(target) === false) return; + addGitCloneClear('.XIU2-GCS'); addGitClone(target); } else if (target.querySelector('input[value^="git@"]')) { - addGitCloneClear('.XIU2-GC'); - if (addGitCloneSSH(target) === false) return; + addGitCloneClear('.XIU2-GC'); addGitCloneSSH(target); } else if (target.querySelector('input[value^="gh "]')) { addGitCloneClear('.XIU2-GC, .XIU2-GCS'); } @@ -299,12 +297,11 @@ document.addEventListener("DOMContentLoaded", () => { // Git Clone function addGitClone(target) { - let html = target.querySelector('input[value^="https:"]');if (!html) return - if (!html.nextElementSibling) return false; + let html = target.querySelector('input[value^="https:"]:not([title])');if (!html) return let href_split = html.value.split(location.host)[1], html_parent = '