summaryrefslogtreecommitdiff
path: root/dashboard_website/static/js/dashboard.js
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard_website/static/js/dashboard.js')
-rw-r--r--dashboard_website/static/js/dashboard.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/dashboard_website/static/js/dashboard.js b/dashboard_website/static/js/dashboard.js
index fba7196..4ce6fac 100644
--- a/dashboard_website/static/js/dashboard.js
+++ b/dashboard_website/static/js/dashboard.js
@@ -123,13 +123,28 @@ function drawClues(){
for (var i = 0; i < clues.length; i++) {
var tempIcon = visitedIcon;
if (clues[i]['clue_status'] == "UNVISITED") tempIcon = unvisitedIcon;
- var clueMarker = L.marker([clues[i]['latitude'], clues[i]['longitude']], {icon: tempIcon}).bindPopup(clues[i]['clue_name'] + ": " + clues[i]['clue_info']);
+ var popupdiv = document.createElement('p');
+ popupdiv.innerHTML = "<span style='color:black'>" + clues[i]['clue_name'] + ": " + clues[i]['clue_info'] + "</span><button style='margin-left:2px' onclick=\"visitClue('"+clues[i]['clue_name']+"')\">Visit</button>"
+ var clueMarker = L.marker([clues[i]['latitude'], clues[i]['longitude']], {icon: tempIcon}).bindPopup(popupdiv);
clue_rels[clues[i]['clue_name']] = clueMarker;
if (clues[i]['clue_status'] == "UNVISITED") unvisited_clues_m.addLayer(clueMarker);
else visited_clues_m.addLayer(clueMarker);
}
}
+function visitClue(clue_name){
+ console.log("visiting: "+clue_name);
+ fetch(host+'/visitClueGeneric', {
+ method: "POST",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({ "clue_name" : clue_name })})
+ .then((response) => response.json())
+ .then((json) => console.log(json));
+}
+
function addClue(){
var long = parseFloat(document.getElementById("new_clue_longitude").value);
var lat = parseFloat(document.getElementById("new_clue_latitude").value);
@@ -252,4 +267,5 @@ window.onload = function() {
layerControl.addOverlay(bikes_m, "Bikes");
layerControl.addTo(map);
requestLatestInfo();
-} \ No newline at end of file
+}
+