├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── BUG_TEMPLATE.md │ └── SUGGEST_TEMPLATE.md ├── LICENSE ├── README.md └── github-accelerator.user.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['http://pic.wangez.cn/github/alipay.png','http://pic.wangez.cn/github/weixin.png'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 问题反馈 3 | about: 脚本出现了哪些意外情况 4 | title: '' 5 | labels: 问题 6 | assignees: '' 7 | 8 | --- 9 | 10 | **问题描述** 11 | 脚本出现了哪些意外情况 12 | 13 | 14 | **问题复现** 15 | 可以的话来几张图吧 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/SUGGEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 功能建议 3 | about: 给脚本插个翅膀吧 4 | title: "[新功能建议]" 5 | labels: 功能建议 6 | assignees: '' 7 | 8 | --- 9 | 10 | **功能建议** 11 | 想加些什么功能~ 12 | 13 | 14 | **效果图** 15 | 来几张效果图吧~ 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 jadezi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 镜像地址请不要登陆自己的账户,造成损失本人概不负责 2 | 3 | ## 镜像访问GitHub 4 | 5 | 本脚本在 [GitHub 镜像加速下载](https://greasyfork.org/zh-CN/scripts/397419-github-%E9%95%9C%E5%83%8F%E5%8A%A0%E9%80%9F%E4%B8%8B%E8%BD%BD) 脚本的基础上做了些修改。 6 | 7 | ## v2.0.9 8 | 9 | - 替换失效的镜像地址 10 | 11 | ## v2.0.8 12 | 13 | - 修复CSS链接无法加载 14 | 15 | ## v2.0.7 16 | 17 | - 替换Gitee上的CSS 链接,修复[#issue15](https://github.com/jadezi/github-accelerator/issues/15) 18 | 19 | ## v2.0.6 20 | 21 | - 更换cdn链接 22 | 23 | ## v2.0.5 24 | 25 | - 修复**code**面板 Fast Download 异常 26 | 27 | ## v2.0.4 28 | 29 | - 解决镜像面板按钮影响Projects内容完全显示[#issue12](https://github.com/jadezi/github-accelerator/issues/12) 30 | ## v2.0.3 31 | 32 | - 调整按钮css样式 33 | 34 | ## v2.0.2 35 | 36 | - 优化release下载按钮对齐样式 37 | 38 | ## v2.0.1 39 | 40 | - 调整油猴脚本格式 41 | 42 | ## v2.0.0 43 | 44 | - 重构代码、修复样式失效问题、更换镜像网址 45 | 46 | ## v1.1.5 47 | 48 | - 修改release页面,下载按钮样式对齐方式 49 | 50 | ## v1.1.4 51 | 52 | - 添加脚本菜单 53 | - 允许全局设置镜像按钮显示及隐藏 54 | - 适配Github夜间模式 55 | 56 | ## v1.1.3 57 | 58 | - 适配仓库的 wiki 页面 59 | 60 | ## v1.1.2 61 | 62 | - 修复Fast DownLoad消失 63 | - 优化部分UI样式 64 | 65 | ## v1.1.1 66 | 67 | - 恢复访问状态正常的站点 68 | 69 | ## v1.1.0 70 | 71 | - 删除镜像站点 72 | 73 | ## v1.0.8 74 | 75 | - 修复release下载页面,快速下载按钮消失 76 | 77 | ## v1.0.7 78 | 79 | - 修复Fast Download ZIP 按钮失效 80 | 81 | ## v1.0.6 82 | 83 | - 更换release下载地址 84 | 85 | ## v1.0.5 86 | 87 | - 新增下载地址 88 | 89 | ## v1.0.4 90 | 91 | - 更换镜像网址,移除已失效地址(感谢[@FastGit](https://github.com/fastgitorg)提供镜像地址) 92 | - ~新增地址不支持release加速下载,SSH克隆~ 93 | 94 | # github-accelerator 95 | 96 | 油猴插件---github访问加速 97 | -------------------------------------------------------------------------------- /github-accelerator.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Github 镜像访问,加速下载 3 | // @icon https://github.githubassets.com/favicon.ico 4 | // @namespace https://github.com/jadezi/github-accelerator/ 5 | // @version 2.0.9 6 | // @description GitHub 镜像,github 加速 7 | // @author jadezi、wuyuehui 8 | // @license GPL License 9 | // @match *://github.com/* 10 | // @require https://code.jquery.com/jquery-3.4.1.min.js 11 | // @resource customStyles https://gitee.com/jadezi/github-accelerator-css/raw/master/index.css 12 | // @grant GM_addStyle 13 | // @grant GM_setClipboard 14 | // @grant GM_getResourceText 15 | // @grant GM_getValue 16 | // @grant GM_setValue 17 | // @grant GM_registerMenuCommand 18 | // @grant GM_openInTab 19 | // ==/UserScript== 20 | 21 | (function () { 22 | const clone_url_list = [ 23 | { 24 | name: '地址1', 25 | url: 'https://kkgithub.com', 26 | }, 27 | { 28 | name: '地址2', 29 | url: 'https://github.xiaohei.me', 30 | }, 31 | ] 32 | 33 | const download_url = [ 34 | 'https://ghp.ci/', 35 | 'https://github.moeyy.xyz/', 36 | ] 37 | 38 | function init() { 39 | initMirrorUrl() 40 | isProjectUrl() 41 | setTimeout(addDownload, 2000); 42 | addRelease() 43 | } 44 | 45 | // Project页面不添加镜像面板 46 | function isProjectUrl(){ 47 | const pathnameArr = window.location.pathname.split('/'); 48 | if(pathnameArr.length>3&&pathnameArr[3]=="projects"){ 49 | return 50 | }else{ 51 | addPanel() 52 | } 53 | } 54 | 55 | // 初始化镜像地址 56 | function initMirrorUrl() { 57 | const _clone_url_list = clone_url_list.map(mirrorItem => { 58 | const [clone_url, quick_look_url] = joinCloneMirrorUrl(mirrorItem) 59 | return { 60 | clone_url, 61 | quick_look_url, 62 | } 63 | }) 64 | console.log('%c [ _clone_url_list ]', 'font-size:13px; background:pink; color:#bf2c9f;', _clone_url_list) 65 | GM_setValue('clone_url_list', _clone_url_list) 66 | } 67 | 68 | // 拼接克隆地址 69 | const joinCloneMirrorUrl = (mirrorItem) => { 70 | const { url } = mirrorItem 71 | let commonUrl = '' 72 | commonUrl += "git clone "; 73 | commonUrl += url; 74 | const pathnameArr = window.location.pathname.split('/'); 75 | let clone_url = commonUrl + '/' + pathnameArr[1] + '/' + pathnameArr[2] + '.git' 76 | let quick_look_url = url + '/' + pathnameArr[1] + '/' + pathnameArr[2] 77 | return [clone_url, quick_look_url] 78 | } 79 | 80 | // 初始化镜像面板 81 | function addPanel() { 82 | const clone_url_list = GM_getValue('clone_url_list') 83 | // 镜像面板模板 84 | const mirror_template = ` 85 |