您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to osu! beatmap pages to check their status on Akatsuki (or other private servers)
当前为
// ==UserScript== // @name osu! Private Server Beatmap Checker // @namespace https://osu.ppy.sh/ // @version 1.0 // @description Adds a button to osu! beatmap pages to check their status on Akatsuki (or other private servers) // @author ThunderBirdo // @license MIT // @match https://osu.ppy.sh/beatmapsets/* // @grant none // ==/UserScript== (function () { 'use strict'; // === CONSTANTS === const SERVER_LOGO = 'https://akatsuki.gg/static/images/logos/logo.png'; const PRIVATE_SERVER_BASE_URL = 'https://akatsuki.gg/b/'; // === UTILS === function getBeatmapId() { const hash = window.location.hash; if (!hash) return null; const idMatch = hash.match(/\/(\d+)$/); return idMatch ? idMatch[1] : null; } function createCheckbox(label, groupName, value, checked = false) { const labelEl = document.createElement('label'); labelEl.style.display = 'block'; labelEl.style.margin = '3px 0'; const input = document.createElement('input'); input.type = 'radio'; input.name = groupName; input.value = value; input.checked = checked; input.style.marginRight = '6px'; labelEl.appendChild(input); labelEl.appendChild(document.createTextNode(label)); return labelEl; } function openAkatsukiPage(beatmapId, mode, rx) { const url = `${PRIVATE_SERVER_BASE_URL}${beatmapId}?mode=${mode}&rx=${rx}`; window.open(url, '_blank'); } // === MAIN UI === function createUI() { const container = document.createElement('div'); container.style.position = 'fixed'; container.style.right = '20px'; container.style.top = '100px'; container.style.zIndex = 1000; container.style.background = '#333'; container.style.color = 'white'; container.style.padding = '12px'; container.style.borderRadius = '10px'; container.style.boxShadow = '0 0 10px black'; container.style.fontFamily = 'sans-serif'; container.style.width = '200px'; const header = document.createElement('div'); header.style.display = 'flex'; header.style.alignItems = 'center'; header.style.marginBottom = '10px'; const logo = document.createElement('img'); logo.src = SERVER_LOGO; logo.style.height = '20px'; logo.style.marginRight = '8px'; const title = document.createElement('span'); title.textContent = 'Check Status'; title.style.fontWeight = 'bold'; header.appendChild(logo); header.appendChild(title); container.appendChild(header); // Mods container.appendChild(document.createTextNode('Mods')); const modGroup = document.createElement('div'); modGroup.appendChild(createCheckbox('No Mod', 'mod', 0, true)); modGroup.appendChild(createCheckbox('Relax', 'mod', 1)); modGroup.appendChild(createCheckbox('Auto Pilot', 'mod', 2)); container.appendChild(modGroup); container.appendChild(document.createElement('hr')); // Modes container.appendChild(document.createTextNode('Modes')); const modeGroup = document.createElement('div'); modeGroup.appendChild(createCheckbox('Standard', 'mode', 0, true)); modeGroup.appendChild(createCheckbox('Taiko', 'mode', 1)); modeGroup.appendChild(createCheckbox('Catch', 'mode', 2)); modeGroup.appendChild(createCheckbox('Mania', 'mode', 3)); container.appendChild(modeGroup); // Button const button = document.createElement('button'); button.textContent = 'View Page'; button.style.marginTop = '10px'; button.style.width = '100%'; button.style.padding = '6px'; button.style.borderRadius = '6px'; button.style.border = 'none'; button.style.background = '#05a'; button.style.color = 'white'; button.style.fontWeight = 'bold'; button.style.cursor = 'pointer'; button.onclick = () => { const beatmapId = getBeatmapId(); const mode = document.querySelector('input[name="mode"]:checked').value; const mod = document.querySelector('input[name="mod"]:checked').value; if (beatmapId) { openAkatsukiPage(beatmapId, mode, mod); } else { alert("Couldn't find beatmap ID from URL!"); } }; container.appendChild(button); document.body.appendChild(container); } // Delay to ensure osu! DOM loads first setTimeout(() => { if (window.location.href.includes("osu.ppy.sh/beatmapsets")) { createUI(); } }, 1000); })();