Main Menu Button on Duels

Adds the Main Menu button back to the Duels Summary Screen

  1. // ==UserScript==
  2. // @name Main Menu Button on Duels
  3. // @version 1.0.0
  4. // @description Adds the Main Menu button back to the Duels Summary Screen
  5. // @match https://www.geoguessr.com/*
  6. // @author Tyow#3742
  7. // @grant none
  8. // @license MIT
  9. // @namespace https://gf.qytechs.cn/en/users/1011193-tyow
  10. // ==/UserScript==
  11.  
  12. function checkURL() {
  13. return location.pathname.startsWith("/duels") && location.pathname.endsWith("/summary")
  14. };
  15.  
  16. let menuButton = document.createElement('a');
  17. menuButton.classList.add("button_button__CnARx");
  18. menuButton.classList.add("button_variantSecondary__lSxsR");
  19. menuButton.href = "https://www.geoguessr.com/competitive";
  20. menuButton.style.marginLeft = "15px";
  21.  
  22. let buttonWrapper = document.createElement('div');
  23. buttonWrapper.classList.add("button_wrapper__NkcHZ");
  24.  
  25. let text = document.createElement('span');
  26. text.classList.add("button_label__kpJrA");
  27. text.innerHTML = "Main Menu";
  28.  
  29. buttonWrapper.appendChild(text);
  30. menuButton.appendChild(buttonWrapper);
  31.  
  32.  
  33. function doCheck() {
  34. let play = document.querySelector('button[class*="button_button__CnARx button_variantPrimary__xc8Hp"]');
  35. if (play) {
  36. play.parentElement.appendChild(menuButton);
  37. }
  38. };
  39.  
  40. let lastDoCheckCall = 0;
  41. new MutationObserver(async (mutations) => {
  42. if (!checkURL() || lastDoCheckCall >= (Date.now() - 50)) return;
  43. lastDoCheckCall = Date.now();
  44. doCheck();
  45. }).observe(document.body, { subtree: true, childList: true });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址