Add copy latlng and geoURI buttons, always fetch the latest data from maps passiveassist

This commit is contained in:
Crawlerop 2021-12-24 19:17:48 +07:00 committed by GitHub
parent 4d7c839785
commit bbfae9edcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -142,6 +142,7 @@
p += `<a href="https://www.google.com/maps/place/`+lat+`,`+lng+`/@`+lat+`,`+lng+`,15z/?hl=en&gl=US">Google Maps</a> `
p += `<a href="https://www.google.com/maps/@`+lat+`,`+lng+`,15z/?hl=en&gl=US">Google Maps (NoPin)</a> `
p += `<a href="https://geohack.toolforge.org/geohack.php?language=en&params=`+lat+`;`+lng+`_type:gh_region:gh_scale:40000&pagename=`+resp.placeName+`">GeoHack</a>`
p += ` <button onclick="navigator.clipboard.writeText('${lat}, ${lng}')">Copy Coords</button> <button onclick="navigator.clipboard.writeText('geo:${lat},${lng}')">Copy geoURI</button>`
p += "<br><b>The data will update every 5 seconds.</b>"
res.innerHTML = p
if (!stopped) {

View file

@ -37,7 +37,7 @@ function getAssistStr(loc, dist, patype=3, cors=false) {
function getAssistAsync(lat, lng, dist, patype=3, cors=false, callback) {
var xhr = new XMLHttpRequest()
lnk = "https://www.google.com/maps/preview/passiveassist?pb=!1m10!2m9!1m3!1d"+dist.toString()+"!2d"+lng+"!3d"+lat+"!2m0!3m2!1i1034!2i620!4f14!3m2!1sZBuUX_qxIsOA9QPH_b3QDA!7e81!7m"+patype+"!2b1!12b1!32b1!10m1!2i2&hl=en&gl=US&authuser=0"
lnk = "https://www.google.com/maps/preview/passiveassist?pb=!1m10!2m9!1m3!1d"+dist.toString()+"!2d"+lng+"!3d"+lat+"!2m0!3m2!1i1034!2i620!4f14!3m2!1sZBuUX_qxIsOA9QPH_b3QDA!7e81!7m"+patype+"!2b1!12b1!32b1!10m1!2i2!99s"+Math.floor(Math.random()*100000000)+"&hl=en&gl=US&authuser=0"
if (!cors) {
lnk = "https://api.allorigins.win/raw?url=" + encodeURIComponent(lnk)
}
@ -52,7 +52,7 @@ function getAssistAsync(lat, lng, dist, patype=3, cors=false, callback) {
function getAssist(lat, lng, dist, patype=3, cors=false) {
xhr = new XMLHttpRequest()
lnk = "https://www.google.com/maps/preview/passiveassist?pb=!1m10!2m9!1m3!1d"+dist.toString()+"!2d"+lng+"!3d"+lat+"!2m0!3m2!1i1034!2i620!4f14!3m2!1sZBuUX_qxIsOA9QPH_b3QDA!7e81!7m"+patype+"!2b1!12b1!32b1!10m1!2i2&hl=en&gl=US&authuser=0"
lnk = "https://www.google.com/maps/preview/passiveassist?pb=!1m10!2m9!1m3!1d"+dist.toString()+"!2d"+lng+"!3d"+lat+"!2m0!3m2!1i1034!2i620!4f14!3m2!1sZBuUX_qxIsOA9QPH_b3QDA!7e81!7m"+patype+"!2b1!12b1!32b1!10m1!2i2!99s"+Math.floor(Math.random()*100000000)+"&hl=en&gl=US&authuser=0"
if (!cors) {
lnk = "https://api.allorigins.win/raw?url=" + encodeURIComponent(lnk)
}