-
-
Save anonymous/0fb7bc09e17b493fbe618107873b920e to your computer and use it in GitHub Desktop.
scripts.js - shared from CS50 IDE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds marker for place to map. | |
*/ | |
function addMarker(place) | |
{ | |
var url = 'https://ide50-chriswolfdesign.cs50.io/articles?geo=' + place.postal_code; | |
var json_data = $.getJSON(url); | |
var content = $.parseJSON(json_data); | |
// Temporary info window for testing | |
var infoWindow = new google.maps.InfoWindow({ | |
content: content | |
}); | |
// Instantiate the marker | |
var marker = new google.maps.Marker({ | |
position: {lat: place.latitude, lng: place.longitude}, | |
map: map | |
}); | |
// Listen for clicks on the marker | |
marker.addListener('click', function() { | |
infoWindow.open(map, marker); | |
}); | |
// Get articles for place | |
// Build a list of links to articles | |
// Add marker to our markers list | |
// markers.append(marker); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment