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.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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 );