您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Set default type of beatmapsets discussion page to 'total'
// ==UserScript== // @name OSU change default discussion type to total // @namespace http://tampermonkey.net/ // @version 2024-07-08.2 // @description Set default type of beatmapsets discussion page to 'total' // @author Kinomi // @match https://osu.ppy.sh/* // @icon https://www.google.com/s2/favicons?sz=64&domain=ppy.sh // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... let previousUrl = ""; let init = false; let intervel = null; const handleNavigationChange = function (checkInit) { const btns = document.querySelectorAll("a.header-nav-v4__link"); if (btns) { if (checkInit) { if (!init) { init = true; if (intervel !== null) clearInterval(intervel); } else return; } console.log(btns); btns.forEach((i) => { if (i.href && i.href.endsWith("discussion")) { i.href = `${i.href}/-/generalAll/total`; } }); console.log(Array.from(btns).map((i) => i.href)); } }; const config = { attributes: true, childList: false, subtree: true }; const observer = new MutationObserver(() => { if (document.URL !== previousUrl) { previousUrl = document.URL; handleNavigationChange(); } }); observer.observe(document, config); intervel = setInterval(() => { handleNavigationChange(true); }, 200); })();