// ==UserScript== // @icon https://github.githubassets.com/favicon.ico // @name GitHub镜像加速访问、克隆和下载 // @namespace https://github.com/RC1844 // @author RC1844 // @license MIT License // @description 镜像访问GitHub、加速克隆和下载,前往项目Github仓库查看免费搭建Github镜像站点方法 // @include *://github.com/* // @include *://github* // @include *://hub.fastgit.org/* // @require http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js // @version 1.4.0 // @grant GM_addStyle // @downloadURL none // ==/UserScript== (function () { 'use strict'; //=true为启用,=false为禁用 var clone = true; // var clone = false; var depth = true; // var depth = false; var mirror_url = new Array(); mirror_url[0] = 'https://' + 'github.com.cnpmjs.org'; mirror_url[1] = 'https://' + 'hub.fastgit.org'; mirror_url[2] = 'https://' + 'github.wuyanzheshui.workers.dev'; mirror_url[3] = 'https://' + 'github.bajins.com'; mirror_url[4] = 'https://' + 'download.fastgit.org'; mirror_url[5] = 'https://' + 'github.rc1844.workers.dev'; //添加对应数值即可使用 var clone_set = [0, 1]; var mirror_set = [0, 1, 2, 3, 5]; var download_set = [2, 4, 5]; var str1 = ''; if (clone) { str1 += "git clone "; if (depth) { str1 += "--depth=1 "; } } var loca = window.location.href; var a = loca.split("/"); var str2 = '/' + a[3] + '/' + a[4] + '.git'; var str3 = window.location.pathname; //镜像列表 var info = `
镜像网站
镜像站点与快速克隆
`; //克隆列表 for (let i in clone_set) { info += `
`; } //浏览列表 for (let i in mirror_set) { info += ` 镜像浏览${i} ` } if (location.hostname != "github.com") { info += ` 返回GitHub ` } info += `
`; $('div.flex-auto.min-width-0.width-fit.mr-3').after(info); //Fast Download ZIP $('get-repo-controller > details > div > div > div > div.mt-2.d-flex').each(function () { var span = `
`; $(this).find("a[rel='nofollow']").each(function () { var href = $(this).attr('href'); for (let i in download_set) { span += `Download ZIP${i}`; } span += `
`; }); $(this).after(span); }); //Download Releases $('.release-main-section').each(function () { $(this).find('.d-flex.Box-body>a').each(function () { var href = $(this).attr('href'); var span = `
`; for (let i in download_set) { span += `快速下载${i}`; } span += `
`; $(this).after(span); }); }); $('.release-main-section').each(function () { $(this).find('.d-block.Box-body>a').each(function () { var href = $(this).attr('href'); var span = ``; for (let i in download_set) { span += `快速下载${i}`; } $(this).after(span); }); }); })();