hate

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/34

encourage image

There are no tags or description

Looks like no tags are added yet.

35 Terms

1
New cards

What does <link rel="stylesheet" href="css/style.css"> do?

Loads the CSS file so the page gets its colors, sizes and layout.

2
New cards

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.

3
New cards

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.

4
New cards

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.

5
New cards

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.

6
New cards

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).

7
New cards

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.

8
New cards

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.

9
New cards

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.

10
New cards

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.

11
New cards

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).

12
New cards

Why does data.js load before script.js?

script.js uses the colleges list, so the list must already exist when the functions run.

13
New cards

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.

14
New cards

What does var colleges = [ … ]; in data.js create?

An array (list) of 8 college objects that holds all the app's information.

15
New cards

What information does each college object in data.js hold?

code (short name), name (full name), building, color and courses.

16
New cards

What does each course object in data.js hold?

name (the course name) and jobs (a list of jobs).

17
New cards

What does colleges[0] refer to?

The first college in the list, CICS.

18
New cards

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.

19
New cards

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.

20
New cards

What does the for loop in showCollege do?

Goes through every course of the college and adds a button for each one.

21
New cards

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.

22
New cards

What does document.getElementById("box").innerHTML = html; do?

Replaces everything inside the box with the new HTML that was built.

23
New cards

What does document.getElementById("box").style.backgroundColor = c.color; do?

Changes the box's background to the selected college's color.

24
New cards

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.

25
New cards

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.

26
New cards

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.

27
New cards

What does the Back button in showCourse do?

Runs showCollege(i) again to go back to that college's course list.

28
New cards

What does the function showTab(name) do?

Hides all three pages, then shows only the page whose id was given.

29
New cards

Why does showTab hide all three pages first?

So only one page is visible at a time, no matter which page was open before.

30
New cards

What does document.getElementById(name).style.display = "block"; do in showTab?

Makes the chosen page visible.

31
New cards

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.

32
New cards

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.

33
New cards

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.

34
New cards

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.

35
New cards

Which file holds the logic of the app?

js/script.js, with three functions: showCollege, showCourse and showTab.