GeoGuessr Ultimate Script

GeoGuessr Ultimate Script - One Script to rule them all - Work In Progress - Adding features over time - Removes Bottom, Right and Top Bar (Options) - Pimps Data - Makes for a cleaner experience - Removes Author (Optional - For an extra challenge) - Changes flags with numbered flags - Adjust GeoGuessr Logo position - Adjusts Data position

  1. // ==UserScript==
  2. // @name GeoGuessr Ultimate Script
  3. // @version 0.4.5
  4. // @description GeoGuessr Ultimate Script - One Script to rule them all - Work In Progress - Adding features over time - Removes Bottom, Right and Top Bar (Options) - Pimps Data - Makes for a cleaner experience - Removes Author (Optional - For an extra challenge) - Changes flags with numbered flags - Adjust GeoGuessr Logo position - Adjusts Data position
  5. // @author MrAmericanMike
  6. // @include /^(https?)?(\:)?(\/\/)?([^\/]*\.)?geoguessr\.com($|\/.*)/
  7. // @grant none
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/en/scripts/406060-geoguessr-ultimate-script
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. "use strict";
  14. console.log("GeoGuessrUltimateScript");
  15.  
  16. // MODULES // Set from 'true' to 'false' any module that you don't need. Example: removeTopBar = false;
  17.  
  18. // REMOVE BOTTOM WHITE BAR WHILE PLAYING A MAP
  19. let removeBottomBar = true;
  20.  
  21. // REMOVE RIGHT WHITE BAR ON ROUND RESULTS SCREEN
  22. let removeRightBar = true;
  23.  
  24. // MAKE A CLEANER STREETVIEW BY REMOVING TOP BAR
  25. let removeTopBar = true;
  26.  
  27. // MAKE FLAGS AND PINS TRANSPARENT ON MOUSE OVER
  28. let transparentPins = true;
  29.  
  30. // PIMP MY DATA
  31. let pimpData = true;
  32.  
  33. let floatData = "RIGHT"; // Where to place the logo on screen (Valid options "LEFT" "RIGHT")
  34.  
  35. let dataMargin = "0.5rem"; // Horizontal margin from the side of the window [default value is "2.0rem"] (https://www.w3schools.com/cssref/css_units.asp)
  36. let topMargin = "0.5rem"; // Vertical margin from top of the window [default value is "1.0rem"] (https://www.w3schools.com/cssref/css_units.asp)
  37.  
  38. let bgColor = "rgba(255, 255, 255, 0.55)"; // RGBA COLOR (https://www.hexcolortool.com/)
  39. let titlesColor = "#000033"; // Titles color on the data panel in HEX
  40. let dataColor = "#660000"; // Data color on the data panel in HEX
  41.  
  42. // GEOGUESSR LOGO
  43. let adjustLogo = true;
  44.  
  45. let floatLogo = "LEFT"; // Where to place the logo on screen (Valid options "LEFT" "CENTER" "RIGHT")
  46. let logoTopMargin = "0.25rem"; // Margin from top of the window (https://www.w3schools.com/cssref/css_units.asp)
  47. let logoOpacity = "0.5"; // Value going from 0.0 to 1.0 (0.0 represents fully transparent)
  48.  
  49. // HIDE FOOTPRINT - (This is where photospheres author would show)
  50. let hideFootprint = true;
  51.  
  52. // HIDE COMPASS - (For an extra challenge)
  53. let hideCompass = true;
  54.  
  55. // HIDE FLAG - (Hide the "Back to start flag" - For an extra challenge)
  56. let hideFlag = false;
  57.  
  58. // HIDE FULLSCREEN - (For those that don't need this button)
  59. let hideFullscreen = true;
  60.  
  61. // HIDE ZOOM - (Hide the zoom controls)
  62. let hideZoom = true;
  63.  
  64. // HIDE TOOLTIPS - (Hide the tooltips for flag, fullscreen and zoom controls)
  65. // Hiding an element does not hide the tooltip, so recommended leave this true
  66. let hideTooltips = true;
  67.  
  68. // *******************************
  69. // NO NEED TO EDIT BELOW THIS LINE
  70. // *******************************
  71.  
  72. window.addEventListener("load", () => {
  73. executeRealTime();
  74. });
  75.  
  76. function executeRealTime() {
  77. if (removeBottomBar) {
  78. doRemoveBottomBar();
  79. }
  80. if (removeRightBar) {
  81. doRemoveRightBar();
  82. }
  83. if (removeTopBar) {
  84. doRemoveTopBar();
  85. }
  86. if (adjustLogo) {
  87. doAdjustLogo();
  88. }
  89.  
  90. if (pimpData) {
  91. doPimpData();
  92. }
  93. if (hideFootprint) {
  94. doHideFootprint();
  95. }
  96. if (hideCompass) {
  97. doHideCompass();
  98. }
  99. if (hideFlag) {
  100. doHideFlag();
  101. }
  102. if (hideFullscreen) {
  103. doHideFullscreen();
  104. }
  105. if (hideZoom) {
  106. doHideZoom();
  107. }
  108. if (hideTooltips) {
  109. doHideTooltips();
  110. }
  111.  
  112. if (transparentPins) {
  113. addGlobalStyle(`
  114. .map-pin:hover{
  115. opacity: 0.25;
  116. }
  117. `);
  118. }
  119. }
  120.  
  121. // BOTTOM BAR
  122. function doRemoveBottomBar() {
  123. addGlobalStyle(`
  124. [class^="ad_inGameAd"]{
  125. display: none;
  126. }
  127. `);
  128. }
  129.  
  130. // RIGHT BAR
  131. function doRemoveRightBar() {
  132. addGlobalStyle(`
  133. [class^="ad_resultsAd"]{
  134. display: none;
  135. }
  136. `);
  137. }
  138.  
  139. // TOP BAR
  140. function doRemoveTopBar() {
  141. if (window.location.pathname.includes("game") || window.location.pathname.includes("challenge")) {
  142. addGlobalStyle(`
  143. .layout {
  144. --layout-header-height: 0rem;
  145. }
  146. .header__right{
  147. display: none;
  148. }
  149. .game-layout__panorama-canvas{
  150. height: 100%;
  151. }
  152. `);
  153. } else {
  154. addGlobalStyle(`
  155. .layout {
  156. --layout-header-height: 3rem;
  157. }
  158. .header__right{
  159. display: block;
  160. }
  161. `);
  162. }
  163. }
  164.  
  165. // DATA
  166. function doPimpData() {
  167. switch (floatData) {
  168. case "LEFT":
  169. addGlobalStyle(`
  170. .game-layout__status{
  171. top: ${topMargin};
  172. left: ${dataMargin};
  173. right: auto;
  174. }
  175. `);
  176. break;
  177.  
  178. case "RIGHT":
  179. addGlobalStyle(`
  180. .game-layout__status{
  181. top: ${topMargin};
  182. right: ${dataMargin};
  183. left: auto;
  184. }
  185. `);
  186. break;
  187.  
  188. default:
  189. break;
  190. }
  191.  
  192. addGlobalStyle(`
  193. .game-statuses {
  194. background: ${bgColor};
  195. }
  196. .game-status__heading{
  197. color: ${titlesColor};
  198. }
  199. .game-status__body{
  200. color: ${dataColor};
  201. }
  202. `);
  203. }
  204.  
  205. // FOOTPRINT
  206. function doHideFootprint() {
  207. addGlobalStyle(`
  208. .gmnoprint, .gm-style-cc{
  209. display: none;
  210. }
  211. `);
  212. }
  213.  
  214. // COMPASS
  215. function doHideCompass() {
  216. addGlobalStyle(`
  217. .compass{
  218. display: none;
  219. }
  220. `);
  221. }
  222.  
  223. // FLAG
  224. function doHideFlag() {
  225. addGlobalStyle(`
  226. [data-qa="return-to-start"]{
  227. display: none;
  228. }
  229. `);
  230. }
  231.  
  232. // FULLSCREEN
  233. function doHideFullscreen() {
  234. addGlobalStyle(`
  235. [data-qa="enter-fullscreen"]{
  236. display: none;
  237. }
  238. `);
  239. }
  240.  
  241. // ZOOM
  242. function doHideZoom() {
  243. addGlobalStyle(`
  244. [data-qa="pano-zoom-in"]{
  245. display: none;
  246. }
  247. [data-qa="pano-zoom-out"]{
  248. display: none;
  249. }
  250. `);
  251. }
  252.  
  253. // HIDE TOOLTIPS
  254. function doHideTooltips() {
  255. addGlobalStyle(`
  256. .tooltip__label{
  257. display: none;
  258. }
  259. `);
  260. }
  261.  
  262. // GEOGUESSR LOGO
  263. function doAdjustLogo() {
  264. if (window.location.pathname.includes("game") || window.location.pathname.includes("challenge")) {
  265. switch (floatLogo) {
  266. case "LEFT":
  267. addGlobalStyle(`
  268. .header__left{
  269. margin-left: 0;
  270. }
  271. `);
  272. break;
  273.  
  274. case "CENTER":
  275. addGlobalStyle(`
  276. .header__left{
  277. margin-left: auto;
  278. }
  279. `);
  280. break;
  281.  
  282. case "RIGHT":
  283. addGlobalStyle(`
  284. .header__left{
  285. margin-left: auto;
  286. margin-right: 0;
  287. }
  288. `);
  289. break;
  290. }
  291.  
  292. addGlobalStyle(`
  293. .header__logo{
  294. margin-top: ${logoTopMargin};
  295. opacity: ${logoOpacity};
  296. }
  297. `);
  298. } else {
  299. addGlobalStyle(`
  300. .header__left{
  301. margin-left: 0;
  302. }
  303. .header__logo{
  304. margin-top: auto;
  305. opacity: 1;
  306. }
  307. `);
  308. }
  309. }
  310.  
  311. // GLOBAL STYLES INJECTOR
  312. function addGlobalStyle(css) {
  313. let head;
  314. let style;
  315. head = document.getElementsByTagName("head")[0];
  316. if (!head) {
  317. return;
  318. }
  319. style = document.createElement("style");
  320. style.type = "text/css";
  321. style.innerHTML = css.replace(/;/g, " !important;");
  322. head.appendChild(style);
  323. }
  324.  
  325. // LISTEN FOR PAGE CHANGES
  326. let currentTab = "";
  327. let oldTab = "";
  328.  
  329. window.addEventListener("click", (event) => {
  330. for (let x = 0; x < 1250; x += 250) {
  331. setTimeout(() => {
  332. lookForURLChange(event);
  333. }, x);
  334. }
  335. });
  336.  
  337. function lookForURLChange(event) {
  338. if (event.explicitOriginalTarget) {
  339. currentTab = event.explicitOriginalTarget.baseURI;
  340. } else if (event.path) {
  341. event.path.forEach((element) => {
  342. if (element.hasOwnProperty("URL") && element.hasOwnProperty("location")) {
  343. currentTab = element.location.pathname;
  344. }
  345. });
  346. }
  347.  
  348. if (oldTab != currentTab) {
  349. oldTab = currentTab;
  350. setTimeout(executeRealTime, 0);
  351. }
  352. }
  353. })();