1/34
Looks like no tags are added yet.
What does <link rel="stylesheet" href="css/style.css"> do?
Loads the CSS file so the page gets its colors, sizes and layout.
What does <button class="tab" onclick="showTab('mapPage')">Map</button> do?
Makes the Map tab; clicking it runs showTab('mapPage') to show the map page and hide the others.
What does <svg id="map" viewBox="0 0 2400 1045"> do?
Creates the drawing area for the map; the viewBox makes its coordinate grid exactly 2400 by 1045, the same size as the campus picture.
Why does the <image> tag come before the <circle> tags in the SVG?
SVG draws in order, so the picture is drawn first (at the bottom) and the circles are drawn on top of it.
What does <circle class="point" cx="1894" cy="184" r="22" fill="#c9c9c1" onclick="showCollege(0)" /> do?
Draws a small gray clickable dot on the CICS building; clicking it runs showCollege(0) to show CICS in the box.
In a college <circle>, what do cx and cy control?
Where the dot's center sits on the campus picture (x from the left edge, y from the top edge).
Why are there two circles with onclick="showCollege(4)"?
CLAC uses two buildings (Julian Felipe Hall and Paulo Campos Hall), so both dots open CLAC.
What does the <div id="box"> do?
It is the info box on the right side. It first says "Where are you headed?" and is later filled with courses or jobs by JavaScript.
What does <div id="collegesPage" class="page" style="display: none"> do?
Creates the Colleges page but hides it at the start; it only shows when the Colleges tab is clicked.
What does onclick="showTab('mapPage'); showCollege(0)" on a Colleges page button do?
Runs two functions in order: switches to the map page, then shows that college in the box.
What do <script src="js/data.js"></script> and <script src="js/script.js"></script> do?
Load the JavaScript files: first the data (the colleges list), then the logic (the functions).
Why does data.js load before script.js?
script.js uses the colleges list, so the list must already exist when the functions run.
Why are the <script> tags at the bottom of the body?
So all the HTML elements (like the box and the pages) exist before the JavaScript looks for them.
What does var colleges = [ … ]; in data.js create?
An array (list) of 8 college objects that holds all the app's information.
What information does each college object in data.js hold?
code (short name), name (full name), building, color and courses.
What does each course object in data.js hold?
name (the course name) and jobs (a list of jobs).
What does colleges[0] refer to?
The first college in the list, CICS.
What does the function showCollege(i) do?
Shows college number i in the box: its short name, full name, building and a button for each of its courses, and turns the box into the college's color.
In showCollege, what does var c = colleges[i]; do?
Saves the chosen college into a short variable c so the rest of the function can use it.
What does the for loop in showCollege do?
Goes through every course of the college and adds a button for each one.
In showCollege, what does each course button's onclick do?
Calls showCourse with the college number and course number, so clicking it shows that course's jobs.
What does document.getElementById("box").innerHTML = html; do?
Replaces everything inside the box with the new HTML that was built.
What does document.getElementById("box").style.backgroundColor = c.color; do?
Changes the box's background to the selected college's color.
What does the function showCourse(i, j) do?
Shows course j of college i in the box: the course name and a list of its jobs, each with a short description, plus a Back button.
In showCourse, what does var course = colleges[i].courses[j]; do?
Gets course number j from college number i and saves it in the variable course.
What does the for loop in showCourse do?
Goes through every job of the course and adds a list item with the job title in bold and its description under it.
What does the Back button in showCourse do?
Runs showCollege(i) again to go back to that college's course list.
What does the function showTab(name) do?
Hides all three pages, then shows only the page whose id was given.
Why does showTab hide all three pages first?
So only one page is visible at a time, no matter which page was open before.
What does document.getElementById(name).style.display = "block"; do in showTab?
Makes the chosen page visible.
In style.css, what do #map { flex: 2 } and #box { flex: 1 } do together?
The map takes 2 parts of the width and the box takes 1 part, so the map is twice as wide.
In style.css, what does the @media (max-width: 700px) block do?
On screens 700px wide or smaller (phones), stacks the map above the box and makes the big title 34px.
What happens, step by step, when you click a college dot?
The dot's onclick runs showCollege(i), which builds the college info and course buttons, puts them in the box and changes the box color.
What happens, step by step, when you click a tab?
The tab's onclick runs showTab(name), which hides all pages and shows the one with that id.
Which file holds the logic of the app?
js/script.js, with three functions: showCollege, showCourse and showTab.