diff --git a/lpadsjs/editormain.js b/lpadsjs/editormain.js index c29f5ae..67e2587 100644 --- a/lpadsjs/editormain.js +++ b/lpadsjs/editormain.js @@ -10,11 +10,16 @@ var dist = 1; up = new URLSearchParams(window.location.search) var here = false +var cors = false if (up.get("here") == "true") { here = true } +if (up.get("cors") == "true") { + cors = true +} + if (up.get("override") != null) { try { repdata = JSON.parse(window.atob(up.get("override"))).overrides @@ -154,7 +159,12 @@ function loadMarker(data) { finding = false function start2() { - xhr.open("GET", "https://api.allorigins.win/raw?url=" + encodeURIComponent(lpadURL.replace("(dist)", dist).replace("(long)", up.get("lng")).replace("(lat)", up.get("lat")))) + if (!cors) { + let rand = Math.floor(Math.random() * 1000000000000); + xhr.open("GET", "https://api.allorigins.win/raw?hash="+rand.toString()+"&url=" + encodeURIComponent(lpadURL.replace("(dist)", dist).replace("(long)", up.get("lng")).replace("(lat)", up.get("lat")))) + } else { + xhr.open("GET", lpadURL.replace("(dist)", dist).replace("(long)", up.get("lng")).replace("(lat)", up.get("lat"))) + } xhr.onreadystatechange = function() { if (this.readyState == 4) { out = xhr.responseText.replace(")]}'\n", "") diff --git a/lpadsjs/mapads_marker.html b/lpadsjs/mapads_marker.html index dd431bf..e1865eb 100644 --- a/lpadsjs/mapads_marker.html +++ b/lpadsjs/mapads_marker.html @@ -51,7 +51,8 @@ var overrides = null; function selLPUrl(uri) { - return cors ? uri : "https://api.allorigins.win/raw?url=" + encodeURIComponent(uri) + let rand = Math.floor(Math.random() * 1000000000000); + return cors ? uri : "https://api.allorigins.win/raw?hash="+rand.toString()+"&url=" + encodeURIComponent(uri) } try {