Skip to content

Commit fc83bf8

Browse files
committed
修复 因 Github 样式更新导致 Release 加速源按钮不显示的问题
1 parent ead7ba3 commit fc83bf8

1 file changed

Lines changed: 6 additions & 37 deletions

File tree

GithubEnhanced-High-Speed-Download.user.js

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Github 增强 - 高速下载
3-
// @version 1.6.3
3+
// @version 1.6.4
44
// @author X.I.U
55
// @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁)
66
// @match *://github.com/*
@@ -134,43 +134,14 @@
134134

135135
// Release
136136
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;';}; // 调整小屏幕下样式
144140
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) {
171142
let href = _this.href.split(location.host),
172143
url = [],
173-
_html = `<div style="${divDisplay}justify-content: flex-end;flex-grow: 1;">`;
144+
_html = `<div style="${divDisplay}">`;
174145

175146
for (let i=0;i<download_url.length;i++){
176147
if (download_url[i][0] === 'https://download.fastgit.org') {
@@ -188,8 +159,6 @@
188159
_this.insertAdjacentHTML('afterend', _html);
189160
});
190161
});
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'});
193162
}
194163

195164

0 commit comments

Comments
 (0)