您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to Libreddit instances to redirect to a new instance
当前为
- // ==UserScript==
- // @name New Instance Button for Libreddit
- // @namespace happyviking
- // @version 1
- // @grant none
- // @run-at document-end
- // @license MIT
- // @description Adds a button to Libreddit instances to redirect to a new instance
- // @icon https://gitlab.com/uploads/-/system/project/avatar/32545239/libreddit.png
- // @author HappyViking
- // <<INSTANCES START HERE>>
- // [Will be automatically updated by Github Actions]
- // @match https://reddi.tk/*
- // <<INSTANCES END HERE>>
- // ==/UserScript==
- function main() {
- const navBar = document.querySelector('nav');
- if (!navBar) return
- const firstDivInNavBar = navBar.querySelector("div")
- const newButton = document.createElement("button")
- firstDivInNavBar.prepend(newButton)
- newButton.appendChild(document.createTextNode("New Instance"))
- newButton.onclick = () => {
- console.log("hi")
- location.replace('https://farside.link/libreddit/' + window.location.pathname);
- }
- }
- main()