GeoGuessr Return Old Duels UI

This script returns the old geoguessr duels UI but only in matches.

// ==UserScript==
// @name         GeoGuessr Return Old Duels UI
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  This script returns the old geoguessr duels UI but only in matches.
// @author       AaronThug
// @match        https://www.geoguessr.com/*
// @match        https://www.geoguessr.com/multiplayer
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function getLanguagePrefix() {
        const url = window.location.pathname;
        const urlParts = url.split('/').filter(part => part.length > 0);

        if (urlParts[0] && urlParts[0].length <= 3 && urlParts[0] !== 'multiplayer') {
            return '/' + urlParts[0];
        }

        return '';
    }

    function handlePlayButtonClick(event) {
        const path = window.location.pathname;
        const isExactMultiplayerPage = path.endsWith('/multiplayer');

        if (!isExactMultiplayerPage) {
            return;
        }

        let target = event.target;
        let isPlayButton = false;

        while (target && target !== document) {
            if (target.tagName === 'BUTTON') {
                const buttonText = target.textContent.trim();
                if (buttonText === 'Play' || buttonText === 'Spielen' ||
                    buttonText === 'Jouer' || buttonText === 'Jugar' ||
                    buttonText === 'Gioca' || buttonText === 'Spela' ||
                    buttonText === 'プレイ' || buttonText === 'Jogar' ||
                    buttonText === 'Spelen' || buttonText === 'Oyna') {

                    isPlayButton = true;
                    break;
                }
            }
            target = target.parentElement;
        }

        if (isPlayButton) {
            event.preventDefault();
            event.stopPropagation();

            const langPrefix = getLanguagePrefix();
            window.location.href = `https://www.geoguessr.com${langPrefix}/matchmaking`;

            return false;
        }
    }

    function setupEventListener() {
        document.addEventListener('click', handlePlayButtonClick, true);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function() {
            setTimeout(setupEventListener, 500);
        });
    } else {
        setTimeout(setupEventListener, 500);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址