Last active
November 26, 2015 11:11
-
-
Save dimhold/da59ad552257f43f97e6 to your computer and use it in GitHub Desktop.
Add network menu item to the main page of repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name github-network.user.js | |
// @namespace https://github.com/ | |
// @description Add network menu item to the main page of repository | |
// @include https://github.com/* | |
// @version 2.0.1 | |
// @grant none | |
// ==/UserScript== | |
var repo = window.location.pathname; | |
if (repo) { | |
repo = repo.match(/(\/[^/]+){2}/)[0]; | |
} | |
var $menu = $(".reponav"); | |
if (!repo || !$menu[0]) { | |
return; | |
} | |
var networkHtml = '<a data-selected-links="repo_graphs repo_contributors {{REPO}}/network" class="js-selected-navigation-item reponav-item" href="{{REPO}}/network">' + | |
'<span class="octicon octicon-gist-fork"></span>' + | |
'Network' + | |
'</a>'; | |
networkHtml = networkHtml.replace(/{{REPO}}/g, repo); | |
$menu.append(networkHtml); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment