Geoguessr Duel + Team Duel Summary → Open Round 1

Automatically open the first round instead of the last one in Geoguessr duel and team duel summaries.

目前為 2025-10-29 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Geoguessr Duel + Team Duel Summary → Open Round 1
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically open the first round instead of the last one in Geoguessr duel and team duel summaries.
// @match        https://www.geoguessr.com/duels/*/summary
// @match        https://www.geoguessr.com/team-duels/*/summary
// @run-at       document-idle
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  function waitForElement(selector, timeout = 10000) {
    return new Promise((resolve, reject) => {
      const found = document.querySelector(selector);
      if (found) return resolve(found);

      const observer = new MutationObserver(() => {
        const el = document.querySelector(selector);
        if (el) {
          observer.disconnect();
          resolve(el);
        }
      });

      observer.observe(document.body, { childList: true, subtree: true });

      setTimeout(() => {
        observer.disconnect();
        reject(new Error(`Timeout waiting for ${selector}`));
      }, timeout);
    });
  }

  async function openFirstRound() {
    try {
      // Wait for *any* round element to appear
      await waitForElement('div[class^="game-summary_text"]');

      // Get all clickable round elements
      const roundButtons = Array.from(
        document.querySelectorAll('div[class^="game-summary_text"]')
      ).filter((el) => el.textContent.trim().match(/^Round\s*\d+/i));

      // Find "Round 1"
      const round1 = roundButtons.find((el) =>
        /^Round\s*1$/i.test(el.textContent.trim())
      );

      if (round1) {
        console.log('[Geoguessr Round Opener] Clicking "Round 1"...');
        round1.click();
      } else {
        console.warn('[Geoguessr Round Opener] Could not find Round 1 button');
      }
    } catch (err) {
      console.error('[Geoguessr Round Opener]', err);
    }
  }

  openFirstRound();
})();