Geoguessr Faster Map

Open and close the map on mouseover in a more reactive way.

// ==UserScript==
// @name         Geoguessr Faster Map
// @namespace    geoguessr user scripts
// @version      1.1
// @description  Open and close the map on mouseover in a more reactive way.
// @author       Edit from HugoBarjot / Base work from echandler
// @match        https://www.geoguessr.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=geoguessr.com
// @grant        none
// @license      MIT
// ==/UserScript==



setInterval(() => {
  const url = location.href;
  if (url.startsWith("https://www.geoguessr.com/") && (url.includes("/game/") || url.includes("/battle-royale/") || url.includes("/duels/") || url.includes("/teams/") || url.includes("/maprunner/") || url.includes("party") || url.includes("challenge") || url.includes("quiz") )) {
      (function () {
  "use strict";

  let int = setInterval(() => {
    let sticky_element = document.querySelector('[data-qa="guess-map__control--sticky-active"]');
    let map = document.body.querySelectorAll(".guess-map_guessMap__wuNbK");

    clearInterval(int);
    map.forEach((canvas) => {
      canvas.addEventListener("mouseleave", function (e) {
        if (
           sticky_element.matches(".guess-map_controlStickyActive__BVNXQ") === true
        ) {
            //dont'remove class for active map on mouseleave event whent the sticky button is enabled
        } else {
          document.querySelector(".guess-map_guessMap__wuNbK").classList.remove("guess-map_active__EBEnQ");
        }
      });
    });
    map.forEach((canvas) => {
      canvas.addEventListener("mouseover", function (e) {
        document.querySelector(".guess-map_guessMap__wuNbK").classList.add("guess-map_active__EBEnQ");
      });
    });
  }, 1000);
})();
  }
}, 250);