SourceTree Clone for GitHub

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         SourceTree Clone for GitHub
// @namespace    https://sanin.dev
// @version      0.3
// @description  Add a "Clone with SourceTree" button to GitHub, if you're into that sort of thing
// @author       Cory Sanin
// @match        *://github.com/*
// @grant        none
// @icon         https://www.sourcetreeapp.com/assets/img/favicons/sourcetree/android-chrome-192x192.png
// @license      Unlicense
// ==/UserScript==

(function() {
    'use strict';
    var clonemenu = document.querySelector('.get-repo-modal ul');
    if(clonemenu){
        var li = document.createElement('li');
        li.classList.add('Box-row', 'Box-row--hover-gray', 'p-0', 'rounded-0', 'mt-0');
        var btn = document.createElement('a');
        btn.classList.add('d-flex', 'flex-items-center', 'text-gray-dark', 'text-bold', 'no-underline', 'p-3');
        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>'
            + 'Clone In SourceTree';
        btn.tabIndex = 0;
        btn.href = `sourcetree://cloneRepo/${document.querySelector('.get-repo-modal .ssh-clone-options > div input').value}`
        li.appendChild(btn);
        clonemenu.insertBefore(li, clonemenu.childNodes[0]);
    }
})();