您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a custom navbar to Lemmy with links to custom pages.
// ==UserScript== // @name Lemmy Custom Navbar Links // @namespace http://tampermonkey.net/ // @version 0.5 // @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'; navbar.style.position = "sticky"; navbar.style.top = "0"; navbar.style.width = "100%"; navbar.style.zIndex = "100"; // 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 = "" 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); })();