Replace the titles and urls with your own links!
Code:
// ==UserScript==
// @name Lemmy Custom Navbar
// @namespace http://tampermonkey.net/
// @version 0.1
// @author https://lemmy.world/u/0485919158191
// @description Adds a custom navbar to Lemmy with links to custom pages.
// @match *://*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const isLemmy = document.head.querySelector("[name~=Description][content]").content === "Lemmy";
if (!isLemmy) return;
// Create the navbar element
const navbar = document.createElement('div');
navbar.style.backgroundColor = '#FFF';
navbar.style.color = '#000000';
navbar.style.padding = '2.5px';
navbar.style.textAlign = 'center';
// Define the custom pages
const customPages = [
{ title: 'My Profile', url: 'https://lemmy.world/u/0485919158191' },
{ title: 'c/sweden', url: 'https://lemmy.world/c/sweden' },
{ title: 'c/lemmyworld', url: 'https://lemmy.world/c/lemmyworld' },
{ title: 'c/plugins', url: 'https://lemmy.world/c/plugins@sh.itjust.works' },
];
// Create links for each custom page
customPages.forEach((page) => {
const link = document.createElement('a');
link.textContent = page.title;
link.href = page.url;
link.style.color = '#000000';
link.style.marginRight = '10px';
navbar.appendChild(link);
});
// Insert the navbar at the top of the document body
document.body.insertBefore(navbar, document.body.firstChild);
})();
You must log in or register to comment.