Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tweaks for GeoGuessr
// ==UserScript==
// @name GeoGuessr Tweaks
// @description Changes correct location markers (The black circles with flags) to have numbers
// @author u/Artyer
// @namespace https://reddit.com/u/Artyer
// @version 1.0
// @include /^(https?)?(\:)?(\/\/)?([^\/]*\.)?geoguessr\.com($|\/.*)/
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Removes styling that makes window smaller
document.documentElement.className = document.documentElement.className.replace(/(^|\s)no-pro(?=$|\s)/, '$1');
// Data uris encoding the new flag icons
var dataUris = [
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABQVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8+Pj5AQEC2tra4uLhPT0/JycmlpaXt7e2Hh4efn5/e3t5xcXFZWVnAwMD6+vr5+fn39/e/v7/09PT7+/ujo6PDw8PPz89iYmL9/f1KSkpsbGyXl5dgYGBWVlatra3v7++3t7d1dXWNjY1JSUnl5eVOTk7r6+uUlJTf3992dnbm5uZDQ0NwcHCnp6dLS0vLy8vNzc1ra2uurq6FhYV7e3t/f3/U1NSIiIhBQUGTk5OWlpZMTExQUFBGRkZXV1f8/PzExMTV1dVvb2+mpqZ0dHRlZWV4eHh9fX3b29vo6OihoaGBgYHp/zPWAAAAHnRSTlMA9BiY3xSMAT9uH10Gr9XoLc9/ZPeeCrvc8QSHwYiiLgDJAAACyklEQVR4XqWX5ZLiShhAk4VhgBl0YWBkTyeoy7jbqrvLdb/v/wBLUcBXQwyS8z+n0t2fak7EV+4kkikd9FQysbkS1xZhORoqMkMxFF2eU7CUDWNLOLukeXMrojOm26wMTHNQaXYZo0dueQg2YuuMqJXqbUONMdr1Uo0R67ENN0E6A0Cv1DLUDEar1AMgk3YW3M4B9KtlZUu52gfI3XYQrOYBMOVzq8IEIL9qJ1grANw7Vq4cPwEorNl8vwXQuas8uNsB2LIYVgsADTUHDYDC7CnywOG1movrQyA/c/8A8r2XAeDGW6Rz8v/zniKXFsFGBujcjJvXDxsnj184GTpARmIyBtwb3//3o6Hg6ecHAOzsPXN4iydAbJo/68Dk/fdQ6vQRU379zT4egPVJZkUAU4lA7SPAyz9FcLo7MZhAZJz/OvTLzgKoXBkjQfn5zt40qvugL40EWaCq3ARw0fnvZPfVzzAVqCqQHdWvMPTK7gJBBOUehJeHgihQUosLVAmIDgUhoOVH0AJCQ0ERaoYfgVGDoqbF5QTzC+QMcW0FqPsT1IEVbRNo+xO0gU0tAV3Dn8DoQkJLQlP5E6gmJLUUVPwKKpDSdBj4FQxA1wDTRlB78/bd+90P7gITsBdcfPw0vujznofA9ghfvorw2/kOAh3LEWwucYafLg+Z8Mt9yyXaPKOFs98fALD/h1KWZ7QJpAkHB+Jo//X31X0lSCBZQ3n6PfvKCQll22QacfSPi0CSyS6dRxz8i4tA0tmuoAw5amyz7SyQgmJb0oY02K43nAVS0qSozgguz5S7QIqqtayPcRFIWZfGspBAGou0toUE0tqkuS4mkOYq7X0xgbR3GTAWEMiAYR1x/m94CWTEcR+yROA9ZMmY5y2QMc9r0BSB96Apo66nQEbdoMN28HE/+MIRfOUJvnQFX/uCL57BV9/gy7fL+r851/r/AxR/nedwmlTWAAAAAElFTkSuQmCC',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABRFBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8+Pj62trbAwMBKSkrJycnt7e1ubm7Pz89AQED09PRPT0+4uLifn59ZWVm3t7f5+fn6+vqHh4dxcXHo6Oi/v7/e3t6lpaXb29vDw8P9/f1iYmJJSUl7e3ujo6NWVlb7+/v39/fr6+tgYGDl5eVsbGzv7+/m5uaNjY11dXWtra2UlJSTk5N/f3/Nzc2IiIiXl5dOTk7U1NRXV1dwcHDExMTf39/V1dWmpqZ0dHRvb29LS0tGRkZBQUFDQ0OWlpZra2t2dnbLy8tlZWV4eHh9fX2np6dQUFChoaGFhYX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ely7va5/3xdP76ut9+Zbrf3Ku9f8T/hChanVbHEkAAAAASUVORK5CYII=',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABR1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8+Pj6fn59ubm62trb09PTt7e3AwMDPz89ZWVlAQEBPT0+4uLhKSkq3t7eHh4fJycn5+fmrq6vo6Ojb29uTk5P39/f6+vrDw8NWVlZxcXGlpaX9/f2jo6NiYmK/v7/e3t77+/uXl5dJSUl7e3vv7+91dXVsbGyNjY3m5uZgYGDl5eXr6+utra1MTEzU1NRXV1dwcHDExMTf39/V1dV2dnZvb2+mpqZ0dHSIiIhBQUFDQ0NOTk6UlJRGRkZra2v8/Pyurq6FhYVLS0t/f39lZWXLy8t4eHh9fX2Wlpanp6dQUFChoaHNzc2BgYGUoRTlAAAAHnRSTlMA9N8Y3AE/6PF/H12er9UtzwT3FAYKu25kmIyHwYiPwXdlAAADBklEQVR4XqWX1XYbSxBFRwaBEeLIkZ3sGjEzmDHMTJeZ///5RmvG6mVVW6NI+/0cqXoKnetYWLyzvBIJQSiysryzuOB8DfPhxBxDzCXC82PKb8RmsDITu+EEM7sdwqd7UjtOpY5rJ118QtuzAfL1rSgAZErVfEF8CvlqKQMA0a31UfrVNQDqpT1fbCjsleoArK1er7+1AdDZL4qV4n4HYOOWY2dzCYCUkWuLFABLmzb9zTjA4/sykvsPAeI3LfrbANlzCeA8C3BbOWzGAVwZAxcgPhzFEnDwQMbiwQGwNPT+AEYf5ABw5Vusbqj/HxjFxqrRr68B2at58/237tnbn+UassCayckt4LH//t+VReRz+wkAp72XYuX8IbA1qJ8ocPn9e4g8es2AN+/s+QBELytrG0iJMZAcBvjtV6N7dCg+KWDbr/8QdIrawFC759VW8a/TnvgUOxDy+kMM2JdRBnA3+8/Z4b8/wMBA9oFYXz8/A/WiNrBjDIp1mOl3uTBQkq83kBIQ/mKQAPYmMdgDEl8M5iBTmMSgkIE5x1kwEYxvYGJYcBaB6mQGVWDR2QHykxnkgR1nGbqFyQwKXVh2VuBEJjOQE1hxIlCb1KAGEScEx5MaHEPIAVLagMyPP138cvh8tEEKsBvc/fjJf+in9QADawh/PjOGfz89xUBWhWB5xCFeVA7w4dU36hEtn1Gx+/4JALkPIuozWhLJI5ncFUP+9z/ueb8+lEi2VO7jpoFmUhQqlW3FJNKAZi4NF0qlislWznIEbZFyhaZSqXK2NRRp0OoLyqCCUA3F1tLkqO0JLQa6pemmOqBNOiCCsLWte+wmK7ZH1G1dDxaPhn3i68GiR5uH6zbStMqiUKNNDdcB5RY9Uajhqsa7IQm7EjDezYKhDPR31AuGXnH+c/vx55JiMilwxdFLVouKSYTgJUuveVWvwJJp3MA1z75oVqCZa0IueNHUq67pB2l3/FVXL9tHyaPAZXv6dX/6g2P6k2f6o2v6s2/6w3P603f649t+/u+Mdf7/D8b4oj2pMEAjAAAAAElFTkSuQmCC',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABR1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8+Pj5AQEC2trZxcXHAwMClpaVubm7e3t7Jycnt7e1ZWVm4uLhPT09KSkqfn5+Hh4f5+fn6+vr39/fPz8+/v7/Dw8OTk5NJSUn09PSjo6P7+/vb29uXl5dWVlbv7+9gYGCtra39/f1sbGyNjY3r6+vl5eV1dXW3t7fm5uZGRkZ2dnZOTk5lZWVLS0vLy8vNzc38/Pyurq5vb297e3t/f3/U1NSIiIhBQUGFhYWnp6dMTExQUFBXV1dwcHDExMTf39/V1dWmpqZ0dHR4eHh9fX1DQ0OWlpZiYmLo6OihoaGrq6uBgYGUlJRra2vDp5hVAAAAHnRSTlMA9F0Y3OjfAT/xfx+er9UtzwT3FAaMCrtuZJiHwYjHJtPcAAAC3UlEQVR4XqWXVXviTBhAQwsUKNKybaHQPZPgbnXXdXf/1OX/X3/kKTDd7Axhk3PD1Zww8pqhY3HudiIZCkAglEzk5xaN72EhkgviIJiLLMwouBULoyQcu2W4M78aYESvUt20rM1qpceIwOq8i2A5GwWAWqNTN8UIs95p1AAgml2eJkgtAdBtFEzhwCw0ugAspfSC9TRAv9QUSpqlPkB6XSNYiQNgNYWWpgVAfEUlWMsAXJ2LqZzfA8isKdZvABR3hAs7RYCNbwwrGYC2mIE2QMa5izhwdiFm4uIMiDvOH0CudzMAfHUXqbTu/+t3kU5JwfISUBQ3Mf/7t3344LHOUASW5JvMAlej87/fGgp+274EYH/rs+Yu7gHZSfxEgfH9byHEyQ9M+PGF+j0A0XFkrQKWuCEYIIEnj6TgZG9ssIDVUfwHoN/UC6B6xxQ2zff7W5PA6EPgOj/EgJKYJoDj4l+He0+fwUQgSkDMFiyEodt0CLRIQbMLYTvLRYCG+H6BaACRoSAHFLwICkBuKAhCzfQiMGsQNIxFuYPZBXIPi8Yc0PEm6ABzRh6oexPUgbyRgJ7pTWD2IGEkoSK8CUQFkkYIql4FVQgZAdj0KtiEgAFYCkHt+buXr/ZeTxdYgFpw/Obt6KBPuy4C5RZ+/yCFH0/3kVB0bkF1iA4+3T1jzJeHzkNUXqOTo58uARj8LITzGlUPSUX9l1/vyK/feEiqpzymdUBZqJFPWRVMY+6iFchgUoXziG30AhnOqoRyzR/oBTKhqFOaTetPDrQCmdLUSdVmwO6RViCTqjKt27TtxVqBTOvKwjKkDG2hFcjCoiltorXLQOgFsrRpiqs4YLelF8jiqivvf8N2eYj90xIu5V02GOqMVHZrMJwtzj9tN4FscVybLCi7N1n6Nk8K9G2evtGUAn2j6d7qQlnf6vputv23+/4HDv8jj/+hy//Y53/w9D/6+h++9eN/fqbx/38z0p6QUVfgMAAAAABJRU5ErkJggg==',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABR1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8+Pj6fn59AQEBPT0/t7e2Hh4fPz89ZWVnJycm2tra4uLhubm57e3v09PT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WG4pIjgeiYzQUvaWJVMmKjtHS9KYqHSjv2nZFFIymqrZ1qUAOoLkrJkZb1weL2FCt2/UqVV3BHyz6aJMH1dqmiGzWyImCP9r04epTAfMdjeGqj3cfKEvAeDcNhi6gGwzV4vxri4idu4jrQCfA4ugmq0bdM1PNIJOl27ztiwLLQiXQ5ulGswbNXBPq/Y1mgNW1q0Bze4DVDTTb5fJuoNke3u4Pv3AMv/IMv3QNv/YNv3gOv/oOv3zr6//Kjdb/r3guonw4RU/iAAAAAElFTkSuQmCC'
];
var changeFlags = function() {
// Selects all the flags
var flags = document.querySelectorAll('[src="/Static/img/pins/correct-location.png?fallback-color=orange"]');
// If there aren't 5 (so, the game hasn't finished, you're not in a game, they have not loaded or they've already
// been replaced) don't replace them as the order might be wrong
if (flags.length !== 5) {
return;
}
Array.prototype.forEach.call(flags, function(img, n) {
// Replace the src with the data uri (They are usually in the right order)
img.src = dataUris[n];
});
};
var tryThrice = function() {
// Try to change the flag every half a second three times (non-blocking)
setTimeout(changeFlags, 1000);
setTimeout(changeFlags, 500);
setTimeout(changeFlags, 0);
};
// On page full load (inc. images)
document.addEventListener("DOMContentLoaded", tryThrice, false);
// Allow 1 to 2 seconds for the page to load fully for browsers that do not support above
setTimeout(tryThrice, 1000);
// Icons reset every time you click on a player in the scoreboard, so redo it every time
document.addEventListener('mouseup', tryThrice);
document.addEventListener('mousedown', tryThrice);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment