My Profile Link

Adds a link to profile in nav bar

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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