Github.com - Extra header links

Adds "Stars" and "Watching" links, as well as your user profile link, to the header alongside the existing "Pull Requests", "Issues" and "Gist" links.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Github.com - Extra header links
// @namespace   r-a-y/github/watching/homepage
// @description Adds "Stars" and "Watching" links, as well as your user profile link, to the header alongside the existing "Pull Requests", "Issues" and "Gist" links.
// @match       https://github.com/*
// @version     1.2.3
// @grant       none
// ==/UserScript==

var nav, watchingLink, starLink, user, userLink;

nav = document.querySelector('header nav');

watchingLink = document.createElement('a');
watchingLink.href = '/watching';
watchingLink.setAttribute( 'class', 'mr-lg-3' );
watchingLink.innerHTML = 'Watching';

starLink = document.createElement('a');
starLink.href = '/stars';
starLink.setAttribute( 'class', 'mr-lg-3' );
starLink.innerHTML = 'Stars';

user = document.querySelector('.header-nav-current-user .css-truncate-target').textContent;

userLink = document.createElement('a');
userLink.href = '/' + user;
userLink.setAttribute( 'class', 'mr-lg-3' );
userLink.innerHTML = user;

nav.appendChild( starLink );
nav.appendChild( watchingLink );
nav.appendChild( userLink );