ZAMYLA CHAN: Now let's move from the Python back end to the JavaScript front
end.
In scripts.js Jay yes there's just a small to-do for us in configure.
Within the suggestion you'll see that we concatenate
HTML to put within the search bar, as users
search they'll see suggestions pop up.
So up to us to modify suggestions so that it displays matches to whatever
place the user might be searching up.
So once we've done that, let's move on to addMarker.
Within addMarker, we'll want to instantiate
a marker for every place in the US map, or whichever country you've chosen.
We want to listen for clicks on those markers within the map,
and then once clicks are received, get articles for that particular place,
building a list of links to those articles.
And we want to be able to remember these markers so that later on we
can remove them.
Within all of these many to-dos for addMarker, I'll give you some hints
or rather point you towards functions that you might want to look into.
But again, the crux of this problem isn't writing a lot of code,
but rather understanding how to look up, within an API for instance,
the function that you'll need in order to achieve the functionality that you
want.
So, to instantiate the marker, look into google.maps.Marker.
That's my only hint.
To listen for clicks on the marker, look into event.addListener.
To get articles for a certain place, look into getting the JSON file
and remember how you retrieved it before.
Finally, within addMarker you'll want to remember each of those markers.
Remember that markers is a global variable at the top of scripts.js,
so you'll want to find some way of representing
this whole list of markers, whether it be an array or an object, what
have you, as long as you're able to remove them later on.
Because within removeMarker we'll want to iterate over this marker variable
and remove all of them from the map and delete them.
Again look into the Google Maps API for a function on how to remove and delete
these markers.
With that, you've completed all of the code that's
required of you for this problem.
Last thing for you to do is to try and break your own website.
There is no check 50, So it's up to you to compare against the staff solution,
try and come up with corner cases that you haven't accounted for yet.
Once you finish that, then you've completed your very first and pretty
cool web app.
My name is Zamyla, and this was Mashup.