Skip to content

Commit cdce8c6

Browse files
committed
更新 加速源; 优化 Release 加速源美国节点(随机)
1 parent d17c1a3 commit cdce8c6

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

GithubEnhanced-High-Speed-Download.user.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN Github 增强 - 高速下载
44
// @name:zh-TW Github 增強 - 高速下載
55
// @name:en Github Enhancement - High Speed Download
6-
// @version 2.0.6
6+
// @version 2.0.7
77
// @author X.I.U
88
// @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁)
99
// @description:zh-CN 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁)
@@ -29,17 +29,18 @@
2929
(function() {
3030
'use strict';
3131
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 = [
3333
//['https://pd.zwc365.com/seturl/https://github.com', '美国', '[美国 Cloudflare CDN]'],
34+
['https://ghdl.z-o.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [feizhuqwq.com] 提供'],
3435
['https://gh2.yanqishui.work/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@HongjieCN] 提供'],
3536
['https://gh.ddlc.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@mtr-static-official] 提供'],
3637
['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]'],
4041
//['https://download.cithub.icu', '美国', '[美国 洛杉矶]', 'https://archive.cithub.icu'],
4142
['https://download.xn--p8jhe.tw', '美国', '[美国 圣何塞]', 'https://archive.xn--p8jhe.tw'],
42-
//['https://git.yumenaka.net/https://github.com', '美国', '[美国 圣何塞]'],
43+
], download_url = [
4344
['https://ghproxy.futils.com/https://github.com', '香港', '[中国 香港] - 该公益加速源由 [F 搜] 提供(存在限速)'],
4445
['https://download.fastgit.org', '日本', '[日本 东京] - 该公益加速源由 [FastGit] 提供', 'https://archive.fastgit.org'],
4546
['https://mirror.ghproxy.com/https://github.com', '日本', '[日本 东京] - 该公益加速源由 [ghproxy] 提供'],
@@ -141,26 +142,34 @@
141142
if (location.pathname.indexOf('/releases')) {addRelease();}
142143
});
143144

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+
}
144152

145153
// Release
146154
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
148156
let divDisplay = 'margin-left: -90px;';
149157
if (document.documentElement.clientWidth > 755) {divDisplay = 'margin-top: -3px;margin-left: 8px;display: inherit;';}; // 调整小屏幕时的样式
158+
let new_download_url = get_New_download_url();
150159
for (const current of html) {
151160
if (current.querySelector('.XIU2-RS')) continue
152161
current.querySelectorAll('li.Box-row a').forEach(function (_this) {
153162
let href = _this.href.split(location.host),
154163
url = '', _html = `<div class="XIU2-RS" style="${divDisplay}">`;
155164

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]
159168
} else {
160-
url = download_url[i][0] + href[1]
169+
url = new_download_url[i][0] + href[1]
161170
}
162171
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>`
164173
}
165174
_this.parentElement.nextElementSibling.insertAdjacentHTML('beforeend', _html + '</div>');
166175
});
@@ -173,18 +182,17 @@
173182
if (document.querySelector('.XIU2-DZ')) return
174183
let html = document.querySelector('.dropdown-menu.dropdown-menu-sw.p-0 ul li:last-child');if (!html) return
175184
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
180188

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]
183191
} else {
184-
url = download_url[i][0] + href.split(location.host)[1]
192+
url = new_download_url[i][0] + href.split(location.host)[1]
185193
}
186194
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>`
188196
}
189197
html.insertAdjacentHTML('afterend', _html);
190198
}

0 commit comments

Comments
 (0)