|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Github 增强 - 高速下载 |
3 | | -// @version 1.4.0 |
| 3 | +// @version 1.4.1 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 高速下载 Git Clone、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) |
6 | 6 | // @match *://github.com/* |
7 | 7 | // @match *://hub.fastgit.org/* |
8 | 8 | // @icon https://i.loli.net/2021/03/07/oUHPFSOTjKnkMzJ.png |
9 | 9 | // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js |
| 10 | +/* globals $ */ |
10 | 11 | // @grant GM_registerMenuCommand |
11 | 12 | // @grant GM_unregisterMenuCommand |
12 | 13 | // @grant GM_openInTab |
|
120 | 121 | html = `<div style="display: flex;justify-content: flex-end;">`; |
121 | 122 | for (let i=0;i<url.length;i++) |
122 | 123 | { |
123 | | - html = html + `<a style="${style[0]}" class="btn" href="${url[i]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
| 124 | + html += `<a style="${style[0]}" class="btn" href="${url[i]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
124 | 125 | } |
125 | | - html = html + `</div>` |
| 126 | + html += `</div>` |
126 | 127 | $(this).next().after(html); |
127 | 128 | }); |
128 | 129 | // 修改[文件大小]元素样式 |
|
143 | 144 | html = `<div style="display: flex;justify-content: flex-end;flex-grow: 1;">`; |
144 | 145 | for (let i=0;i<url.length;i++) |
145 | 146 | { |
146 | | - html = html + `<a style="${style[0]}" class="btn" href="${url[i]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
| 147 | + html += `<a style="${style[0]}" class="btn" href="${url[i]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
147 | 148 | } |
148 | | - html = html + `</div>` |
| 149 | + html += `</div>` |
149 | 150 | $(this).after(html); |
150 | 151 | }); |
151 | 152 | }); |
|
169 | 170 | html = ``; |
170 | 171 | for (let i=0;i<url.length;i++) |
171 | 172 | { |
172 | | - html = html + `<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="noreferrer noopener nofollow" href="${url[i]}">${svg[0]}Download ZIP ${download_url[i][1]}</a></li>` |
| 173 | + html += `<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="noreferrer noopener nofollow" href="${url[i]}">${svg[0]}Download ZIP ${download_url[i][1]}</a></li>` |
173 | 174 | } |
174 | 175 | $(this).after(html); |
175 | 176 | }); |
|
188 | 189 | html = ``; |
189 | 190 | for (let i=0;i<url.length;i++) |
190 | 191 | { |
191 | | - html = html + `<div class="input-group" style="margin-top: 4px;" title="加速源:${clone_url[i][1]} (点击可直接复制)"><input value="${url[i]}" aria-label="${url[i]}" type="text" class="form-control input-monospace input-sm bg-gray-light" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${url[i]}" aria-label="Copy to clipboard" class="btn btn-sm" tabindex="0" role="button">${svg[1]}</clipboard-copy></div></div>` |
| 192 | + html += `<div class="input-group" style="margin-top: 4px;" title="加速源:${clone_url[i][1]} (点击可直接复制)"><input value="${url[i]}" aria-label="${url[i]}" type="text" class="form-control input-monospace input-sm bg-gray-light" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${url[i]}" aria-label="Copy to clipboard" class="btn btn-sm" tabindex="0" role="button">${svg[1]}</clipboard-copy></div></div>` |
192 | 193 | } |
193 | 194 | $(this).after(html); |
194 | 195 | }); |
|
209 | 210 | html = ``; |
210 | 211 | for (let i=0;i<url.length;i++) |
211 | 212 | { |
212 | | - html = 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>` |
| 213 | + 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>` |
213 | 214 | } |
214 | 215 | $(this).after(html); |
215 | 216 | }); |
|
228 | 229 | var mouseOverHandler = function(evt){ |
229 | 230 | let elem = evt.currentTarget, |
230 | 231 | aElm_new = elem.querySelectorAll('.fileDownLink'), |
231 | | - aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.text-gray-light'); |
| 232 | + aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary'); |
232 | 233 | aElm_new.forEach(el=>el.style.cssText = 'display: inline'); |
233 | 234 | aElm_now.forEach(el=>el.style.cssText = 'display: none'); |
234 | 235 | }; |
|
237 | 238 | var mouseOutHandler = function(evt){ |
238 | 239 | let elem = evt.currentTarget, |
239 | 240 | aElm_new = elem.querySelectorAll('.fileDownLink'), |
240 | | - aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.text-gray-light'); |
| 241 | + aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary'); |
241 | 242 | aElm_new.forEach(el=>el.style.cssText = 'display: none'); |
242 | 243 | aElm_now.forEach(el=>el.style.cssText = 'display: inline'); |
243 | 244 | }; |
|
246 | 247 | files.each(function(i,fileElm){ |
247 | 248 | let trElm = fileElm.parentNode.parentNode, |
248 | 249 | cntElm_a = trElm.querySelector('.css-truncate.css-truncate-target.d-block.width-fit a'), |
249 | | - cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file.text-gray-light'), |
| 250 | + cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file.color-icon-tertiary'), |
250 | 251 | Name = cntElm_a.innerText, |
251 | 252 | href = cntElm_a.attributes['href'].nodeValue.replace('https://github.com',''); |
252 | 253 | let href2 = href.replace('/blob/','/'), url, url_name, url_tip = ''; |
| 254 | + console.log(cntElm_a, cntElm_svg, Name, href) |
253 | 255 | switch(menu_raw_fast) |
254 | 256 | { |
255 | 257 | case 2: |
|
0 commit comments