您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to get latitude and longitude in WorldGuessr and copy it to clipboard, plus a minimap when coordinates are available
当前为
// ==UserScript== // @name WorldGuessr Coordinate Finder // @namespace http://tampermonkey.net/ // @version 1.0 // @description Adds a button to get latitude and longitude in WorldGuessr and copy it to clipboard, plus a minimap when coordinates are available // @author Projectornist // @license You can modify as long as you credit me // @match https://www.worldguessr.com/* // @grant GM_addStyle // ==/UserScript== (function() { 'use strict'; // Add custom CSS for the buttons, coordinates display, and minimap GM_addStyle(` #getCoordsButton { position: fixed; top: 20px; right: 20px; padding: 10px 20px; background-color: black; color: white; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; z-index: 9999; } #getCoordsButton:hover { background-color: #333; } #coordsDisplay { position: fixed; top: 70px; right: 20px; padding: 10px; background-color: rgba(0, 0, 0, 0.7); color: white; border-radius: 5px; font-size: 14px; display: none; z-index: 9999; } #googleMapContainer { position: fixed; bottom: 20px; left: 20px; /* Changed to 'left' to place it on the left side */ width: 300px; height: 300px; background-color: rgba(0, 0, 0, 0.8); border-radius: 10px; overflow: hidden; display: none; z-index: 9999; } #googleMapContainer iframe { width: 100%; height: 100%; border: none; } #googleMapContainer .closeBtn { position: absolute; top: 10px; right: 10px; background-color: #333; color: white; padding: 5px; cursor: pointer; } `); // Check if the button already exists to avoid duplication if (document.getElementById('getCoordsButton')) { return; // If the button exists, do not create another one } // Create the button for getting coordinates const button = document.createElement('button'); button.id = 'getCoordsButton'; button.textContent = 'Get Coordinates'; document.body.appendChild(button); // Create the display area for coordinates (Initially hidden) const coordsDisplay = document.createElement('div'); coordsDisplay.id = 'coordsDisplay'; document.body.appendChild(coordsDisplay); // Create the minimap container (Initially hidden) const mapContainer = document.createElement('div'); mapContainer.id = 'googleMapContainer'; document.body.appendChild(mapContainer); // Create a close button for the minimap const closeBtn = document.createElement('button'); closeBtn.textContent = 'X'; closeBtn.className = 'closeBtn'; mapContainer.appendChild(closeBtn); // Function to extract coordinates from the URL function getCoordinates() { const urlParams = new URLSearchParams(window.location.search); const lat = urlParams.get('lat'); const long = urlParams.get('long'); // Show the coordinates or an error message if (lat && long) { coordsDisplay.textContent = `Latitude: ${lat}, Longitude: ${long}`; coordsDisplay.style.display = 'block'; // Show the minimap with the coordinates showMinimap(lat, long); // Copy coordinates to clipboard copyToClipboard(`${lat}, ${long}`); } else { coordsDisplay.textContent = 'Coordinates not found'; coordsDisplay.style.display = 'block'; } } // Function to copy text to clipboard function copyToClipboard(text) { navigator.clipboard.writeText(text).then(() => { alert('Coordinates copied to clipboard!'); }).catch(err => { console.error('Error copying to clipboard: ', err); }); } // Function to show the minimap with Google Maps function showMinimap(lat, long) { const iframe = document.createElement('iframe'); iframe.src = `https://www.google.com/maps?q=${lat},${long}&z=18&output=embed`; // Show the minimap container mapContainer.style.display = 'block'; // Append the iframe to the map container mapContainer.appendChild(iframe); // Add the close button functionality closeBtn.onclick = () => { mapContainer.style.display = 'none'; // Hide the minimap container mapContainer.innerHTML = ''; // Remove the iframe mapContainer.appendChild(closeBtn); // Keep the close button after removing iframe }; } // Function to check if coordinates are available in the URL function checkCoordinatesAvailability() { const urlParams = new URLSearchParams(window.location.search); const lat = urlParams.get('lat'); const long = urlParams.get('long'); if (lat && long) { button.style.display = 'inline-block'; // Show the button if coordinates are found } else { button.style.display = 'none'; // Hide the button if coordinates are not found } } // Periodically check if coordinates are available and show/hide the button setInterval(checkCoordinatesAvailability, 1000); // Check every 1 second // Add event listener to the Get Coordinates button button.addEventListener('click', function() { getCoordinates(); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址