|
3 | 3 | // @name:zh-CN Github 增强 - 高速下载 |
4 | 4 | // @name:zh-TW Github 增強 - 高速下載 |
5 | 5 | // @name:en Github Enhancement - High Speed Download |
6 | | -// @version 2.0.6 |
| 6 | +// @version 2.0.7 |
7 | 7 | // @author X.I.U |
8 | 8 | // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) |
9 | 9 | // @description:zh-CN 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) |
|
29 | 29 | (function() { |
30 | 30 | 'use strict'; |
31 | 31 | var backColor = '#ffffff', fontColor = '#888888', menu_raw_fast = GM_getValue('xiu2_menu_raw_fast'), menu_menu_raw_fast_ID, menu_feedBack_ID; |
32 | | - const download_url = [ |
| 32 | + const download_url_us = [ |
33 | 33 | //['https://pd.zwc365.com/seturl/https://github.com', '美国', '[美国 Cloudflare CDN]'], |
| 34 | + ['https://ghdl.z-o.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [feizhuqwq.com] 提供'], |
34 | 35 | ['https://gh2.yanqishui.work/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@HongjieCN] 提供'], |
35 | 36 | ['https://gh.ddlc.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@mtr-static-official] 提供'], |
36 | 37 | ['https://gh.gh2233.ml/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@X.I.U/XIU2] 提供'], |
37 | | - //['https://gh.api.99988866.xyz/https://github.com', '美国', '[美国 Cloudflare CDN]'], |
38 | | - //['https://gh-proxy-misakano7545.koyeb.app/https://github.com', '美国', '[美国 Cloudflare CDN]'], |
39 | | - //['https://cdn.githubjs.cf', '美国', '[美国 Cloudflare CDN]'], |
| 38 | + ['https://gh.api.99988866.xyz/https://github.com', '美国', '[美国 Cloudflare CDN]'], |
| 39 | + ['https://gh-proxy-misakano7545.koyeb.app/https://github.com', '美国', '[美国 Cloudflare CDN]'], |
| 40 | + ['https://cdn.githubjs.cf', '美国', '[美国 Cloudflare CDN]'], |
40 | 41 | //['https://download.cithub.icu', '美国', '[美国 洛杉矶]', 'https://archive.cithub.icu'], |
41 | 42 | ['https://download.xn--p8jhe.tw', '美国', '[美国 圣何塞]', 'https://archive.xn--p8jhe.tw'], |
42 | | - //['https://git.yumenaka.net/https://github.com', '美国', '[美国 圣何塞]'], |
| 43 | + ], download_url = [ |
43 | 44 | ['https://ghproxy.futils.com/https://github.com', '香港', '[中国 香港] - 该公益加速源由 [F 搜] 提供(存在限速)'], |
44 | 45 | ['https://download.fastgit.org', '日本', '[日本 东京] - 该公益加速源由 [FastGit] 提供', 'https://archive.fastgit.org'], |
45 | 46 | ['https://mirror.ghproxy.com/https://github.com', '日本', '[日本 东京] - 该公益加速源由 [ghproxy] 提供'], |
|
141 | 142 | if (location.pathname.indexOf('/releases')) {addRelease();} |
142 | 143 | }); |
143 | 144 |
|
| 145 | + // download_url 加速源随机 |
| 146 | + function get_New_download_url() { |
| 147 | + let a = Math.floor(Math.random()*download_url_us.length), b, new_download_url=[] |
| 148 | + do {b = Math.floor(Math.random()*download_url_us.length)} |
| 149 | + while (b == a); |
| 150 | + return [download_url_us[a],download_url_us[b]].concat(download_url) |
| 151 | + } |
144 | 152 |
|
145 | 153 | // Release |
146 | 154 | function addRelease() { |
147 | | - let html = document.querySelectorAll('.Box-footer'); if (html.length == 0) return |
| 155 | + let html = document.querySelectorAll('.Box-footer'); if (html.length == 0 || location.pathname.indexOf('/releases') == -1) return |
148 | 156 | let divDisplay = 'margin-left: -90px;'; |
149 | 157 | if (document.documentElement.clientWidth > 755) {divDisplay = 'margin-top: -3px;margin-left: 8px;display: inherit;';}; // 调整小屏幕时的样式 |
| 158 | + let new_download_url = get_New_download_url(); |
150 | 159 | for (const current of html) { |
151 | 160 | if (current.querySelector('.XIU2-RS')) continue |
152 | 161 | current.querySelectorAll('li.Box-row a').forEach(function (_this) { |
153 | 162 | let href = _this.href.split(location.host), |
154 | 163 | url = '', _html = `<div class="XIU2-RS" style="${divDisplay}">`; |
155 | 164 |
|
156 | | - for (let i=0;i<download_url.length;i++) { |
157 | | - if (download_url[i][3] !== undefined && url.indexOf('/archive/') !== -1) { |
158 | | - url = download_url[i][3] + href[1] |
| 165 | + for (let i=0;i<new_download_url.length;i++) { |
| 166 | + if (new_download_url[i][3] !== undefined && url.indexOf('/archive/') !== -1) { |
| 167 | + url = new_download_url[i][3] + href[1] |
159 | 168 | } else { |
160 | | - url = download_url[i][0] + href[1] |
| 169 | + url = new_download_url[i][0] + href[1] |
161 | 170 | } |
162 | 171 | if (location.host !== 'github.com') url = url.replace(location.host,'github.com') |
163 | | - _html += `<a style="${style[0]}" class="btn" href="${url}" title="${download_url[i][2]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
| 172 | + _html += `<a style="${style[0]}" class="btn" href="${url}" title="${new_download_url[i][2]}" rel="noreferrer noopener nofollow">${new_download_url[i][1]}</a>` |
164 | 173 | } |
165 | 174 | _this.parentElement.nextElementSibling.insertAdjacentHTML('beforeend', _html + '</div>'); |
166 | 175 | }); |
|
173 | 182 | if (document.querySelector('.XIU2-DZ')) return |
174 | 183 | let html = document.querySelector('.dropdown-menu.dropdown-menu-sw.p-0 ul li:last-child');if (!html) return |
175 | 184 | let href = html.getElementsByTagName('a')[0].href, |
176 | | - url = '', _html = ''; |
177 | | - |
178 | | - for (let i=0;i<download_url.length;i++) { |
179 | | - if (download_url[i][3] === '') continue |
| 185 | + url = '', _html = '', new_download_url = get_New_download_url(); |
| 186 | + for (let i=0;i<new_download_url.length;i++) { |
| 187 | + if (new_download_url[i][3] === '') continue |
180 | 188 |
|
181 | | - if (download_url[i][3] !== undefined) { |
182 | | - url = download_url[i][3] + href.split(location.host)[1] |
| 189 | + if (new_download_url[i][3] !== undefined) { |
| 190 | + url = new_download_url[i][3] + href.split(location.host)[1] |
183 | 191 | } else { |
184 | | - url = download_url[i][0] + href.split(location.host)[1] |
| 192 | + url = new_download_url[i][0] + href.split(location.host)[1] |
185 | 193 | } |
186 | 194 | if (location.host !== 'github.com') url = url.replace(location.host,'github.com') |
187 | | - _html += `<li class="Box-row Box-row--hover-gray p-3 mt-0 XIU2-DZ"><a class="d-flex flex-items-center color-fg-default text-bold no-underline" rel="noreferrer noopener nofollow" href="${url}" title="${download_url[i][2]}">${svg[0]}Download ZIP ${download_url[i][1]}</a></li>` |
| 195 | + _html += `<li class="Box-row Box-row--hover-gray p-3 mt-0 XIU2-DZ"><a class="d-flex flex-items-center color-fg-default text-bold no-underline" rel="noreferrer noopener nofollow" href="${url}" title="${new_download_url[i][2]}">${svg[0]}Download ZIP ${new_download_url[i][1]}</a></li>` |
188 | 196 | } |
189 | 197 | html.insertAdjacentHTML('afterend', _html); |
190 | 198 | } |
|
0 commit comments