// ==UserScript== // @name Github mirror homepage tranverse // @namespace http://tampermonkey.net/ // @version 0.1 // @description 添加GitHub镜像下载链接,可直接在Linux服务器使用 // @author HuanZhi // @match https://github.com/* // @grant unsafewindow // @license MIT // @run-at document-start // @downloadURL none // ==/UserScript== (function(){ var btn = document.createElement("button"); btn.setAttribute('style', "position:absolute; z-index:1000; right:15px; top:55px; height:28px; background-color:#3E8CD0; border:none; color:white; font-size:16px; cursor:pointer; border-radius:1em;"); btn.setAttribute('id', "btn"); document.body.appendChild(btn); btn.onmouseover = function() { this.style.backgroundColor="#e9686b" }; btn.onmouseout = function() { this.style.backgroundColor="#3E8CD0" }; var url = window.location.href; if (url.includes("github")) { btn.innerText = "镜像地址"; btn.onclick=MirrorLink; } } )() function MirrorLink(){ var home_url = "git clone https://mirror.ghproxy.com/" + window.location.href + ".git"; navigator.clipboard.writeText(copyText); }