Geoguessr Cheat

Press SHIFT + ALT + G and the location of your current geoguessr game will open in a new tab

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name		Geoguessr Cheat
// @namespace		https://www.leonbrandt.com
// @version		2.0.0
// @description		Press SHIFT + ALT + G and the location of your current geoguessr game will open in a new tab
// @author		Leon Brandt
// @homepage		https://www.leonbrandt.com
// @match		http*://*/*
// @grant		none
// @run-at		document-idle
// ==/UserScript==

/*
	MAKE SURE TO RELOAD PAGE AFTER EVERY ROUND BEFORE PRESSING SHIFT + ALT + G
*/

function getTargetUrl() {
	const raw = document.querySelectorAll("#__NEXT_DATA__")[0].text;
	const json = JSON.parse(raw);
	const rounds = json.props.pageProps.game.rounds;
	const currentRound = rounds[rounds.length - 1];

	const targetUrl = "https://google.com/maps/place/" + currentRound.lat + "," + currentRound.lng;

	return targetUrl;
}

(function() {
	'use strict';

	document.onkeydown = evt => {
		evt = evt || window.event;
		if(evt.shiftKey && evt.altKey && evt.keyCode == 71){
			window.open(getTargetUrl(), '_blank');
		}
	};
})();