${helpText}
`; function makeCustomTextInput(elt, id, settingName, text, icon, helpText) { elt.parentElement.outerHTML = optionTextInputInnerHTML(id, settingName, text, icon, helpText); return elt; } function updateValue(inputId, option, gameOptions) { if (document.querySelector(inputId)) { if (gameMode() == cachedGameMode && option in cachedGameOptions) { document.querySelector(inputId).value = cachedGameOptions[option]; } else { if (option == 'multiplierIncrement') { document.querySelector(inputId).value = gameOptions[option] / 10; } else { document.querySelector(inputId).value = gameOptions[option]; } } } } let observer = new MutationObserver(async (mutations) => { if (document.querySelector('.advanced-option-setting')) return; await scanStyles(); if (window.location.href.includes('party') && (document.getElementsByClassName(cn('slider-option_slider__')) || document.getElementsByClassName(cn('numeric-option_button__')))) { if (gameMode().includes('duels')) { let healthEl = document.evaluate('//div[text()="Initial health"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; let multiplierEl = document.evaluate('//div[text()="Multiplier increase"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; let timeAfterGuessEl = document.evaluate('//div[text()="Timer after guess"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; let maxRoundTimeEl = document.evaluate('//div[text()="Max round time"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (healthEl) { makeCustomTextInput(healthEl, 'health-input', 'initialHealth', 'Initial health', '/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fheart.3a3fd066.png&w=96&q=75', ''); } if (multiplierEl) { makeCustomTextInput(multiplierEl, 'increment-input', 'multiplierIncrement', 'Multiplier increase', '/_next/static/media/multipliers-icon.63803925.svg', '(must be between 0.1 and 10)'); } if (timeAfterGuessEl) { makeCustomTextInput(timeAfterGuessEl, 'time-after-guess-input', 'timeAfterGuess', 'Timer after guess', '/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftime-limit.8a68c82e.png&w=96&q=75', '(must be between 10 and 300 seconds)'); } if (maxRoundTimeEl) { makeCustomTextInput(maxRoundTimeEl, 'max-round-time-input', 'maxRoundTime', 'Max round time', '/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftime-limit.8a68c82e.png&w=96&q=75', '(0 for no time limit)'); } } else if (gameMode() == 'city streaks') { let gameTimeEl = document.evaluate('//div[text()="Game time"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (gameTimeEl) { makeCustomTextInput(gameTimeEl, 'time-input', 'duration', 'Game time', '/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftime-limit.8a68c82e.png&w=96&q=75', '(must be between 60 and 900 seconds)'); } } else { let roundTimeEl = document.evaluate('//div[text()="Round time"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (roundTimeEl) { let settingName = 'roundTime'; let helpText = '(must be between 10 and 600 seconds)'; if (gameMode() == 'bullseye') { settingName = 'bullseyeRoundTime'; helpText = '(must be less than 600 seconds, 0 for no time limit)'; } makeCustomTextInput(roundTimeEl, 'time-input', settingName, 'Round time', '/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftime-limit.8a68c82e.png&w=96&q=75', helpText); } } fetchWithCors(`https://www.geoguessr.com/_next/data/${getGameId()}/en/party.json`, "GET") .then((response) => response.json()) .then((data) => { let gameOptions = data.pageProps.party.gameSettings; if (gameMode() == 'city streaks') { updateValue('#time-input', 'duration', gameOptions); } else if (gameMode().includes('duels')) { updateValue('#health-input', 'initialHealth', gameOptions); updateValue('#increment-input', 'multiplierIncrement', gameOptions); updateValue('#time-after-guess-input', 'timeAfterGuess', gameOptions); updateValue('#max-round-time-input', 'maxRoundTime', gameOptions); } else if (gameMode() == 'bullseye') { updateValue('#time-input', 'bullseyeRoundTime', gameOptions); } else { updateValue('#time-input', 'roundTime', gameOptions); } }); } }); observer.observe(document.body, { characterDataOldValue: false, subtree: true, childList: true, characterData: false }); document.addEventListener('keydown', (event) => { if (event.key == 'Escape' && document.getElementsByClassName(cn('party-modal_heading__'))) { document.activeElement.blur(); } });