NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Yandex Helper to get location LAT / LNG on yandex.com/maps // @namespace kommu // @description Play geoguessr on yandex // @version 1.0.0 // @include https://yandex.com/maps* // @run-at document-end // @updateURL https://openuserjs.org/meta/kommu/Yandex_Helper_to_get_location_LAT_LNG_on_yandex.commaps.meta.js // @license MIT // ==/UserScript== /*jshint esversion: 6 */ (function() { console.log('test') let div = '<style>div#get_location_for_geoguessr {position: absolute;top: 10px;left: 430px;z-index: 10000;border-radius: 3px;background: white;padding: 10px;box-shadow: 1px 1px 9px 0 #00000017;}a#geoguessr_button {background: #4caf50;color: white;text-decoration: none;padding: 3px 10px;margin-right: 10px;border-radius: 5px;}</style><div id="get_location_for_geoguessr"><a href="#" id="geoguessr_button">Get Location</a><input id="geoguessr_input" value=""></div>' var style_div = document.createElement('div'); style_div.innerHTML = div; document.body.appendChild(style_div); let button = document.getElementById('geoguessr_button'); let input = document.getElementById('geoguessr_input'); button.addEventListener('click', function (e) { e.preventDefault(); let param = findGetParameter('panorama%5Bpoint%5D'); if (param != null) { var split = param.split(','); input.value = split[1] + ',' + split[0]; /* Select the text field */ input.select(); input.setSelectionRange(0, 99999); /* For mobile devices */ /* Copy the text inside the text field */ navigator.clipboard.writeText(input.value); } }); function findGetParameter(parameterName) { var result = null, tmp = []; location.search .substr(1) .split("&") .forEach(function (item) { tmp = item.split("="); if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); }); return result; } })();