您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a custom navbar to Lemmy with links to custom pages.
当前为
- // ==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
- // @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 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);
- })();