diff --git a/amex-dining-credit/index.html b/amex-dining-credit/index.html
index e6fae1b..cc8db0a 100644
--- a/amex-dining-credit/index.html
+++ b/amex-dining-credit/index.html
@@ -6,6 +6,7 @@
AMEX Dining credit locations
@@ -14,10 +15,35 @@
AMEX Dining Credit restaurants
@@ -94,6 +120,7 @@ AMEX Dining Credit restaurants
merchantsJson.forEach(item => {
if (!item.assumedLocation) {
+ console.warn("Could not find a location for", item);
return;
}
new AdvancedMarkerElement({
@@ -104,17 +131,24 @@ AMEX Dining Credit restaurants
});
}
-document.getElementById("country-chooser").addEventListener("click", (event) => {
- const link = event.target;
- if (!link.matches("a")) return;
+document.getElementById("country-chooser").addEventListener("change", (event) => {
+ const select = event.target;
+ if (!select.matches("select")) return;
- const language = link.getAttribute("href").match(/(?<=#)[A-Z]{2}/).at(0);
- fillMarkers(language);
- map.panTo({lat: parseFloat(link.dataset.lat), lng: parseFloat(link.dataset.lng)});
+ fillMarkers(select.value);
+
+ const selectedOption = select.options[select.selectedIndex];
+ map.panTo({lat: parseFloat(selectedOption.dataset.lat), lng: parseFloat(selectedOption.dataset.lng)});
});
}();
+
+