// ==UserScript==
// @name Lunar V1 | Google Maps, PlonkIT, TTS
// @namespace http://tampermonkey.net/
// @version 1.0.4.6
// @description Legit Cheat for GeoGuessr
// @author Neo
// @match https://www.geoguessr.com/*
// @grant GM_xmlhttpRequest
// @run-at document-start
// @license MIT
// ==/UserScript==
(function() {
'use strict';
let globalCoordinates = { lat: 0, lng: 0 };
let googleMapsTab = null;
let plonkitTab = null;
let englishSlug = '';
let isGoogleMapsEnabled = false;
let isPlonkitEnabled = false;
let minDelay = 500;
let maxDelay = 1000;
// HUD-Display-Toggles
let isDisplayEnabled = true;
let isUsernameEnabled = true;
let isTimeEnabled = true;
let isClassicMapTimerEnabled = true;
let isCountryEnabled = false;
let isMenuOpen = false;
let menu = null;
let toggleKey = 'q';
let menuHotkey = 'insert';
// Location display elements
let countryDisplay = null;
let stateDisplay = null;
let cityDisplay = null;
let isInGame = false;
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
function createLocationDisplays() {
const container = document.createElement('div');
container.id = 'geohelper-location-container';
container.style.position = 'fixed';
container.style.top = '50px';
container.style.left = '10px';
container.style.zIndex = '1000';
container.style.display = isCountryEnabled ? 'block' : 'none';
container.style.fontFamily = 'Arial, sans-serif';
countryDisplay = document.createElement('div');
countryDisplay.id = 'geohelper-country';
countryDisplay.style.color = 'white';
countryDisplay.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
countryDisplay.style.padding = '5px 10px';
countryDisplay.style.borderRadius = '5px';
countryDisplay.style.marginBottom = '5px';
countryDisplay.style.fontSize = '14px';
countryDisplay.style.fontWeight = 'bold';
countryDisplay.textContent = 'Country: N/A';
stateDisplay = document.createElement('div');
stateDisplay.id = 'geohelper-state';
stateDisplay.style.color = 'white';
stateDisplay.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
stateDisplay.style.padding = '5px 10px';
stateDisplay.style.borderRadius = '5px';
stateDisplay.style.marginBottom = '5px';
stateDisplay.style.fontSize = '14px';
stateDisplay.style.fontWeight = 'bold';
stateDisplay.textContent = 'State: N/A';
cityDisplay = document.createElement('div');
cityDisplay.id = 'geohelper-city';
cityDisplay.style.color = 'white';
cityDisplay.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
cityDisplay.style.padding = '5px 10px';
cityDisplay.style.borderRadius = '5px';
cityDisplay.style.fontSize = '14px';
cityDisplay.style.fontWeight = 'bold';
cityDisplay.textContent = 'City: N/A';
container.appendChild(countryDisplay);
container.appendChild(stateDisplay);
container.appendChild(cityDisplay);
document.body.appendChild(container);
}
function resetLocationDisplays() {
if (countryDisplay) countryDisplay.textContent = 'Country: N/A';
if (stateDisplay) stateDisplay.textContent = 'State: N/A';
if (cityDisplay) cityDisplay.textContent = 'City: N/A';
}
function updateLocationDisplays(country, state, city) {
if (countryDisplay) countryDisplay.textContent = `Country: ${country || 'N/A'}`;
if (stateDisplay) stateDisplay.textContent = `State: ${state || 'N/A'}`;
if (cityDisplay) cityDisplay.textContent = `City: ${city || 'N/A'}`;
}
function fetchLocationDetails(lat, lng) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: 'GET',
url: `https://us1.locationiq.com/v1/reverse?key=pk.010bb988be9b2a316e7093ae8e316e6d&lat=${lat}&lon=${lng}&format=json`,
headers: { 'Accept': 'application/json' },
onload: function (response) {
if (response.status === 200) {
try {
const data = JSON.parse(response.responseText);
let country = '';
let state = '';
let city = '';
if (data.address) {
country = data.address.country || '';
state = data.address.state || data.address.county || '';
city = data.address.city || data.address.town || data.address.village || '';
}
resolve({ country, state, city });
} catch (e) {
resolve({ country: '', state: '', city: '' });
}
} else {
resolve({ country: '', state: '', city: '' });
}
},
onerror: function (error) {
resolve({ country: '', state: '', city: '' });
}
});
});
}
function fetchCountry(lat, lng) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: 'GET',
url: `https://us1.locationiq.com/v1/reverse?key=pk.010bb988be9b2a316e7093ae8e316e6d&lat=${lat}&lon=${lng}&format=json`,
headers: { 'Accept': 'application/json' },
onload: function (response) {
if (response.status === 200) {
try {
const data = JSON.parse(response.responseText);
let country = '';
if (data.address) {
country = data.address.country || '';
}
resolve(country);
} catch (e) {
resolve('');
}
} else {
resolve('');
}
},
onerror: function (error) {
resolve('');
}
});
});
}
function delayedRequest(url) {
return new Promise((resolve) => {
const delay = Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
setTimeout(() => {
GM_xmlhttpRequest({
method: 'GET',
url: url,
onload: function(response) {
resolve(response.responseText);
},
onerror: function() {
resolve(null);
}
});
}, delay);
});
}
function checkGameState() {
const gamePath = window.location.pathname.includes("/game/");
const resultPath = window.location.pathname.includes("/results/");
if (resultPath && isInGame) {
// Just finished a game
resetLocationDisplays();
isInGame = false;
} else if (gamePath && !isInGame) {
// Started a new game
isInGame = true;
}
}
(function() {
eval(`
(function() {
const xhrProxy = new Proxy(XMLHttpRequest.prototype.open, {
apply: function(target, thisArg, args) {
let [method, url] = args;
if (method.toUpperCase() === 'POST' &&
(url.includes('google.internal.maps.mapsjs.v1.MapsJsInternalService/GetMetadata') ||
url.includes('google.internal.maps.mapsjs.v1.MapsJsInternalService/SingleImageSearch'))) {
thisArg.addEventListener('load', function() {
try {
let match = this.responseText.match(/-?\\d+\\.\\d+,-?\\d+\\.\\d+/g);
if (match) {
let [lat, lng] = match[0].split(',').map(Number);
globalCoordinates = { lat, lng };
}
} catch (e) {
console.error('Error extracting coordinates:', e);
}
});
}
return target.apply(thisArg, args);
}
});
Object.defineProperty(XMLHttpRequest.prototype, 'open', {
configurable: true,
enumerable: false,
writable: true,
value: xhrProxy
});
})();
`);
})();
async function openMapsAndPlonkit() {
const { lat, lng } = globalCoordinates;
if (!lat || !lng) return;
// Fetch and display location details if enabled
if (isCountryEnabled) {
const { country, state, city } = await fetchLocationDetails(lat, lng);
updateLocationDisplays(country, state, city);
}
const mapUrl = `https://www.google.com/maps?q=${lat},${lng}`;
const country = await fetchCountry(lat, lng);
if (!country) return;
let englishSlug = country.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
englishSlug = englishSlug.replace(/\s+/g, '-');
if (englishSlug === "israel" || englishSlug === "palestine") {
englishSlug = "israel-west-bank";
}
const plonkitUrl = `https://www.plonkit.net/${englishSlug}`;
const delay = Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
setTimeout(() => {
if (isGoogleMapsEnabled && (!googleMapsTab || googleMapsTab.closed)) {
googleMapsTab = window.open(mapUrl, '_blank', `width=1200,height=800,left=3000,top=0`);
if (googleMapsTab) googleMapsTab.focus();
} else if (isGoogleMapsEnabled && googleMapsTab) {
googleMapsTab.location.href = mapUrl;
googleMapsTab.focus();
}
if (isPlonkitEnabled && (!plonkitTab || plonkitTab.closed)) {
plonkitTab = window.open(plonkitUrl, '_blank', `width=1200,height=800,left=3000,top=200`);
if (plonkitTab) plonkitTab.focus();
} else if (isPlonkitEnabled && plonkitTab) {
plonkitTab.location.href = plonkitUrl;
plonkitTab.focus();
}
}, delay);
}
function handleKeyPress(event) {
// Normalize both the pressed key and menuHotkey for comparison
const pressedKey = event.key.toLowerCase();
const currentHotkey = menuHotkey.toLowerCase();
// Special case for space to avoid " " vs "Space" mismatch
if (event.key === ' ' && menuHotkey === 'Space') {
toggleMenu();
return;
}
// Check for exact match or special key match
if (pressedKey === currentHotkey ||
(event.key === menuHotkey) ||
(event.code === `Key${menuHotkey.toUpperCase()}`)) {
toggleMenu();
} else if (pressedKey === 'q') {
openMapsAndPlonkit();
}
}
function toggleMenu() {
if (!menu) {
createMenu();
}
isMenuOpen = !isMenuOpen;
menu.style.display = isMenuOpen ? 'block' : 'none';
}
function createMenu() {
menu = document.createElement('div');
menu.id = 'geohelper-menu';
menu.style.width = '400px';
menu.style.position = 'fixed';
menu.style.top = '50%';
menu.style.left = '50%';
menu.style.transform = 'translate(-50%, -50%)';
menu.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
menu.style.color = 'white';
menu.style.padding = '20px';
menu.style.borderRadius = '10px';
menu.style.zIndex = '10000';
menu.style.display = 'block';
const header = document.createElement('h3');
header.innerHTML = '<span style="color: purple;">Lu</span>nar V1';
header.style.marginBottom = '20px';
menu.appendChild(header);
// Tab-Container
const tabContainer = document.createElement('div');
tabContainer.style.display = 'flex';
tabContainer.style.justifyContent = 'space-around';
tabContainer.style.marginBottom = '15px';
const locationTabBtn = document.createElement('button');
locationTabBtn.innerText = 'Location';
locationTabBtn.style.flex = '1';
locationTabBtn.style.cursor = 'pointer';
locationTabBtn.style.background = '#444';
locationTabBtn.style.color = 'white';
const hudTabBtn = document.createElement('button');
hudTabBtn.innerText = 'HUD';
hudTabBtn.style.flex = '1';
hudTabBtn.style.cursor = 'pointer';
hudTabBtn.style.background = '#444';
hudTabBtn.style.color = 'white';
const settingsTabBtn = document.createElement('button');
settingsTabBtn.innerText = 'Settings';
settingsTabBtn.style.flex = '1';
settingsTabBtn.style.cursor = 'pointer';
settingsTabBtn.style.background = '#444';
settingsTabBtn.style.color = 'white';
tabContainer.appendChild(locationTabBtn);
tabContainer.appendChild(hudTabBtn);
tabContainer.appendChild(settingsTabBtn);
menu.appendChild(tabContainer);
const contentContainer = document.createElement('div');
// Location Tab Content
const locationContent = document.createElement('div');
locationContent.style.position = 'relative';
// Add status text at the bottom of location tab
const statusText = document.createElement('div');
statusText.innerHTML = 'STATUS: <span style="color: #ffa500;">Outdated</span> | Download update from Discord | Security Patch!';
statusText.style.color = '#ff4444'; // Red color for warning
statusText.style.fontSize = '12px';
statusText.style.fontWeight = 'bold';
statusText.style.textAlign = 'center';
statusText.style.marginTop = '20px';
statusText.style.padding = '5px';
statusText.style.borderTop = '1px solid rgba(255,255,255,0.2)';
const googleMapsToggleLabel = document.createElement('label');
googleMapsToggleLabel.innerText = 'Enable Google Maps';
const googleMapsToggle = document.createElement('input');
googleMapsToggle.type = 'checkbox';
googleMapsToggle.checked = isGoogleMapsEnabled;
googleMapsToggle.style.display = 'none';
const googleMapsCustomToggle = document.createElement('div');
googleMapsCustomToggle.classList.add('custom-toggle');
googleMapsCustomToggle.classList.add(!isGoogleMapsEnabled ? 'unchecked' : 'checked');
googleMapsCustomToggle.addEventListener('click', () => {
isGoogleMapsEnabled = !isGoogleMapsEnabled;
googleMapsCustomToggle.classList.toggle('checked', isGoogleMapsEnabled);
googleMapsCustomToggle.classList.toggle('unchecked', !isGoogleMapsEnabled);
});
const locToggleWrapper1 = document.createElement('div');
locToggleWrapper1.style.display = 'flex';
locToggleWrapper1.style.justifyContent = 'space-between';
locToggleWrapper1.appendChild(googleMapsToggleLabel);
locToggleWrapper1.appendChild(googleMapsCustomToggle);
const plonkitToggleLabel = document.createElement('label');
plonkitToggleLabel.innerText = 'Enable Plonkit';
const plonkitToggle = document.createElement('input');
plonkitToggle.type = 'checkbox';
plonkitToggle.checked = isPlonkitEnabled;
plonkitToggle.style.display = 'none';
const plonkitCustomToggle = document.createElement('div');
plonkitCustomToggle.classList.add('custom-toggle');
plonkitCustomToggle.classList.add(!isPlonkitEnabled ? 'unchecked' : 'checked');
plonkitCustomToggle.addEventListener('click', () => {
isPlonkitEnabled = !isPlonkitEnabled;
plonkitCustomToggle.classList.toggle('checked', isPlonkitEnabled);
plonkitCustomToggle.classList.toggle('unchecked', !isPlonkitEnabled);
});
const locToggleWrapper2 = document.createElement('div');
locToggleWrapper2.style.display = 'flex';
locToggleWrapper2.style.justifyContent = 'space-between';
locToggleWrapper2.appendChild(plonkitToggleLabel);
locToggleWrapper2.appendChild(plonkitCustomToggle);
const countryLabel = document.createElement('label');
countryLabel.innerText = 'Show Location Info HUD';
const countryToggle = document.createElement('input');
countryToggle.type = 'checkbox';
countryToggle.checked = isCountryEnabled;
countryToggle.style.display = 'none';
const countryCustomToggle = document.createElement('div');
countryCustomToggle.classList.add('custom-toggle');
countryCustomToggle.classList.add(!isCountryEnabled ? 'unchecked' : 'checked');
countryCustomToggle.addEventListener('click', () => {
isCountryEnabled = !isCountryEnabled;
countryCustomToggle.classList.toggle('checked', isCountryEnabled);
countryCustomToggle.classList.toggle('unchecked', !isCountryEnabled);
const container = document.getElementById('geohelper-location-container');
if (container) {
container.style.display = isCountryEnabled ? 'block' : 'none';
}
if (!isCountryEnabled) {
resetLocationDisplays();
}
});
const locToggleWrapper3 = document.createElement('div');
locToggleWrapper3.style.display = 'flex';
locToggleWrapper3.style.justifyContent = 'space-between';
locToggleWrapper3.appendChild(countryLabel);
locToggleWrapper3.appendChild(countryCustomToggle);
const hotkeyLabel = document.createElement('label');
hotkeyLabel.innerText = 'Hotkey: Q';
const locToggleWrapper4 = document.createElement('div');
locToggleWrapper4.style.display = 'flex';
locToggleWrapper4.style.justifyContent = 'space-between';
locToggleWrapper4.appendChild(hotkeyLabel);
locationContent.appendChild(locToggleWrapper1);
locationContent.appendChild(locToggleWrapper2);
locationContent.appendChild(locToggleWrapper3);
locationContent.appendChild(locToggleWrapper4);
locationContent.appendChild(statusText);
// HUD Tab Content
const hudContent = document.createElement('div');
// Main Display Toggle
const mainDisplayLabel = document.createElement('label');
mainDisplayLabel.innerText = 'Main Display';
const mainDisplayToggle = document.createElement('input');
mainDisplayToggle.type = 'checkbox';
mainDisplayToggle.checked = isDisplayEnabled;
mainDisplayToggle.style.display = 'none';
const mainDisplayCustomToggle = document.createElement('div');
mainDisplayCustomToggle.classList.add('custom-toggle');
mainDisplayCustomToggle.classList.add(isDisplayEnabled ? 'checked' : 'unchecked');
mainDisplayCustomToggle.addEventListener('click', () => {
isDisplayEnabled = !isDisplayEnabled;
mainDisplayCustomToggle.classList.toggle('checked', isDisplayEnabled);
mainDisplayCustomToggle.classList.toggle('unchecked', !isDisplayEnabled);
});
const hudToggleWrapperMain = document.createElement('div');
hudToggleWrapperMain.style.display = 'flex';
hudToggleWrapperMain.style.justifyContent = 'space-between';
hudToggleWrapperMain.appendChild(mainDisplayLabel);
hudToggleWrapperMain.appendChild(mainDisplayCustomToggle);
// Time Toggle
const timeLabel = document.createElement('label');
timeLabel.innerText = 'Show Time';
const timeToggle = document.createElement('input');
timeToggle.type = 'checkbox';
timeToggle.checked = isTimeEnabled;
timeToggle.style.display = 'none';
const timeCustomToggle = document.createElement('div');
timeCustomToggle.classList.add('custom-toggle');
timeCustomToggle.classList.add(isTimeEnabled ? 'checked' : 'unchecked');
timeCustomToggle.addEventListener('click', () => {
isTimeEnabled = !isTimeEnabled;
timeCustomToggle.classList.toggle('checked', isTimeEnabled);
timeCustomToggle.classList.toggle('unchecked', !isTimeEnabled);
});
const hudToggleWrapperTime = document.createElement('div');
hudToggleWrapperTime.style.display = 'flex';
hudToggleWrapperTime.style.justifyContent = 'space-between';
hudToggleWrapperTime.appendChild(timeLabel);
hudToggleWrapperTime.appendChild(timeCustomToggle);
// Timer Toggle
const timerLabel = document.createElement('label');
timerLabel.innerText = 'Show Timer';
const timerToggle = document.createElement('input');
timerToggle.type = 'checkbox';
timerToggle.checked = isClassicMapTimerEnabled;
timerToggle.style.display = 'none';
const timerCustomToggle = document.createElement('div');
timerCustomToggle.classList.add('custom-toggle');
timerCustomToggle.classList.add(isClassicMapTimerEnabled ? 'checked' : 'unchecked');
timerCustomToggle.addEventListener('click', () => {
isClassicMapTimerEnabled = !isClassicMapTimerEnabled;
timerCustomToggle.classList.toggle('checked', isClassicMapTimerEnabled);
timerCustomToggle.classList.toggle('unchecked', !isClassicMapTimerEnabled);
});
const hudToggleWrapperTimer = document.createElement('div');
hudToggleWrapperTimer.style.display = 'flex';
hudToggleWrapperTimer.style.justifyContent = 'space-between';
hudToggleWrapperTimer.appendChild(timerLabel);
hudToggleWrapperTimer.appendChild(timerCustomToggle);
hudContent.appendChild(hudToggleWrapperMain);
hudContent.appendChild(hudToggleWrapperTime);
hudContent.appendChild(hudToggleWrapperTimer);
// Settings Tab Content
const settingsContent = document.createElement('div');
// Min Delay Input
const minDelayLabel = document.createElement('label');
minDelayLabel.innerText = 'Min Delay (ms): ';
const minDelayInput = document.createElement('input');
minDelayInput.type = 'number';
minDelayInput.value = minDelay;
minDelayInput.style.borderRadius = '5px';
minDelayInput.addEventListener('input', () => {
minDelay = parseInt(minDelayInput.value, 10);
});
const settingsWrapper1 = document.createElement('div');
settingsWrapper1.style.display = 'flex';
settingsWrapper1.style.justifyContent = 'space-between';
settingsWrapper1.appendChild(minDelayLabel);
settingsWrapper1.appendChild(minDelayInput);
// Max Delay Input
const maxDelayLabel = document.createElement('label');
maxDelayLabel.innerText = 'Max Delay (ms): ';
const maxDelayInput = document.createElement('input');
maxDelayInput.type = 'number';
maxDelayInput.value = maxDelay;
maxDelayInput.style.borderRadius = '5px';
maxDelayInput.addEventListener('input', () => {
maxDelay = parseInt(maxDelayInput.value, 10);
});
const settingsWrapper2 = document.createElement('div');
settingsWrapper2.style.display = 'flex';
settingsWrapper2.style.justifyContent = 'space-between';
settingsWrapper2.appendChild(maxDelayLabel);
settingsWrapper2.appendChild(maxDelayInput);
// Menu Hotkey Input
const hotkey1Label = document.createElement('label');
hotkey1Label.innerText = 'Menu Hotkey: ';
const hotkeyInput = document.createElement('input');
hotkeyInput.type = 'text';
hotkeyInput.value = menuHotkey;
hotkeyInput.style.borderRadius = '5px';
hotkeyInput.placeholder = "Press any key";
// List of allowed special keys
const specialKeys = [
'Insert', 'Delete', 'Home', 'End', 'PageUp', 'PageDown',
'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12',
'Escape', 'Tab', 'CapsLock', 'Shift', 'Control', 'Alt', 'Meta',
'Space', 'Enter', 'Backspace', 'ContextMenu'
];
// Handle keydown event to capture special keys
hotkeyInput.addEventListener('keydown', (e) => {
e.preventDefault(); // Prevent default behavior
// Check if it's a special key
const key = e.key.length === 1 ? e.key.toUpperCase() : e.key;
if (specialKeys.includes(e.key) ||
(key.length === 1 && /^[a-zA-Z]$/.test(key))) {
menuHotkey = key;
hotkeyInput.value = key;
}
});
// Prevent manual typing
hotkeyInput.addEventListener('keypress', (e) => {
e.preventDefault();
});
// Handle paste to prevent invalid input
hotkeyInput.addEventListener('paste', (e) => {
e.preventDefault();
});
const settingsWrapper3 = document.createElement('div');
settingsWrapper3.style.display = 'flex';
settingsWrapper3.style.justifyContent = 'space-between';
settingsWrapper3.appendChild(hotkey1Label);
settingsWrapper3.appendChild(hotkeyInput);
// Append all wrappers to content
settingsContent.appendChild(settingsWrapper1);
settingsContent.appendChild(settingsWrapper2);
settingsContent.appendChild(settingsWrapper3);
contentContainer.appendChild(locationContent);
contentContainer.appendChild(hudContent);
contentContainer.appendChild(settingsContent);
// Default: Location Tab active
locationContent.style.display = 'block';
hudContent.style.display = 'none';
settingsContent.style.display = 'none';
locationTabBtn.addEventListener('click', () => {
locationContent.style.display = 'block';
hudContent.style.display = 'none';
settingsContent.style.display = 'none';
});
hudTabBtn.addEventListener('click', () => {
locationContent.style.display = 'none';
hudContent.style.display = 'block';
settingsContent.style.display = 'none';
});
settingsTabBtn.addEventListener('click', () => {
locationContent.style.display = 'none';
hudContent.style.display = 'none';
settingsContent.style.display = 'block';
});
menu.appendChild(contentContainer);
document.body.appendChild(menu);
addVersionText();
}
function addVersionText() {
let textElement = document.createElement('div');
let discordButton = document.createElement('button');
let startTime = null;
// Create container for text and button
let container = document.createElement('div');
container.style.position = 'fixed';
container.style.bottom = '10px';
container.style.left = '50%';
container.style.transform = 'translateX(-50%)';
container.style.display = 'flex';
container.style.flexDirection = 'column';
container.style.alignItems = 'center';
container.style.gap = '10px';
container.style.zIndex = '1000';
// Style the Discord button
discordButton.innerText = 'Discord';
discordButton.style.backgroundColor = '#7289DA';
discordButton.style.color = 'white';
discordButton.style.border = 'none';
discordButton.style.padding = '15px 40px';
discordButton.style.borderRadius = '8px';
discordButton.style.cursor = 'pointer';
discordButton.style.fontSize = '20px';
discordButton.style.fontWeight = 'bold';
discordButton.style.boxShadow = '0 2px 4px rgba(0,0,0,0.2)';
discordButton.addEventListener('click', () => {
window.open('https://discord.gg/TaCumDu36N', '_blank');
});
const formatTime = (seconds) => {
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${minutes}:${secs.toString().padStart(2, '0')}`;
};
const isInGamePath = () => {
return window.location.pathname.includes("/game/");
};
const updateTime = () => {
if (!isDisplayEnabled) {
textElement.innerText = "";
return;
}
const currentTime = new Date().toLocaleTimeString();
let timerText = "";
if (startTime && isClassicMapTimerEnabled) {
const elapsedSeconds = Math.floor((Date.now() - startTime) / 1000);
timerText = `Time in Round: ${formatTime(elapsedSeconds)}`;
}
let timeText = isTimeEnabled ? currentTime : "";
let parts = [];
if (timeText) parts.push(timeText);
if (timerText) parts.push(timerText);
textElement.innerText = parts.join(" | ");
};
let lastPathname = window.location.pathname;
setInterval(() => {
if (window.location.pathname !== lastPathname) {
lastPathname = window.location.pathname;
if (isInGamePath()) {
startTime = Date.now();
isInGame = true;
} else if (window.location.pathname.includes("/results/") && isInGame) {
resetLocationDisplays();
isInGame = false;
}
}
}, 1000);
setInterval(updateTime, 1000);
updateTime();
textElement.style.color = 'white';
textElement.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
textElement.style.padding = '5px 10px';
textElement.style.borderRadius = '5px';
textElement.style.fontSize = '16px';
container.appendChild(textElement);
container.appendChild(discordButton);
document.body.appendChild(container);
}
function secureXHRIntercept() {
const xhrProxy = new Proxy(XMLHttpRequest.prototype.open, {
apply: function(target, thisArg, args) {
let [method, url] = args;
if (method.toUpperCase() === 'POST' &&
(url.includes('google.internal.maps.mapsjs.v1.MapsJsInternalService/GetMetadata') ||
url.includes('google.internal.maps.mapsjs.v1.MapsJsInternalService/SingleImageSearch'))) {
thisArg.addEventListener('load', function() {
try {
let match = this.responseText.match(/-?\\d+\\.\\d+,-?\\d+\\.\\d+/g);
if (match) {
let [lat, lng] = match[0].split(',').map(Number);
globalCoordinates = { lat, lng };
}
} catch (e) {
console.error('Error extracting coordinates:', e);
}
});
}
return target.apply(thisArg, args);
}
});
Object.defineProperty(XMLHttpRequest.prototype, 'open', {
configurable: true,
enumerable: false,
writable: true,
value: xhrProxy
});
}
const style = document.createElement('style');
style.innerHTML = `
.custom-toggle {
width: 50px;
height: 25px;
background-color: #ccc;
border-radius: 25px;
position: relative;
cursor: pointer;
}
.custom-toggle.checked {
background-color: #4caf50;
}
.custom-toggle.unchecked {
background-color: #ccc;
}
.custom-toggle::before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 21px;
height: 21px;
background-color: white;
border-radius: 50%;
transition: all 0.3s;
}
.custom-toggle.checked::before {
left: 27px;
}
#geohelper-location-container div {
font-family: Arial, sans-serif;
font-weight: bold;
}
`;
document.head.appendChild(style);
// Initialize the location displays
createLocationDisplays();
// Set up path monitoring to detect when a guess is made
let lastPathname = window.location.pathname;
setInterval(() => {
if (window.location.pathname !== lastPathname) {
lastPathname = window.location.pathname;
checkGameState();
}
}, 1000);
document.addEventListener('keydown', handleKeyPress);
secureXHRIntercept();
})();