My Profile Link

Adds a link to profile in nav bar

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         My Profile Link
// @namespace    http://tampermonkey.net/
// @license      MIT
// @version      0.2.1
// @description  Adds a link to profile in nav bar
// @author       cass_per
// @match        https://spacehey.com/*
// @match        https://blog.spacehey.com/*
// @match        https://forum.spacehey.com/*
// @match        https://groups.spacehey.com/*
// @match        https://layouts.spacehey.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=spacehey.com
// @grant        none
// ==/UserScript==

var id = "YOUR ID HERE";
var user="YOUR USER HERE";
// can leave user blank if you have id as url (default option)

const navi = document.getElementsByTagName("nav")[0].getElementsByClassName("links")[0];

var link = document.createElement("li");
link.innerHTML = "<a href='https://spacehey.com/profile?id="+ id +"'>&nbsp;Me</a>";

navi.prepend(link);

var home = navi.getElementsByTagName("li")[1];
navi.prepend(home);

var cur = window.location.href;
if (cur == "https://spacehey.com/profile?id="+ id || cur == "https://spacehey.com/"+ user) {
    home.classList.remove("active");
    link.classList.add("active");
}