WorldGuessr Coordinate Finder

Adds a button to get latitude and longitude in WorldGuessr and copy it to clipboard, plus a minimap when coordinates are available

  1. // ==UserScript==
  2. // @name WorldGuessr Coordinate Finder
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.5
  5. // @description Adds a button to get latitude and longitude in WorldGuessr and copy it to clipboard, plus a minimap when coordinates are available
  6. // @author Projectornist
  7. // @license NO REDISTRIBUTION OR ELSE
  8. // @match https://www.worldguessr.com/*
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. GM_addStyle(`
  16. #getCoordsButton {
  17. position: fixed;
  18. top: 20px;
  19. right: 20px;
  20. padding: 10px 20px;
  21. background-color: black;
  22. color: white;
  23. border: none;
  24. border-radius: 5px;
  25. font-size: 16px;
  26. cursor: pointer;
  27. z-index: 9999;
  28. }
  29. #getCoordsButton:hover {
  30. background-color: #333;
  31. }
  32. #coordsDisplay {
  33. position: fixed;
  34. top: 70px;
  35. right: 20px;
  36. padding: 10px;
  37. background-color: rgba(0, 0, 0, 0.7);
  38. color: white;
  39. border-radius: 5px;
  40. font-size: 14px;
  41. display: none;
  42. z-index: 9999;
  43. }
  44. #googleMapContainer {
  45. position: fixed;
  46. bottom: 20px;
  47. left: 20px;
  48. width: 300px;
  49. height: 300px;
  50. background-color: rgba(0, 0, 0, 0.8);
  51. border-radius: 10px;
  52. overflow: hidden;
  53. display: none;
  54. z-index: 9999;
  55. }
  56. #googleMapContainer iframe {
  57. width: 100%;
  58. height: 100%;
  59. border: none;
  60. }
  61. #googleMapContainer .closeBtn {
  62. position: absolute;
  63. top: 10px;
  64. right: 10px;
  65. background-color: #333;
  66. color: white;
  67. padding: 5px;
  68. cursor: pointer;
  69. }
  70. `);
  71.  
  72. if (document.getElementById('getCoordsButton')) {
  73. return;
  74. }
  75.  
  76. const button = document.createElement('button');
  77. button.id = 'getCoordsButton';
  78. button.textContent = 'Get Coordinates';
  79. document.body.appendChild(button);
  80.  
  81. const coordsDisplay = document.createElement('div');
  82. coordsDisplay.id = 'coordsDisplay';
  83. document.body.appendChild(coordsDisplay);
  84.  
  85. const mapContainer = document.createElement('div');
  86. mapContainer.id = 'googleMapContainer';
  87. document.body.appendChild(mapContainer);
  88.  
  89. const closeBtn = document.createElement('button');
  90. closeBtn.textContent = 'X';
  91. closeBtn.className = 'closeBtn';
  92. mapContainer.appendChild(closeBtn);
  93.  
  94. function getCoordinates() {
  95. const urlParams = new URLSearchParams(window.location.search);
  96. const lat = urlParams.get('lat');
  97. const long = urlParams.get('long');
  98.  
  99. if (lat && long) {
  100. coordsDisplay.textContent = `Latitude: ${lat}, Longitude: ${long}`;
  101. coordsDisplay.style.display = 'block';
  102. showMinimap(lat, long);
  103. copyToClipboard(`${lat}, ${long}`);
  104. } else {
  105. coordsDisplay.textContent = 'Coordinates not found';
  106. coordsDisplay.style.display = 'block';
  107. }
  108. }
  109.  
  110. function copyToClipboard(text) {
  111. navigator.clipboard.writeText(text).then(() => {
  112. }).catch(err => {
  113. });
  114. }
  115.  
  116. function showMinimap(lat, long) {
  117. const iframe = document.createElement('iframe');
  118. iframe.src = `https://www.google.com/maps?q=${lat},${long}&z=18&output=embed`;
  119.  
  120. mapContainer.style.display = 'block';
  121.  
  122. mapContainer.appendChild(iframe);
  123.  
  124. closeBtn.onclick = () => {
  125. mapContainer.style.display = 'none';
  126. mapContainer.innerHTML = '';
  127. mapContainer.appendChild(closeBtn);
  128. };
  129. }
  130.  
  131. function checkCoordinatesAvailability() {
  132. const urlParams = new URLSearchParams(window.location.search);
  133. const lat = urlParams.get('lat');
  134. const long = urlParams.get('long');
  135.  
  136. if (lat && long) {
  137. button.style.display = 'inline-block';
  138. } else {
  139. button.style.display = 'none';
  140. }
  141. }
  142.  
  143. setInterval(checkCoordinatesAvailability, 1000);
  144.  
  145. button.addEventListener('click', function() {
  146. getCoordinates();
  147. });
  148.  
  149. })();

QingJ © 2025

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