diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 2e336f9..70e68fd 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Github 增强 - 高速下载 -// @version 1.6.6 +// @version 1.6.7 // @author X.I.U // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) // @match *://github.com/* @@ -21,34 +21,28 @@ (function() { 'use strict'; - var backColor = '#ffffff'; - var fontColor = '#888888'; + var backColor = '#ffffff', fontColor = '#888888'; if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'dark') { // 黑暗模式判断 if (document.getElementsByTagName('html')[0].getAttribute('data-dark-theme') === 'dark_dimmed') { - backColor = '#272e37'; - fontColor = '#768390'; + backColor = '#272e37'; fontColor = '#768390'; } else { - backColor = '#161a21'; - fontColor = '#97a0aa'; + backColor = '#161a21'; fontColor = '#97a0aa'; } } else if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'auto') { - //console.log(window.getComputedStyle(document.body).backgroundColor) if (window.getComputedStyle(document.body).backgroundColor === 'rgb(34, 39, 46)') { - backColor = '#272e37'; - fontColor = '#768390'; + backColor = '#272e37'; fontColor = '#768390'; } else if (window.getComputedStyle(document.body).backgroundColor === 'rgb(13, 17, 23)') { - backColor = '#161a21'; - fontColor = '#97a0aa'; + backColor = '#161a21'; fontColor = '#97a0aa'; } } const download_url = [ - ['https://gh.api.99988866.xyz', '美国 1'], - ['https://github.91chifun.workers.dev', '美国 2'], - ['https://gh.xiu2.xyz', '美国 3'], + ['https://gh.api.99988866.xyz/https://github.com', '美国 1'], + ['https://github.91chifun.workers.dev/https://github.com', '美国 2'], + ['https://gh.xiu2.xyz/https://github.com', '美国 3'], ['https://github.rc1844.workers.dev', '美国 4'], - ['https://pd.zwc365.com/seturl', '美国 5'], + ['https://pd.zwc365.com/seturl/https://github.com', '美国 5'], ['https://download.fastgit.org', '日本'], - ['https://ghproxy.com', '韩国'] + ['https://ghproxy.com/https://github.com/', '韩国'] ], clone_url = [ ['https://hub.fastgit.org', '中国香港'], @@ -132,89 +126,28 @@ // Release function addRelease() { - let html = document.getElementsByClassName('Box-footer');//if (html.length == 0) return + let html = document.getElementsByClassName('Box-footer'); if (html.length == 0) return let divDisplay = ''; - if (html.length > 0) { - if (document.documentElement.clientWidth > 1000) {divDisplay = 'float: right;margin-top: -3px;margin-left: 8px;';}; // 调整小屏幕下样式 - Array.from(html).forEach(function (current) { - current.querySelectorAll('li.Box-row > a').forEach(function (_this) { - let href = _this.href.split(location.host), - url = [], - _html = `
`; - - for (let i=0;i${download_url[i][1]}` - } - _html += `
` - _this.insertAdjacentHTML('afterend', _html); - }); + if (document.documentElement.clientWidth > 1000) {divDisplay = 'float: right;margin-top: -3px;margin-left: 8px;';}; // 调整小屏幕时的样式 + Array.from(html).forEach(function (current) { + current.querySelectorAll('li.Box-row > a').forEach(function (_this) { + let href = _this.href.split(location.host), + url = [], + _html = `
`; + // 循环组合 URL 链接 + for (let i=0;i -1) url[i] = url[i].replace('https://download.fastgit.org','https://archive.fastgit.org') + } + // 循环生成 HTML 标签 + for (let i=0;i${download_url[i][1]}` + } + _html += `
` + _this.insertAdjacentHTML('afterend', _html); }); - } else if (document.getElementsByClassName('Box Box--condensed').length > 0) { - html = document.getElementsByClassName('Box Box--condensed') - if (document.documentElement.clientWidth > 1000) {divDisplay = 'display: flex;';} else {divDisplay = 'display: block;';} - Array.from(html).forEach(function (current) { - current.querySelectorAll('.d-flex.Box-body > a').forEach(function (_this) { - let href = _this.href.split(location.host), - url = [], - _html = `
`; - - for (let i=0;i${download_url[i][1]}` - } - _html += `
` - _this.nextElementSibling.insertAdjacentHTML('afterend', _html); - }); - // 修改[文件大小]元素样式 - document.querySelectorAll('.Box.Box--condensed small').forEach(el=>{el.style.cssText='display: flex; justify-content: flex-end; flex-grow: 1; margin-right: 8px;'}); - - - // Source Code - current.querySelectorAll('.d-block.Box-body > a').forEach(function (_this) { - let href = _this.href.split(location.host), - url = [], - _html = `
`; - - for (let i=0;i${download_url[i][1]}` - } - _html += `
` - _this.insertAdjacentHTML('afterend', _html); - }); - }); - // 修改 Source code 样式,使其和加速按钮并列一排 - 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'}); - } else { - return - } + }); } @@ -227,12 +160,9 @@ _html = ``; for (let i=0;i -1) url[i] = url[i].replace('https://download.fastgit.org','https://archive.fastgit.org') } for (let i=0;i