Skip to content

Instantly share code, notes, and snippets.

@tstrachota
Last active April 20, 2017 10:52
Show Gist options
  • Save tstrachota/b0e1855d61469b001ba3 to your computer and use it in GitHub Desktop.
Save tstrachota/b0e1855d61469b001ba3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GitHub Your Fork
// @namespace https://github.com
// @description Shows a 'forked to' button below the title
// @include https://*github.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @version 1.0.4
// @grant none
// ==/UserScript==
(function($) {
var title = $('.repohead-details-container h1.public');
if (title.length > 0 && $('h1 .fork-flag').length === 0) {
var username = $('img.avatar').attr('alt').substring(1);
var repository = title.find('[itemprop="name"] a').html();
title.append('<span class="fork-flag" style="clear: both;"><span class="text">your fork is at <a href="/' + username + '/' + repository + '">' + username + '/' + repository + '</a></span></span>');
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment