Github1s

One second to read GitHub code with VS Code.

As of 2021-02-10. See the latest version.

  1. // ==UserScript==
  2. // @namespace https://github.com/JackieZheng/Github1s
  3. // @name Github1s
  4. // @namespace https://github.com/conwnet/github1s
  5. // @version 0.4
  6. // @description One second to read GitHub code with VS Code.
  7. // @author JackieZheng
  8. // @match https://github.com/*/*
  9. // @supportURL https://github.com/JackieZheng/Github1s/issues
  10. // @icon https://github1s.com/favicon.ico
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. var github1sBtn = document.createElement("li");
  17. github1sBtn.innerHTML ='Github1s';
  18. github1sBtn.className='open-on-sourcegraph btn btn-sm tooltipped tooltipped-s';
  19. var li=document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline').item(0).getElementsByTagName('li')[0]
  20. document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline').item(0).insertBefore(github1sBtn,li)
  21. github1sBtn.onclick=function()
  22. {
  23. var href=top.location.href.replace('github.com','github1s.com')
  24. top.location.href=href;
  25. }
  26. })();