SourceTree Clone for GitHub

Add a "Clone with SourceTree" button to GitHub, if you're into that sort of thing

  1. // ==UserScript==
  2. // @name SourceTree Clone for GitHub
  3. // @namespace https://sanin.dev
  4. // @version 0.3
  5. // @description Add a "Clone with SourceTree" button to GitHub, if you're into that sort of thing
  6. // @author Cory Sanin
  7. // @match *://github.com/*
  8. // @grant none
  9. // @icon https://www.sourcetreeapp.com/assets/img/favicons/sourcetree/android-chrome-192x192.png
  10. // @license Unlicense
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var clonemenu = document.querySelector('.get-repo-modal ul');
  16. if(clonemenu){
  17. var li = document.createElement('li');
  18. li.classList.add('Box-row', 'Box-row--hover-gray', 'p-0', 'rounded-0', 'mt-0');
  19. var btn = document.createElement('a');
  20. btn.classList.add('d-flex', 'flex-items-center', 'text-gray-dark', 'text-bold', 'no-underline', 'p-3');
  21. btn.innerHTML = '<svg class="octicon octicon-desktop-download mr-3" width="16" height="16" version="1.1" viewBox="0 0 16 16"><path d="M13.1,5.1C13.1,2.3,10.8,0,8,0S2.9,2.3,2.9,5.1c0,2.5,1.8,4.6,4.1,5V16h2v-5.9C11.4,9.7,13.1,7.6,13.1,5.1z M8,8.2c-1.7,0-3.1-1.4-3.1-3.1S6.3,2,8,2s3.1,1.4,3.1,3.1S9.7,8.2,8,8.2z"></path></svg>'
  22. + 'Clone In SourceTree';
  23. btn.tabIndex = 0;
  24. btn.href = `sourcetree://cloneRepo/${document.querySelector('.get-repo-modal .ssh-clone-options > div input').value}`
  25. li.appendChild(btn);
  26. clonemenu.insertBefore(li, clonemenu.childNodes[0]);
  27. }
  28. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址