diff --git a/index.html b/index.html
index 9afd0aa..6a35b40 100644
--- a/index.html
+++ b/index.html
@@ -196,20 +196,9 @@
words = words.trim().toLowerCase().replace(/\s+/g, ' ');
var coords = FixPhrase.decode(words);
- drawRectangle(
- coords[0] - (coords[2] / 2),
- coords[1] - (coords[2] / 2),
- coords[0] + (coords[2] / 2),
- coords[1] + (coords[2] / 2)
- );
-
location.hash = "#map";
- $('.mapboxgl-popup').remove();
- var popup = new mapboxgl.Popup()
- popup.on('close', clearRectangle);
- popup.setLngLat({lat: coords[0], lng: coords[1]});
- popup.setHTML("" + words + "
" + coords[0] + ", " + coords[1]);
- popup.addTo(map);
+ showLocationPopup(coords[0], coords[1], words, coords[2]);
+
var zoomlevel = 18;
switch (coords[2]) {
case 0.1:
@@ -223,41 +212,6 @@
} catch (e) {
alert(e);
}
-
- return;
-
- // Example of accessing the PHP API instead of using JS
- $.getJSON("lookup.php", {
- words: words
- }, function (resp) {
- if (resp.status == "OK") {
- location.hash = "#map";
- drawRectangle(
- resp.coords[0] - (resp.coords[2] / 2),
- resp.coords[1] - (resp.coords[2] / 2),
- resp.coords[0] + (resp.coords[2] / 2),
- resp.coords[1] + (resp.coords[2] / 2)
- );
- $('.mapboxgl-popup').remove();
- var popup = new mapboxgl.Popup()
- popup.on('close', clearRectangle);
- popup.setLngLat({lat: resp.coords[0], lng: resp.coords[1]});
- popup.setHTML("" + resp.words + "
" + resp.coords[0] + ", " + resp.coords[1]);
- popup.addTo(map);
- var zoomlevel = 18;
- switch (resp.coords[2]) {
- case 0.1:
- zoomlevel = 10;
- break;
- case 0.01:
- zoomlevel = 13;
- break;
- }
- map.animateMapIn(resp.coords[0], resp.coords[1], zoomlevel);
- } else {
- alert(resp.msg);
- }
- });
}