Github1s

One second to read GitHub code with VS Code.

当前为 2021-02-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @namespace https://github.com/JackieZheng
  3. // @name Github1s
  4. // @namespace https://github.com/conwnet/github1s
  5. // @version 0.3
  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. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var github1sBtn = document.createElement("li");
  16. github1sBtn.innerHTML ='Github1s';
  17. github1sBtn.className='open-on-sourcegraph btn btn-sm tooltipped tooltipped-s';
  18. var li=document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline').item(0).getElementsByTagName('li')[0]
  19. document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline').item(0).insertBefore(github1sBtn,li)
  20. github1sBtn.onclick=function()
  21. {
  22. var href=top.location.href.replace('github.com','github1s.com')
  23. top.location.href=href;
  24. }
  25. })();