FastGitCode

fast show git code!

目前为 2020-06-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name FastGitCode
  3. // @namespace https://github.com/holleworldabc/browser-tools
  4. // @version 1.0.1
  5. // @description fast show git code!
  6. // @author wm
  7. // @match https://github.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. window.fgc.version = '1.0.1';
  13. window.fgc.updateDate = '20200311';
  14. //-------------------------------------------
  15. const fileNav = document.getElementsByClassName('file-navigation')[0];
  16. const btn = document.createElement("span");
  17. btn.className = "btn btn-sm btn-blue";
  18. btn.innerText = "Source Graph";
  19. btn.style.marginLeft = '8px';
  20. btn.style.height = '32px';
  21. btn.onclick = function () {
  22. const url = window.location.href;
  23. const sourceGraph = 'https://sourcegraph.com/'
  24. const last = url.split('://')[1];
  25. if(last.indexOf("\/tree\/") != -1){
  26. var last2=last.replace('\/tree\/', '@');
  27. }else{
  28. var last2=last;
  29. }
  30. window.open(sourceGraph + last2);
  31. }
  32. fileNav.appendChild(btn);
  33. })()