Exercise: HTML APIs



In this exercise, you'll try out using several HTML APIs to add more dynamic content to the starter webpage.

  1. Download the starter file and save them into a project folder. Open the webpage up in the browser and make sure it works. It should pull in video information from inline JSON data and display linked video thumbnails in a list.
  2. Add a counter: Go to flagcounter.com and set up a hit counter for your website. Put the counter somewhere near the bottom of the page.
  3. Add a rating chart:
    • Add a "rating" field to each video in the inline JSON data, a number of 100.
    • Go to the Google Charts API Docs and read about the Google-o-meter image chart API parameters.
    • Find an example chart that looks the most like how you want to visualize the rating, and check out what URL parameters it uses.
    • Figure out what part of the URL you would need to change to make it show a chart for a particular rating (like 50 or 100).
    • Using just HTML, insert an image into the page with a chart URL.
    • Now, using JavaScript, insert an image for each video that has a dynamically generated chart URL. Either display them in the sidebar or display the charts when the video is played.
  4. Bonus: Modify the generated Youtube iframe players so that they auto-play when clicked. Read the docs here.
  5. Bonus: Create a bar chart that compares the ratings across all the videos, using the Google Bar Charts Image API.

Make sure that you use your browser developer tools to make debugging easier while working on this. Check for errors, and use console.log() to figure out how far your code makes it, and what the values of your variables are along the way.