diff --git a/lpadsjs/search.html b/lpadsjs/search.html
index 2774f64..3e77d1d 100644
--- a/lpadsjs/search.html
+++ b/lpadsjs/search.html
@@ -1,6 +1,7 @@
MapAds search
+
@@ -80,7 +81,9 @@
"Jewellery Quarter is full of Diamonds!",
"Somebody could have played Minecraft with Rocketts Landing mod (aka Advanced Rocketry) installed!",
"Large Cities (eg Tokyo) = So many ads!",
- "Our next library awaits!"
+ "Our next library awaits!",
+ //"Plus Codes! Try 5R4HCXQ3+J9R!"
+ "Plus Codes! Try 87G8P2J7+69R!"
]
const urls = {
@@ -105,20 +108,27 @@
document.getElementById("search3").onclick = function() {
if (document.getElementById("search2").value != "") {
- if (document.getElementById("search2").value.startsWith("geo:")) { // geo:35.335992,-79.038636
- lval = document.getElementById("search2").value
+ let seq = document.getElementById("search2").value;
+
+ if (document.getElementById("search2").value.indexOf("+") != -1) {
+ let res = OpenLocationCode.decode(document.getElementById("search2").value);
+ seq = `geo:${res.latitudeCenter},${res.longitudeCenter}`;
+ }
+
+ if (seq.startsWith("geo:")) { // geo:35.335992,-79.038636
+ lval = seq
lpos = lval.split(":")[1]
ll = lpos.split(",")
xhr.open("GET",urls[document.getElementById("search4").value].replace("(query)", ll[1]+","+ll[0]) + (document.getElementById("search5").checked ? "&fuzzyMatch=false" : ""))
} else {
- xhr.open("GET",urls[document.getElementById("search4").value].replace("(query)", document.getElementById("search2").value) + (document.getElementById("search5").checked ? "&fuzzyMatch=false" : ""))
+ xhr.open("GET",urls[document.getElementById("search4").value].replace("(query)", seq) + (document.getElementById("search5").checked ? "&fuzzyMatch=false" : ""))
}
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status <= 399) {
o = ""
rs = JSON.parse(this.responseText)
rs.features.forEach(function(feature){
- o += ``+feature.place_name+` - `+feature.center[1]+`, `+feature.center[0]+` - CORS - -
`
+ o += ``+feature.place_name+` (`+OpenLocationCode.encode(feature.center[1], feature.center[0], OpenLocationCode.CODE_PRECISION_EXTRA)+`) `+` - `+feature.center[1]+`, `+feature.center[0]+` - CORS - -
`
})
res.innerHTML = o
//console.log(res.innerHTML)