Github.com: Add profile link to nav.

Add profile link to nav bar.

Verze ze dne 23. 04. 2020. Zobrazit nejnovější verzi.

  1. // ==UserScript==
  2. // @name Github.com: Add profile link to nav.
  3. // @namespace https://greatest.deepsurf.us/zh-CN/scripts/397263
  4. // @version 0.3
  5. // @description Add profile link to nav bar.
  6. // @author Al Cheung
  7. // @match *://github.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const $ = document.querySelector.bind(document);
  15. const headerList = $(`nav.d-flex`);
  16. const a = document.createElement(`a`);
  17. a.className = `js-selected-navigation-item Header-link py-lg-3 mr-0 mr-lg-3 py-2 border-top border-lg-top-0 border-white-fade-15`;
  18. a.innerText = `My Profile`;
  19. const userName = $(`details > summary > img`).alt.replace(`@`, '');
  20. a.href = `//github.com/${userName}`;
  21. headerList.appendChild(a);
  22. })();