diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 5435a52..ec399b8 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Github 增强 - 高速下载 -// @version 1.7.4 +// @version 1.7.5 // @author X.I.U // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) // @match *://github.com/* @@ -42,8 +42,8 @@ ['https://gh.api.99988866.xyz/https://github.com', '美国 3'], ['https://github.rc1844.workers.dev', '美国 4'], ['https://download.fastgit.org', '日本'], - ['https://ghproxy.com/https://github.com', '韩国'], - ['https://ghproxy.fsou.cc/https://github.com', '香港'] + ['https://ghproxy.com/https://github.com', '韩国'] + //['https://ghproxy.fsou.cc/https://github.com', '香港'] ], clone_url = [ ['https://hub.fastgit.org', '中国香港'], @@ -56,15 +56,15 @@ ], raw_url = [ ['https://raw.githubusercontent.com', 'Github 原生',''], - ['https://ghproxy.fsou.cc/https://github.com', '中国香港 1', ''], - ['https://pd.zwc365.com/seturl/https://raw.githubusercontent.com', '中国香港 2'], + //['https://ghproxy.fsou.cc/https://github.com', '中国香港 1', ''], + ['https://pd.zwc365.com/seturl/https://raw.githubusercontent.com', '中国香港 2', ''], ['https://fastly.jsdelivr.net/gh','日本东京 1', '注意:该加速源存在缓存机制(24小时),所以文件可能不是最新。 注意:当前分支所有文件总文件大小超过 50MB 时,该加速源不可用。 注意:当前 分支名 为版本号格式时(如 v1.2.3),该高速下载链接因格式限制不可用。'], ['https://cdn.staticaly.com/gh','日本东京 2', '注意:该加速是全球 Anycast CDN,国内一般分配到日本节点。'], ['https://raw.fastgit.org','日本东京 3', '注意:单个文件太大时可能会提示超时(实时获取中),请重试。'] ], svg = [ '', - '', + '', '' ], style = ['padding:0 6px;margin-right: -1px;border-radius: 2px;background-color: '+backColor+';border-color: rgba(27, 31, 35, 0.1);font-size: 11px;color: '+fontColor+';']; @@ -135,17 +135,15 @@ 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') - } + url = '', _html = `
`; + // 循环生成 HTML 标签 - for (let i=0;i${download_url[i][1]}` + for (let i=0;i -1) url = url.replace('https://download.fastgit.org','https://archive.fastgit.org') + + _html += `${download_url[i][1]}` } _html += `
` _this.insertAdjacentHTML('afterend', _html); @@ -159,17 +157,14 @@ if (document.querySelector('.XIU2-DZ')) return let html = document.querySelector('.dropdown-menu.dropdown-menu-sw.p-0 ul li:last-child');if (!html) return let href = html.getElementsByTagName('a')[0].href, - url = [], - _html = ``; + url = '', _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 -1) url = url.replace('https://download.fastgit.org','https://archive.fastgit.org') - for (let i=0;i${svg[0]}Download ZIP ${download_url[i][1]}` + _html += `
  • ${svg[0]}Download ZIP ${download_url[i][1]}
  • ` } html.insertAdjacentHTML('afterend', _html); } @@ -180,19 +175,15 @@ if (document.querySelector('.XIU2-GC')) return let html = document.querySelector('[role="tabpanel"]:nth-child(2) div.input-group');if (!html) return let href_split = html.getElementsByTagName('input')[0].getAttribute('value').split(location.host), - url = [], - _html = ``; + url = '', _html = ''; - for (let i=0;i
    ${svg[1]}
    ` + _html += `
    ${svg[1]}
    ` } html.insertAdjacentHTML('afterend', _html); } @@ -203,17 +194,12 @@ if (document.querySelector('.XIU2-GCS')) return let html = document.querySelector('[role="tabpanel"]:nth-child(3) div.input-group');if (!html) return let href_split = html.getElementsByTagName('input')[0].getAttribute('value').split(':'), - url = [], - _html = ``; + _html = ''; if (href_split[0] != 'git@github.com') return - for (let i=0;i
    ${svg[1]}
    ` + for (let i=0;i
    ${svg[1]}
    ` } html.insertAdjacentHTML('afterend', _html); } @@ -225,16 +211,18 @@ let html = document.getElementById('raw-url');if (!html) return let href = location.href.replace(`https://${location.host}`,''), href2 = href.replace('/blob/','/'), - url = [ - raw_url[1][0] + href, - raw_url[2][0] + href2, - raw_url[3][0] + href.replace('/blob/','@'), - raw_url[4][0] + href2, - raw_url[5][0] + href2 - ], - _html = ``; - for (let i=0;i${raw_url[i+1][1]}` + url = '', _html = ''; + + for (let i=1;i${raw_url[i][1]}` } html.insertAdjacentHTML('afterend', _html); } @@ -272,22 +260,17 @@ Name = cntElm_a.innerText, href = cntElm_a.attributes.href.nodeValue.replace(`https://${location.host}`,''), href2 = href.replace('/blob/','/'), url, url_name, url_tip = ''; + switch(menu_raw_fast) { - case 0: - case 2: - case 4: - case 5: - url = raw_url[menu_raw_fast][0] + href2; break; - case 1: - url = raw_url[menu_raw_fast][0] + href; break; + //case 1: + // url = raw_url[menu_raw_fast][0] + href; break; case 3: url = raw_url[menu_raw_fast][0] + href.replace('/blob/','@'); break; default: - url = raw_url[menu_raw_fast][0] + '/' + raw_url[0][0] + href2; + url = raw_url[menu_raw_fast][0] + href2; } url_name = raw_url[menu_raw_fast][1]; url_tip = raw_url[menu_raw_fast][2]; - let _html = ` `; - cntElm_svg.insertAdjacentHTML('afterend', _html); + cntElm_svg.insertAdjacentHTML('afterend', ``); // 绑定鼠标事件 trElm.onmouseover = mouseOverHandler; trElm.onmouseout = mouseOutHandler;