GitHub in vscode.dev

Open a repo in VS Code using vscode.dev

  1. // ==UserScript==
  2. // @name GitHub in vscode.dev
  3. // @description Open a repo in VS Code using vscode.dev
  4. // @version 0.0.1
  5. // @author Mohamed Elashri
  6. // @iconURL https://github.com/fluidicon.png
  7. // @include *://github.com/*
  8. // @homepage https://melashri.net
  9. // @license MIT
  10. // @require https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
  11. // @run-at document-end
  12. // @namespace https://greasyfork.org/users/798775
  13. // ==/UserScript==
  14. (function () {
  15. $('ul.pagehead-actions').append(`
  16. <li>
  17. <div class="d-block js-toggler-container js-social-container">
  18. <button id="vscode-btn" class="btn btn-sm" aria-label="Open in VS Code" title="Open in VSCode Online">
  19. <svg t="1613473201265" class="octicon octicon-repo-forked" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1503" width="16" height="16"><path d="M746.222933 102.239573l-359.799466 330.820267L185.347413 281.4976 102.2464 329.864533l198.20544 182.132054-198.20544 182.132053 83.101013 48.510293 201.076054-151.558826 359.799466 330.676906 175.527254-85.251413V187.4944z m0 217.57952v384.341334l-255.040853-192.177494z" fill="#2196F3" p-id="1504"></path></svg>
  20. <span>VSCode</span>
  21. </button>
  22. </div>
  23. </li>
  24. `)
  25. $('#vscode-btn').click(() => { window.location.href = window.location.href.replace('github.com', 'vscode.dev/#https://github.com') })
  26. })()