Created
May 31, 2021 15:20
-
-
Save jonasbits/834c52d8d9a399013f09f3929d95505e to your computer and use it in GitHub Desktop.
Helper to extract WGS84 DD coordinates from a webGui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//javascript:(function(){ <-remember this beginning when creating bookmarklets | |
javascript:(function(){ | |
var version = 3; /*2021-05-31 17:14 */ | |
var final = 0; | |
function extractWSG() { | |
if(document.scripts[14].src == "" && final == 0) { | |
document.scripts[14].text.match(/Number.*/g)[0].split("'")[1]; | |
document.scripts[14].text.match(/Number.*/g)[1].split("'")[1]; | |
/* capture vars */ | |
var lat = document.scripts[14].text.match(/Number.*/g)[0].split("'")[1]; | |
var lng = document.scripts[14].text.match(/Number.*/g)[1].split("'")[1]; | |
/* common */ | |
var zoomGPS = 15; | |
var digits = 9; /* 59.918813 17.158864 */ | |
console.log(lat + " " + lng); | |
console.log( lat.slice(0,9) + " " + lng.slice(0,9) ); | |
/* stock URLs osm */ | |
var osmURL = "https://www.openstreetmap.org/"; | |
console.log(osmURL + "?mlat=" + lat.slice(0,digits) + "&mlon=" + lng.slice(0,digits) + "#map=" + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits)); | |
/* stock URLs osm edit */ | |
var osmEditURL = "https://www.openstreetmap.org/edit#map="; | |
var digits = 7; /* 59.9188/17.1588 */ | |
console.log( osmEditURL + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits) ); | |
/* stock URLs apple maps */ | |
var appleURL = "https://maps.apple.com/"; | |
digits = 9; | |
console.log(appleURL + "?ll=" + lat.slice(0,digits) + "," + lng.slice(0,digits)); | |
/* stock URLs hitta.nu */ | |
var hittaURL = "https://www.hitta.se/kartan!~"; | |
digits = 9; | |
console.log(hittaURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "," + zoomGPS + "z"); | |
/* stock URLs eniro */ | |
var eniroURL = "https://kartor.eniro.se/?c="; | |
digits = 9; | |
console.log(eniroURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "&z=" + zoomGPS + "&g=" + lat.slice(0,digits) + "," + lng.slice(0,digits) ); | |
final = 1; /* maybe not needed */ | |
} else { | |
console.log("try again"); | |
/* recursive setTimeout */ | |
setTimeout(extractWSG, 2.0*1000); /* delay 2 sec between tries (about 10*2 secs needed) */ | |
} /*end if else*/ | |
} /*end function*/ | |
extractWSG(); /* init recursive setTimeout */ | |
})(); | |
// })(); <-remember this ending when creating bookmarklets | |
// compiled to one line only is needed | |
// copy paste into browser URL bar, select that and copy paste here | |
//javascript: <- browser will remove this to stop unwanted javascripts pasting, add this | |
(function(){var version = 3; /*2021-05-31 17:14 */var final = 0;function extractWSG() {if(document.scripts[14].src == "" && final == 0) {document.scripts[14].text.match(/Number.*/g)[0].split("'")[1];document.scripts[14].text.match(/Number.*/g)[1].split("'")[1];/* capture vars */var lat = document.scripts[14].text.match(/Number.*/g)[0].split("'")[1];var lng = document.scripts[14].text.match(/Number.*/g)[1].split("'")[1];/* common */var zoomGPS = 15;var digits = 9; /* 59.918813 17.158864 */console.log(lat + " " + lng);console.log( lat.slice(0,9) + " " + lng.slice(0,9) );/* stock URLs osm */var osmURL = "https://www.openstreetmap.org/";console.log(osmURL + "?mlat=" + lat.slice(0,digits) + "&mlon=" + lng.slice(0,digits) + "#map=" + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits));/* stock URLs osm edit */var osmEditURL = "https://www.openstreetmap.org/edit#map=";var digits = 7; /* 59.9188/17.1588 */console.log( osmEditURL + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits) );/* stock URLs apple maps */var appleURL = "https://maps.apple.com/";digits = 9;console.log(appleURL + "?ll=" + lat.slice(0,digits) + "," + lng.slice(0,digits));/* stock URLs hitta.nu */var hittaURL = "https://www.hitta.se/kartan!~";digits = 9;console.log(hittaURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "," + zoomGPS + "z");/* stock URLs eniro */var eniroURL = "https://kartor.eniro.se/?c=";digits = 9;console.log(eniroURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "&z=" + zoomGPS + "&g=" + lat.slice(0,digits) + "," + lng.slice(0,digits) );final = 1; /* maybe not needed */} else { console.log("try again"); setTimeout(extractWSG, 2.0*1000); /* delay 2 sec between tries (about 8*2 secs needed) */} /*end if else*/} /*end function*/extractWSG(); /* init recursive setTimeout */})(); | |
javascript:(function(){var version = 3; /*2021-05-31 17:14 */var final = 0;function extractWSG() {if(document.scripts[14].src == "" && final == 0) {document.scripts[14].text.match(/Number.*/g)[0].split("'")[1];document.scripts[14].text.match(/Number.*/g)[1].split("'")[1];/* capture vars */var lat = document.scripts[14].text.match(/Number.*/g)[0].split("'")[1];var lng = document.scripts[14].text.match(/Number.*/g)[1].split("'")[1];/* common */var zoomGPS = 15;var digits = 9; /* 59.918813 17.158864 */console.log(lat + " " + lng);console.log( lat.slice(0,9) + " " + lng.slice(0,9) );/* stock URLs osm */var osmURL = "https://www.openstreetmap.org/";console.log(osmURL + "?mlat=" + lat.slice(0,digits) + "&mlon=" + lng.slice(0,digits) + "#map=" + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits));/* stock URLs osm edit */var osmEditURL = "https://www.openstreetmap.org/edit#map=";var digits = 7; /* 59.9188/17.1588 */console.log( osmEditURL + zoomGPS + "/" + lat.slice(0,digits) + "/" + lng.slice(0,digits) );/* stock URLs apple maps */var appleURL = "https://maps.apple.com/";digits = 9;console.log(appleURL + "?ll=" + lat.slice(0,digits) + "," + lng.slice(0,digits));/* stock URLs hitta.nu */var hittaURL = "https://www.hitta.se/kartan!~";digits = 9;console.log(hittaURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "," + zoomGPS + "z");/* stock URLs eniro */var eniroURL = "https://kartor.eniro.se/?c=";digits = 9;console.log(eniroURL + lat.slice(0,digits) + "," + lng.slice(0,digits) + "&z=" + zoomGPS + "&g=" + lat.slice(0,digits) + "," + lng.slice(0,digits) );final = 1; /* maybe not needed */} else { console.log("try again"); setTimeout(extractWSG, 2.0*1000); /* delay 2 sec between tries (about 8*2 secs needed) */} /*end if else*/} /*end function*/extractWSG(); /* init recursive setTimeout */})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment