|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Github 增强 - 高速下载 |
3 | | -// @version 1.0.6 |
| 3 | +// @version 1.0.7 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 为 Github 的 Clone、Release、Code(ZIP) 添加高速下载 |
6 | 6 | // @match https://github.com/*/* |
|
76 | 76 | }); |
77 | 77 | // Download ZIP 加速 |
78 | 78 | $(".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; |
85 | 85 | 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> |
86 | 86 | <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> |
87 | 87 | <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 | 94 | if (git_clone){ |
95 | 95 | $("[role='tabpanel'] div.input-group").first().each(function () { |
96 | 96 | 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"; |
99 | 99 | 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> |
100 | 100 | <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>`; |
101 | 101 | $(this).after(html1); |
|
0 commit comments