SourceTree Clone for GitLab

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

目前为 2020-07-28 提交的版本。查看 最新版本

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

(function() {
    'use strict';
    var clonemenu = document.querySelector('ul.clone-options-dropdown');
    if(clonemenu){
        var li = document.createElement('li');
        li.classList.add('pt-2');
        var child;
        child = document.createElement('label');
        child.classList.add('label-bold');
        child.innerText = 'Clone with SourceTree';
        li.appendChild(child);
        child = document.createElement('div');
        child.classList.add('input-group');
        var btn = document.createElement('a');
        btn.classList.add('btn', 'btn-primary');
        btn.style.width = '100%';
        btn.innerText = 'Clone In SourceTree'
        btn.tabIndex = 0;
        btn.href = `sourcetree://cloneRepo?type=stash&baseWebUrl=${encodeURIComponent(window.location.origin)}&cloneUrl=${encodeURIComponent(document.getElementById('ssh_project_clone').value)}`;
        child.appendChild(btn);
        li.appendChild(child);
        clonemenu.appendChild(li);
    }
})();

QingJ © 2025

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