Github.com - Extra header links - modified

Adds extra links in github header

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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 - modified
// @namespace   "zhouhao/github/header"
// @description Adds extra links in github header
// @include     https://github.com/*
// @version     2.1.3
// @grant       none
// ==/UserScript==

const nav = document.querySelectorAll('nav.d-flex')[0];
const className = 'js-selected-navigation-item Header-link mt-md-n3 mb-md-n3 py-2 py-md-3 mr-0 mr-md-3 border-top border-md-top-0 border-white-fade-15';

const createItem = (link, text) => {
    const myLink = document.createElement('a');
    myLink.href = '/' + link;
    myLink.setAttribute( 'class', className );
    myLink.innerHTML = text;
    nav.appendChild( myLink );
};

createItem('stars','Stars');
createItem('topics','Topics');

let user = document.querySelector('meta[name="user-login"]').content
createItem(user,user);