GeoGuessr Daily Challenge Click

Redirects to the Daily Challenge page when clicking the daily streak icon on the home page.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GeoGuessr Daily Challenge Click
// @namespace    https://greasyfork.org/en/users/1168708-rotski
// @version      1.0
// @description  Redirects to the Daily Challenge page when clicking the daily streak icon on the home page.
// @author       rotski
// @license      MIT
// @match        https://www.geoguessr.com/*
// @icon         https://www.geoguessr.com/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function enableClickRedirect() {
        const target = document.querySelector('.daily-streak_root__njtkG');
        if (target && !target.dataset.listenerAdded) {
            // Redirect to Daily Challenge on click
            target.addEventListener('click', function(e) {
                e.stopPropagation();
                window.location.href = 'https://www.geoguessr.com/daily-challenges';
            });

            // Change cursor to pointer
            target.style.cursor = 'pointer';

            // Prevent duplicate listener
            target.dataset.listenerAdded = 'true';
        }
    }

    // Initial run
    enableClickRedirect();

    // Watch for dynamic loading
    const observer = new MutationObserver(enableClickRedirect);
    observer.observe(document.body, { childList: true, subtree: true });
})();