// ==UserScript== // @icon https://github.githubassets.com/favicon.ico // @name Github 镜像访问,加速下载 // @namespace https://github.com/jadezi/github-accelerator/ // @version 1.0.7 // @description GitHub 镜像,github 加速 // @author jadezi // @license GPL License // @match *://github.com/* // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @resource mycss https://gitee.com/jadezi/github-accelerator-css/raw/master/index.css // @grant GM_addStyle // @grant GM_setClipboard // @grant GM_getResourceText // @downloadURL none // ==/UserScript== (function() { var clone = true; // var clone = false; var depth = true; // var depth = false; var loca = window.location.href; var mirror_url1 = 'https://' + 'github.com.cnpmjs.org'; var mirror_url2 = 'https://' + 'hub.fastgit.org'; var mirror_url3 = 'https://' + 'github.wuyanzheshui.workers.dev'; var download_url1 = "https://download.fastgit.org"; var str1 = ''; if (clone) { str1 += "git clone "; if (depth) { str1 += "--depth=1 "; } } var a = loca.split("/"); var str2 = '/' + a[3] + '/' + a[4] + '.git'; var clone_utl1 = str1 + mirror_url1 + str2; var clone_utl2 = str1 + mirror_url2 + str2; var str3 = window.location.pathname; var web_url1 = mirror_url1 + str3; var web_url2 = mirror_url2 + str3; var web_url3 = mirror_url3 + str3; var info = `
`; $('.repository-content').prepend(info); $('.release-entry').each(function () { $(this).find('.d-flex.Box-body>a').each(function () { var href = $(this).attr('href'); var url1 = download_url1 + href; var url2 = mirror_url3 + href; var div1 = `` $(this).after(div1); }); $(this).find('.d-block.Box-body>a').each(function () { var href = $(this).attr('href'); var url1 = download_url1 + href; var url2 = mirror_url3 + href; var div1 = `` $(this).after(div1); }); }); $('.mt-2.d-flex').each(function () { var url1 = mirror_url3 +'/'+a[3]+'/'+a[4]+ '/archive/master.zip'; var span1 = `Fast Download ZIP`; $(this).after(span1); }); // 复制按钮 $("#button-copy1").on('click',function(){ GM_setClipboard($('#clone_case_1').val()) alert("复制成功") }) $("#button-copy2").on('click',function(){ GM_setClipboard($('#clone_case_2').val()) alert("复制成功") }) GM_addStyle(GM_getResourceText('mycss')); })();