您需要先安装一个扩展,例如 篡改猴、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.1
- // @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';
- 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;
- 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;
- }
- `);
- if (document.getElementById('getCoordsButton')) {
- return;
- }
- const button = document.createElement('button');
- button.id = 'getCoordsButton';
- button.textContent = 'Get Coordinates';
- document.body.appendChild(button);
- const coordsDisplay = document.createElement('div');
- coordsDisplay.id = 'coordsDisplay';
- document.body.appendChild(coordsDisplay);
- const mapContainer = document.createElement('div');
- mapContainer.id = 'googleMapContainer';
- document.body.appendChild(mapContainer);
- const closeBtn = document.createElement('button');
- closeBtn.textContent = 'X';
- closeBtn.className = 'closeBtn';
- mapContainer.appendChild(closeBtn);
- function getCoordinates() {
- const urlParams = new URLSearchParams(window.location.search);
- const lat = urlParams.get('lat');
- const long = urlParams.get('long');
- if (lat && long) {
- coordsDisplay.textContent = `Latitude: ${lat}, Longitude: ${long}`;
- coordsDisplay.style.display = 'block';
- showMinimap(lat, long);
- } else {
- coordsDisplay.textContent = 'Coordinates not found';
- coordsDisplay.style.display = 'block';
- }
- }
- function showMinimap(lat, long) {
- const iframe = document.createElement('iframe');
- iframe.src = `https://www.google.com/maps?q=${lat},${long}&z=18&output=embed`;
- mapContainer.style.display = 'block';
- mapContainer.appendChild(iframe);
- closeBtn.onclick = () => {
- mapContainer.style.display = 'none';
- mapContainer.innerHTML = '';
- mapContainer.appendChild(closeBtn);
- };
- }
- 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';
- } else {
- button.style.display = 'none';
- }
- }
- setInterval(checkCoordinatesAvailability, 1000);
- button.addEventListener('click', function() {
- getCoordinates();
- });
- document.addEventListener('keydown', function(event) {
- if (event.key === 'o' || event.key === 'O') {
- button.style.display = button.style.display === 'none' ? 'inline-block' : 'none';
- }
- });
- })();