// ==UserScript== // @name repoDownload // @namespace Scriptz (https://github.com/d3ward/scriptz) // @include *://github.com/*/* // @grant none // @version 1.0 // @author Eduard Ursu ( d3ward ) // @description Script that add a button to download a github repository // ==/UserScript== var path = window.location.pathname; var path_ar = path.split("/"); console.log(path_ar); if(path_ar.length == 3) { var finalLink = "https://github.com" + path + "/archive/master.zip"; /* ---------------- Style --------------- */ var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = "#link-dl{position:fixed;text-align:center;left:10px;bottom:10px;text-decoration: none;padding: 12px;border-radius: .3rem;color: #fff;background:#000;width: 220px;display: inline-block;}#link-dl svg{fill:#fff;width:24px;height:24px;vertical-align:middle;display:inline-flex;}"; document.head.appendChild(style); /* ---------------- Button --------------- */ var gt_btn = document.createElement('a'); gt_btn.id="link-dl"; gt_btn.href= finalLink; gt_btn.innerHTML='Download Repository '; document.querySelector('body').appendChild(gt_btn); }