github1s.user.js

Home   »   github1s.user.js

// ==UserScript==
// @name         github1s button
// @version      0.1
// @match        https://github.com/*/*
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function () {
  'use strict';
  add1sbutton();
})();

function add1sbutton() {
  var nav = document.getElementsByClassName("file-navigation")[0];
  
  if (nav)
  {
    var url = window.location.toString();
    var btn = document.createElement("a");

    btn.classList.add("btn")
    btn.classList.add("ml-2")
    btn.classList.add("d-none");
    btn.classList.add("d-md-block");
    btn.href = url.replace("github.com", "github1s.com");
    btn.innerHTML = "Open github1s";

    nav.appendChild(btn)
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *