Skip to content

Instantly share code, notes, and snippets.

/scripts.js Secret

Created May 13, 2017 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0fb7bc09e17b493fbe618107873b920e to your computer and use it in GitHub Desktop.
Save anonymous/0fb7bc09e17b493fbe618107873b920e to your computer and use it in GitHub Desktop.
scripts.js - shared from CS50 IDE
/**
* 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