Skip to content

Instantly share code, notes, and snippets.

@bentleyo
Last active January 2, 2016 08:49
Show Gist options
  • Save bentleyo/8278671 to your computer and use it in GitHub Desktop.
Save bentleyo/8278671 to your computer and use it in GitHub Desktop.
BitBucket GitHub App clone link
// ==UserScript==
// @name F Yo SourceTree
// @namespace https://gist.github.com/bentleyo/8278671
// @version 0.1.2
// @description Replace SourceTree clone link with a link for GitHub app
// @match https://bitbucket.org/*
// @copyright 2013+, Bentley O'Kane-Chase
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
$( window ).load(function() {
var info = $('.clone-in-sourcetree').removeClass('clone-in-sourcetree');
var button = info.find('button');
button.off().text('Clone in GitHub').addClass('clone-in-github');
$('.clone-in-github').click(function() {window.location = 'github-mac://openRepo/' + $(this).closest('.clone-in-sourcetree').data('ssh-url')});
$('body').on('click', '.clone-in-github', function() {
window.open('github-mac://openRepo/' + info.data('ssh-url'), '_self');
});
});
@bentleyo
Copy link
Author

bentleyo commented Jan 6, 2014

Currently specific to the GitHub Mac App & SSH, but can be customised.

@bentleyo
Copy link
Author

Run on window load instead of dom ready as it seems bitbucket isn't ready by this point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment