Greasy Fork is available in English.

More Nav on Github

add more items on navbar

  1. // ==UserScript==
  2. // @name More Nav on Github
  3. // @namespace https://github.com/delta4d
  4. // @version 0.0.1
  5. // @license MIT License
  6. // @match https://github.com/*
  7. // @run-at document-end
  8. // @grant none
  9. // @description add more items on navbar
  10. // ==/UserScript==
  11.  
  12. // jshint esversion: 6
  13.  
  14. 'use strict';
  15.  
  16. var addNavItem = (() => {
  17. const nav = document.querySelector(".HeaderMenu").getElementsByTagName('ul')[3];
  18. const cls = nav.firstElementChild.firstElementChild.className; // ul > li > a
  19.  
  20. return (desc, addr) => {
  21. let a = document.createElement("a");
  22. a.setAttribute("class", cls);
  23. a.setAttribute("href", addr);
  24. a.innerText = desc;
  25.  
  26. let item = document.createElement("li");
  27. item.appendChild(a);
  28. nav.appendChild(item);
  29. };
  30. })();
  31.  
  32. addNavItem("Stars", "/stars");
  33. addNavItem("Settings", "/settings");
  34. addNavItem("Discover", "/discover");