One Click to VS Code

One Click to VS Code <https://github.dev>. <https://github.com/jks-liu/github.dev.user.js>

  1. // ==UserScript==
  2. // @name One Click to VS Code
  3. // @name:zh-CN 一键直达 VS Code
  4. // @namespace https://github.com/jks-liu/github.dev.user.js
  5. // @supportURL https://github.com/jks-liu/github.dev.user.js
  6. // @version 1.0.0
  7. // @description One Click to VS Code <https://github.dev>. <https://github.com/jks-liu/github.dev.user.js>
  8. // @description:zh-CN 一键直达 VS Code <https://github.dev>。<https://github.com/jks-liu/github.dev.user.js>
  9. // @author Jks Liu (https://github.com/jks-liu)
  10. // @license MIT
  11. // @match https://github.com/*/*
  12. // @icon https://www.google.com/s2/favicons?domain=code.visualstudio.com
  13. // ==/UserScript==
  14.  
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // Link image
  20. var img = document.createElement("img");
  21. img.src = "https://www.google.com/s2/favicons?domain=code.visualstudio.com";
  22. img.alt = "GOTO VS Code (github.dev)";
  23.  
  24. var link = document.createElement("a");
  25. link.href = "https://github.dev" + document.querySelector("strong.mr-2.flex-self-stretch a").href.slice(18);
  26. link.appendChild(img);
  27.  
  28. var user = document.querySelector("strong.mr-2.flex-self-stretch a").parentElement.parentElement.append(link);
  29. })();