|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Github 增强 - 高速下载 |
3 | | -// @version 1.5.2 |
| 3 | +// @version 1.5.3 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) |
6 | 6 | // @match *://github.com/* |
|
29 | 29 | fontColor = '#b2b8bf'; |
30 | 30 | } |
31 | 31 | } |
32 | | -//['https://github.91chifun.workers.dev','美国'], |
| 32 | +//['https://gh.66ccff.work', '美国'], |
| 33 | +//['https://github.91chifun.workers.dev', '美国'], |
| 34 | +//['https://github.rc1844.workers.dev', '美国'], |
33 | 35 | var download_url = [ |
34 | | - ['https://gh.api.99988866.xyz','美国'], |
35 | | - ['https://gh.msx.workers.dev','美国'], |
36 | | - ['https://gh.xiu2.xyz','美国'], |
37 | | - ['https://gh.argv.cc','美国费利蒙'], |
38 | | - ['https://git.yumenaka.net','美国洛杉矶'], |
39 | | - ['https://download.fastgit.org','日本东京'], |
40 | | - ['https://ghproxy.com','韩国首尔'], |
41 | | - ['https://pd.zwc365.com/seturl','中国香港'] |
| 36 | + ['https://gh.api.99988866.xyz', '美国'], |
| 37 | + ['https://gh.msx.workers.dev', '美国'], |
| 38 | + ['https://gh.xiu2.xyz', '美国'], |
| 39 | + ['https://gh.argv.cc', '美国费利蒙'], |
| 40 | + ['https://git.yumenaka.net', '美国洛杉矶'], |
| 41 | + ['https://download.fastgit.org', '日本东京'], |
| 42 | + ['https://ghproxy.com', '韩国首尔'], |
| 43 | + ['https://pd.zwc365.com/seturl', '中国香港'] |
42 | 44 | ], |
43 | 45 | clone_url = [ |
44 | | - ['https://hub.fastgit.org','中国香港'], |
45 | | - ['https://gitclone.com','中国浙江'], |
46 | | - ['https://git.lvmhsh.cn.cnpmjs.org','新加坡'] |
| 46 | + ['https://hub.fastgit.org', '中国香港'], |
| 47 | + ['https://gitclone.com', '中国浙江'], |
| 48 | + ['https://git.lvmhsh.cn.cnpmjs.org', '新加坡'] |
47 | 49 | ], |
48 | 50 | clone_ssh_url = [ |
49 | | - ['git@git.zhlh6.cn','中国北京'], |
50 | | - ['git@hub.fastgit.org','中国香港'] |
| 51 | + ['git@git.zhlh6.cn', '中国北京'], |
| 52 | + ['git@hub.fastgit.org', '中国香港'] |
51 | 53 | ], |
52 | 54 | raw_url = [ |
53 | | - ['https://raw.githubusercontent.com','Github 原生',''], |
54 | | - ['https://cdn.jsdelivr.net','中国国内','注意:该加速源存在缓存机制(24小时),所以文件可能不是最新。 注意:当前分支所有文件总文件大小超过 50MB 时,该加速源不可用。 注意:当前分支名为版本号格式时(如 v1.2.3),该高速下载链接因格式限制不可用。'], |
55 | | - ['https://raw.fastgit.org','中国香港','注意:单个文件太大时可能会提示超时(实时获取中),请重试。'], |
56 | | - ['https://ghproxy.com','韩国首尔',''] |
| 55 | + ['https://raw.githubusercontent.com', 'Github 原生',''], |
| 56 | + ['https://cdn.jsdelivr.net','中国国内', '注意:该加速源存在缓存机制(24小时),所以文件可能不是最新。 注意:当前分支所有文件总文件大小超过 50MB 时,该加速源不可用。 注意:当前分支名为版本号格式时(如 v1.2.3),该高速下载链接因格式限制不可用。'], |
| 57 | + ['https://raw.fastgit.org','中国香港', '注意:单个文件太大时可能会提示超时(实时获取中),请重试。'], |
| 58 | + ['https://cdn.staticaly.com','日本东京', '注意:该加速是全球 Anycast CDN,国内一般分配到日本节点。'], |
| 59 | + ['https://ghproxy.com','韩国首尔', ''] |
57 | 60 | ], |
58 | 61 | svg = [ |
59 | 62 | '<svg class="octicon octicon-file-zip mr-3" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M3.5 1.75a.25.25 0 01.25-.25h3a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h2.086a.25.25 0 01.177.073l2.914 2.914a.25.25 0 01.073.177v8.586a.25.25 0 01-.25.25h-.5a.75.75 0 000 1.5h.5A1.75 1.75 0 0014 13.25V4.664c0-.464-.184-.909-.513-1.237L10.573.513A1.75 1.75 0 009.336 0H3.75A1.75 1.75 0 002 1.75v11.5c0 .649.353 1.214.874 1.515a.75.75 0 10.752-1.298.25.25 0 01-.126-.217V1.75zM8.75 3a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM6 5.25a.75.75 0 01.75-.75h.5a.75.75 0 010 1.5h-.5A.75.75 0 016 5.25zm2 1.5A.75.75 0 018.75 6h.5a.75.75 0 010 1.5h-.5A.75.75 0 018 6.75zm-1.25.75a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM8 9.75A.75.75 0 018.75 9h.5a.75.75 0 010 1.5h-.5A.75.75 0 018 9.75zm-.75.75a1.75 1.75 0 00-1.75 1.75v3c0 .414.336.75.75.75h2.5a.75.75 0 00.75-.75v-3a1.75 1.75 0 00-1.75-1.75h-.5zM7 12.25a.25.25 0 01.25-.25h.5a.25.25 0 01.25.25v2.25H7v-2.25z"></path></svg>', |
|
251 | 254 | url = [ |
252 | 255 | raw_url[1][0] + "/gh" + href.replace('/blob/','@'), |
253 | 256 | raw_url[2][0] + href2, |
254 | | - raw_url[3][0] + "/" + raw_url[0][0] + href2 |
| 257 | + raw_url[3][0] + "/gh" + href.replace('/blob/','/'), |
| 258 | + raw_url[4][0] + "/" + raw_url[0][0] + href2 |
255 | 259 | ], |
256 | 260 | _html = ``; |
257 | 261 | for (let i=0;i<url.length;i++) { |
258 | | - _html += `<a href="${url[i]}" title="${raw_url[i+1][2]}" role="button" rel="noreferrer noopener nofollow" class="btn btn-sm BtnGroup-item">${raw_url[i+1][1]}</a>` |
| 262 | + _html += `<a href="${url[i]}" title="${raw_url[i+1][2]}" target="_blank" role="button" rel="noreferrer noopener nofollow" class="btn btn-sm BtnGroup-item">${raw_url[i+1][1]}</a>` |
259 | 263 | } |
260 | 264 | html.insertAdjacentHTML('afterend', _html); |
261 | 265 | } |
|
300 | 304 | url_tip = raw_url[1][2]; |
301 | 305 | break; |
302 | 306 | case 3: |
303 | | - url = raw_url[3][0] + "/" + raw_url[0][0] + href2; |
| 307 | + url = raw_url[3][0] + '/gh' + href.replace('/blob/','/'); |
304 | 308 | url_name = raw_url[3][1]; |
305 | 309 | url_tip = raw_url[3][2]; |
306 | 310 | break; |
| 311 | + case 4: |
| 312 | + url = raw_url[4][0] + "/" + raw_url[0][0] + href2; |
| 313 | + url_name = raw_url[4][1]; |
| 314 | + url_tip = raw_url[4][2]; |
| 315 | + break; |
307 | 316 | default: |
308 | 317 | url = raw_url[menu_raw_fast][0] + href2; |
309 | 318 | url_name = raw_url[menu_raw_fast][1]; |
|
0 commit comments