您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatially redirects to dark mode on fandom wikis
- // ==UserScript==
- // @name Fandom auto Dark Mode switcher
- // @namespace https://github.com/Artemis-chan
- // @version 1.1
- // @description Automatially redirects to dark mode on fandom wikis
- // @author You
- // @match *.fandom.com/wiki/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=fandom.com
- // @grant none
- // @run-at document-idle
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- var butt = document.getElementsByClassName("wiki-tools__theme-switch")[0];
- if(butt.title == "Dark Theme")
- {
- console.log("Redirecting to Dark Mode");
- butt.click();
- const retries = 5;
- for(var i = retries; i > 0; --i)
- {
- setTimeout(() => {
- console.log("Retrying dark mode switch");
- butt.click();
- }, 1000 * i);
- }
- setTimeout(() => console.logwarning("Dark mode switch failed"), (retries + 1) * 1000);
- }
- })();