// ==UserScript== // @name Github Repo Network Tab // @namespace https://github.com/StaticPH // @match https://github.com/*/* // @exclude-match https://github.com/*/*/search* // @exclude-match https://github.com/about* // @exclude-match https://github.com/contact* // @exclude-match https://github.com/customer-stories* // @exclude-match https://github.com/enterprise* // @exclude-match https://github.com/explore* // @exclude-match https://github.com/features* // @exclude-match https://github.com/login/* // @exclude-match https://github.com/marketplace* // @exclude-match https://github.com/new* // @exclude-match https://github.com/notifications* // @exclude-match https://github.com/organizations/* // @exclude-match https://github.com/orgs/* // @exclude-match https://github.com/pricing* // @exclude-match https://github.com/search* // @exclude-match https://github.com/security* // @exclude-match https://github.com/sessions/* // @exclude-match https://github.com/settings/* // @exclude-match https://github.com/site* // @exclude-match https://github.com/team* // @exclude-match https://github.com/topics* // @exclude-match https://github.com/trending* // @exclude-match https://github.com/users/*/projects/* // @version 1.7.2 // @createdAt 4/06/2020 // @author StaticPH // @description Adds a navigation tab for faster access to the 'Network' page of a repository. // @license MIT // @updateURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/github_repo_network_tab.user.js // @downloadURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/github_repo_network_tab.user.js // @homepageURL https://github.com/StaticPH/UserScripts // @supportURL https://github.com/StaticPH/UserScripts/issues // @icon https://github.githubassets.com/pinned-octocat.svg // @grant none // @run-at document-idle // @noframes // ==/UserScript== (function(){ 'use strict'; /* Determine what repository we are looking at */ let here = (function getRepoAddress(){ return location.pathname.split('/', 3).slice(1).join('/'); })(); /* Honestly, I feel like creating the HTML directly is less of a hassle than creating all the elements with JavaScript */ function createBigNetworkTabHTML(){ // Exclude analytical "data-ga-click" and "data-selected-links" attributes return '\n' + ' \n' + ' \n' + ' Network\n' + ' \n' + '\n'; //TODO: Intelligently determine if the link element should have 'style="visibility:hidden;"' to start with? } /* Used when the window size is small enough that the repository header gets combined with the site header */ function createSmallNetworkTabHTML(){ // This function may not be useful following one of the github ui refreshes since it was first implemented; Leaving it here for now. // Exclude analytical "data-ga-click" and "data-selected-links" attributes return '\n' + ' Network\n' + ''; } //TODO: Intelligently determine if the list element should be hidden when first added function createNetworkTabInDropdownHTML(){ // Exclude analytical "data-ga-click" and "data-selected-links" attributes return '