GeoGuessr Return Old Duels UI

This script returns the old geoguessr duels UI but only in matches.

当前为 2025-04-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GeoGuessr Return Old Duels UI
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description This script returns the old geoguessr duels UI but only in matches.
  6. // @author AaronThug
  7. // @match https://www.geoguessr.com/*/multiplayer*
  8. // @match https://www.geoguessr.com/*
  9. // @run-at document-end
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function getLanguagePrefix() {
  18. const url = window.location.pathname;
  19. const urlParts = url.split('/').filter(part => part.length > 0);
  20.  
  21. if (urlParts[0] && urlParts[0].length <= 3 && urlParts[0] !== 'multiplayer') {
  22. return '/' + urlParts[0];
  23. }
  24.  
  25. return '';
  26. }
  27.  
  28. function handlePlayButtonClick(event) {
  29. if (!window.location.pathname.includes('/multiplayer')) {
  30. return;
  31. }
  32.  
  33. let target = event.target;
  34. let isPlayButton = false;
  35.  
  36. while (target && target !== document) {
  37. if (target.tagName === 'BUTTON') {
  38. const buttonText = target.textContent.trim();
  39. if (buttonText === 'Play' || buttonText === 'Spielen' ||
  40. buttonText === 'Jouer' || buttonText === 'Jugar' ||
  41. buttonText === 'Gioca' || buttonText === 'Spela') {
  42.  
  43. isPlayButton = true;
  44. break;
  45. }
  46. }
  47. target = target.parentElement;
  48. }
  49.  
  50. if (isPlayButton) {
  51. event.preventDefault();
  52. event.stopPropagation();
  53.  
  54. const langPrefix = getLanguagePrefix();
  55.  
  56. window.location.href = `https://www.geoguessr.com${langPrefix}/matchmaking`;
  57.  
  58. console.log(`GeoGuessr Redirect: detour to ${langPrefix}/matchmaking`);
  59. return false;
  60. }
  61. }
  62.  
  63. function setupEventListener() {
  64. document.addEventListener('click', handlePlayButtonClick, true);
  65. console.log('GeoGuessr detour: Click Listener installed');
  66. }
  67.  
  68. if (document.readyState === 'loading') {
  69. document.addEventListener('DOMContentLoaded', function() {
  70. setTimeout(setupEventListener, 500);
  71. });
  72. } else {
  73. setTimeout(setupEventListener, 500);
  74. }
  75.  
  76. console.log('GeoGuessr Multiplayer Redirect: Script loaded');
  77. })();