您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Leaderboard is synced with the selected game mode.
当前为
// ==UserScript== // @name GeoGuessr Mode and Leaderboard Sync // @namespace http://tampermonkey.net/ // @version 5.4 // @description Leaderboard is synced with the selected game mode. // @author Rotski // @license MIT // @match https://www.geoguessr.com/* // @grant none // ==/UserScript== (function() { 'use strict'; let lastURL = window.location.href; let observer; function simulateClickOnSwitch(labelText) { const targetSwitch = [...document.querySelectorAll('.switch_label__KrnMF')].find(label => label.textContent.trim() === labelText); if (targetSwitch) { targetSwitch.click(); console.log(`Leaderboard synced to: ${labelText}`); } else { console.warn(`Leaderboard switch for "${labelText}" not found.`); } } function checkAndSyncLeaderboard() { const activeModeButton = document.querySelector('.play-setting-button_root__AfG8z.play-setting-button_selected__A0_ik label'); if (activeModeButton) { const activeModeText = activeModeButton.textContent.trim(); simulateClickOnSwitch(activeModeText); console.log(`Leaderboard updated to: ${activeModeText}`); } else { console.error('Active mode button not found.'); } } function setupObserver() { observer = new MutationObserver(mutations => { mutations.forEach(mutation => { if (mutation.addedNodes.length || mutation.attributeName) { checkAndSyncLeaderboard(); } }); }); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] }); } function monitorUrlChanges() { setInterval(() => { const currentURL = window.location.href; if (currentURL !== lastURL) { console.log('URL changed, checking relevance...'); if (currentURL.includes('/maps/')) { if (!observer) { setupObserver(); } checkAndSyncLeaderboard(); } else if (observer) { console.log('Navigating away from maps, disconnecting observer...'); observer.disconnect(); observer = null; // Ensure the observer is cleared } lastURL = currentURL; } }, 1000); // Check every second } document.addEventListener('click', function(event) { if (event.target.closest('.play-setting-button_root__AfG8z.play-setting-button_selected__A0_ik')) { console.log('Mode button clicked, updating leaderboard...'); setTimeout(checkAndSyncLeaderboard, 100); // Delay to allow any page scripts to process the change } }); window.addEventListener('load', () => { setTimeout(() => { console.log('Page loaded. Initializing leaderboard sync...'); setupObserver(); checkAndSyncLeaderboard(); // Perform an initial check in case the observer setup misses the initial state monitorUrlChanges(); // Start monitoring URL changes }, 200); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址