Lemmy Custom Navbar Links

Adds a custom navbar to Lemmy with links to custom pages.

Versione datata 20/06/2023. Vedi la nuova versione l'ultima versione.

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         Lemmy Custom Navbar Links
// @namespace    http://tampermonkey.net/
// @version      0.3
// @author       https://lemmy.world/u/0485919158191
// @description  Adds a custom navbar to Lemmy with links to custom pages.
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/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 = '#EFF3F5';
  navbar.style.color = '#000000';
  navbar.style.padding = '2.5px';
  navbar.style.textAlign = 'center';

  // Define the custom pages
  const customPages = [
    { title: 'My Posts', url: 'https://lemmy.world/u/0485919158191/view/Posts/sort/New/page/1', textColor: "#00C853" },
    { title: 'My Comments', url: 'https://lemmy.world/u/0485919158191/view/Comments/sort/New/page/1', textColor: "#00C853" },
    { title: '|', url: '#', textColor: "#000000" },
    { title: 'Sweden', url: 'https://lemmy.world/c/sweden', textColor: "#F1641E" },
    { title: 'DCSS', url: 'https://lemmy.world/c/dcss', textColor: "#F1641E" },
    { title: '|', url: '#', textColor: "#000000" },
    { title: 'Plugins', url: 'https://lemmy.world/c/[email protected]', textColor: "#000000" },
  ];

  // Create links for each custom page
  customPages.forEach((page) => {
    const link = document.createElement('a');
    link.textContent = page.title;
    link.href = page.url;
    link.style.fontWeight = "bold"
    link.style.color = page.textColor;
    link.style.marginRight = '10px';
    navbar.appendChild(link);
  });

  // Insert the navbar at the top of the document body
  document.body.insertBefore(navbar, document.body.firstChild);
})();