|
1 | 1 | // ==UserScript== |
2 | 2 | // @name Github 增强 - 高速下载 |
3 | | -// @version 1.6.3 |
| 3 | +// @version 1.6.4 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) |
6 | 6 | // @match *://github.com/* |
|
134 | 134 |
|
135 | 135 | // Release |
136 | 136 | function addRelease() { |
137 | | - let html = document.getElementsByClassName('Box Box--condensed');if (!html) return |
138 | | - let divDisplay; |
139 | | - if (document.documentElement.clientWidth > 1000) { |
140 | | - divDisplay = 'display: flex;'; |
141 | | - } else { |
142 | | - divDisplay = 'display: block;'; |
143 | | - } |
| 137 | + let html = document.getElementsByClassName('Box-footer');if (!html) return |
| 138 | + let divDisplay = ''; |
| 139 | + if (document.documentElement.clientWidth > 1000) {divDisplay = 'float: right;margin-top: -3px;margin-left: 8px;';}; // 调整小屏幕下样式 |
144 | 140 | Array.from(html).forEach(function (current) { |
145 | | - current.querySelectorAll('.d-flex.Box-body > a').forEach(function (_this) { |
146 | | - let href = _this.href.split(location.host), |
147 | | - url = [], |
148 | | - _html = `<div style="${divDisplay}justify-content: flex-end;">`; |
149 | | - |
150 | | - for (let i=0;i<download_url.length;i++){ |
151 | | - if (download_url[i][0] === 'https://download.fastgit.org') { |
152 | | - url[i] = download_url[i][0] + href[1] |
153 | | - } else { |
154 | | - url[i] = download_url[i][0] + '/' + _this.href |
155 | | - } |
156 | | - if (location.host === 'hub.fastgit.org') url[i] = url[i].replace('hub.fastgit.org','github.com') |
157 | | - } |
158 | | - |
159 | | - for (let i=0;i<url.length;i++) { |
160 | | - _html += `<a style="${style[0]}" class="btn" href="${url[i]}" rel="noreferrer noopener nofollow">${download_url[i][1]}</a>` |
161 | | - } |
162 | | - _html += `</div>` |
163 | | - _this.nextElementSibling.insertAdjacentHTML('afterend', _html); |
164 | | - }); |
165 | | - // 修改[文件大小]元素样式 |
166 | | - document.querySelectorAll('small.pl-2.color-text-secondary.flex-shrink-0').forEach(el=>{el.style.cssText='display: flex; justify-content: flex-end; flex-grow: 1; margin-right: 8px;'}); |
167 | | - |
168 | | - |
169 | | - // Source Code |
170 | | - current.querySelectorAll('.d-block.Box-body > a').forEach(function (_this) { |
| 141 | + current.querySelectorAll('li.Box-row > a').forEach(function (_this) { |
171 | 142 | let href = _this.href.split(location.host), |
172 | 143 | url = [], |
173 | | - _html = `<div style="${divDisplay}justify-content: flex-end;flex-grow: 1;">`; |
| 144 | + _html = `<div style="${divDisplay}">`; |
174 | 145 |
|
175 | 146 | for (let i=0;i<download_url.length;i++){ |
176 | 147 | if (download_url[i][0] === 'https://download.fastgit.org') { |
|
188 | 159 | _this.insertAdjacentHTML('afterend', _html); |
189 | 160 | }); |
190 | 161 | }); |
191 | | - // 修改 Source code 样式,使其和加速按钮并列一排 |
192 | | - document.querySelectorAll('div.d-block.py-1.py-md-2.Box-body.px-2').forEach(el=>{el.className='d-flex py-1 py-md-2 Box-body px-2'}); |
193 | 162 | } |
194 | 163 |
|
195 | 164 |
|
|
0 commit comments