Skip to content

Commit 27ba640

Browse files
committed
修复 不同分支下 Code(ZIP) 链接错误的问题
1 parent 4fafd01 commit 27ba640

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

GithubEnhanced-High-Speed-Download.user.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Github 增强 - 高速下载
3-
// @version 1.0.6
3+
// @version 1.0.7
44
// @author X.I.U
55
// @description 为 Github 的 Clone、Release、Code(ZIP) 添加高速下载
66
// @match https://github.com/*/*
@@ -76,12 +76,12 @@
7676
});
7777
// Download ZIP 加速
7878
$(".dropdown-menu.dropdown-menu-sw.p-0 ul li:last-child").each(function () {
79-
var href_split = location.href.split("/");
80-
var url1 = download_url1 +"/"+href_split[3]+"/"+href_split[4]+ "/archive/master.zip";
81-
var url2 = download_url2 +"/github.com/"+href_split[3]+"/"+href_split[4]+ "/archive/master.zip";
82-
var url3 = download_url3 +"/github.com/"+href_split[3]+"/"+href_split[4]+ "/archive/master.zip";
83-
var url4 = download_url4 +"/github.com/"+href_split[3]+"/"+href_split[4]+ "/archive/master.zip";
84-
var url5 = download_url5 +"/github.com/"+href_split[3]+"/"+href_split[4]+ "/archive/master.zip";
79+
var href = $(this).children("a").attr("href");
80+
var url1 = download_url1 + href;
81+
var url2 = download_url2 + "/github.com" + href;
82+
var url3 = download_url3 + "/github.com" + href;
83+
var url4 = download_url4 + "/github.com" + href;
84+
var url5 = download_url5 + "/github.com" + href;
8585
var html1 = `<li class="Box-row Box-row--hover-gray p-0"><a class="d-flex flex-items-center text-gray-dark text-bold no-underline p-3" rel="nofollow" href="${url1}">${download_zip_svg}Download ZIP ${download_url1_name}</a></li>
8686
<li class="Box-row Box-row--hover-gray p-0"><a class="d-flex flex-items-center text-gray-dark text-bold no-underline p-3" rel="nofollow" href="${url2}">${download_zip_svg}Download ZIP ${download_url2_name}</a></li>
8787
<li class="Box-row Box-row--hover-gray p-0"><a class="d-flex flex-items-center text-gray-dark text-bold no-underline p-3" rel="nofollow" href="${url3}">${download_zip_svg}Download ZIP ${download_url3_name}</a></li>
@@ -94,8 +94,8 @@
9494
if (git_clone){
9595
$("[role='tabpanel'] div.input-group").first().each(function () {
9696
var href_split = location.href.split("/");
97-
var url1 = clone_url1 +"/"+href_split[3]+"/"+href_split[4]+ ".git";
98-
var url2 = clone_url2 +"/"+href_split[3]+"/"+href_split[4]+ ".git";
97+
var url1 = clone_url1 + "/" + href_split[3] + "/" + href_split[4] + ".git";
98+
var url2 = clone_url2 + "/" + href_split[3] + "/" + href_split[4] + ".git";
9999
var html1 = `<div class="input-group" style="margin-top: 4px;"><input value="${url1}" aria-label="${url1}" type="text" class="form-control input-monospace input-sm bg-gray-light" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${url1}" aria-label="Copy to clipboard" class="btn btn-sm" tabindex="0" role="button">${download_clone_svg}</clipboard-copy></div></div>
100100
<div class="input-group" style="margin-top: 4px;"><input value="${url2}" aria-label="${url2}" type="text" class="form-control input-monospace input-sm bg-gray-light" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${url2}" aria-label="Copy to clipboard" class="btn btn-sm" tabindex="0" role="button">${download_clone_svg}</clipboard-copy></div></div>`;
101101
$(this).after(html1);

0 commit comments

Comments
 (0)