Skip to content

Instantly share code, notes, and snippets.

@dimhold
Last active November 26, 2015 11:11
Show Gist options
  • Save dimhold/da59ad552257f43f97e6 to your computer and use it in GitHub Desktop.
Save dimhold/da59ad552257f43f97e6 to your computer and use it in GitHub Desktop.
Add network menu item to the main page of repository
// ==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