Geoguessr Blink Mode

Gives you one second per round, but instead of ending instantly, the screen goes black and you have unlimited time to make your guess.

Verzia zo dňa 15.01.2022. Pozri najnovšiu verziu.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         Geoguessr Blink Mode
// @description  Gives you one second per round, but instead of ending instantly, the screen goes black and you have unlimited time to make your guess.
// @version      0.1.0
// @author       macca#8949
// @license      MIT
// @include      https://www.geoguessr.com/*
// @run-at       document-start
// @grant        none
// @namespace    https://greatest.deepsurf.us/en/scripts/438579-geoguessr-blink-mode
// ==/UserScript==

const timeLimit = 1.0; // MODIFY THIS IF YOU WANT TO CHANGE THE TIME

if (sessionStorage.getItem('1SPREnabled') == null) {
    sessionStorage.setItem('1SPREnabled', 'disabled');
}

window.toggleScript = function(e) {
    if (e.checked) {
        sessionStorage.setItem('1SPREnabled', 'enabled');
    } else {
        sessionStorage.setItem('1SPREnabled', 'disabled');
    }
}

function check(changes, observer) {
    if (document.querySelector('.checkboxes--vertical') && document.querySelector('#enableScript') === null) {
        document.querySelector('.checkboxes--vertical').insertAdjacentHTML('beforeend', '<div class="checkboxes checkboxes--vertical"><label class="checkbox"><input type="checkbox" id="enableScript" onclick="toggleScript(this)" class="checkbox__input" name="show-game-settings"><span class="checkbox__mark checkbox__mark--dark"></span> <span class="game-settings__checkbox-main-label">Enable Blink Mode</span><br></label></div>');
        if (sessionStorage.getItem('1SPREnabled') === 'enabled') {
            document.querySelector('#enableScript').checked = true;
        }
    }
}

(new MutationObserver(check)).observe(document, {childList: true, subtree: true});

const checkElement = async selector => {
    while (document.querySelector(selector) === null) {
        await new Promise(resolve => requestAnimationFrame(resolve));
    }
    return document.querySelector(selector);
};

const respondToVisibility = function(element, callback) {
    var options = {
        root: document.documentElement
    }

    var observer = new IntersectionObserver((entries, observer) => {
        entries.forEach(entry => {
            callback(entry.intersectionRatio > 0);
        });
    }, options);

    observer.observe(element);
}

checkElement('.widget-scene-canvas').then((canvas) => {
    respondToVisibility(canvas, visible => {
        if (sessionStorage.getItem('1SPREnabled') === 'enabled') {
            setTimeout(() => {
                canvas.style.display = 'none';
            }, (timeLimit + 0.5) * 1000);
        }
    });
});