-
Notifications
You must be signed in to change notification settings - Fork 0
/
precalculus.html
116 lines (97 loc) · 4.65 KB
/
precalculus.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<meta HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Precalculus Guides</title>
<link rel="stylesheet" href="guides.css">
</head>
<body>
<div id="header">
<a href="/"><img src="https://resources.finalsite.net/images/f_auto,q_auto/v1720002453/natomasunifiedorg/dydmlbcfvutq09ngjkc5/NP3CharterPrimaryLogoImage.png" alt="Np3 Logo"></a>
<button onclick="location.href='./guides.html';">Guides/Worksheets</button>
<button onclick="location.href='./about.html';">About Us</button>
<button onclick="location.href='./competitions.html';">Competitions</button>
<button onclick="location.href='./calculus.html';">Calculus Guides</button>
<button onclick="location.href='./precalculus.html';">Precalculus Guides</button>
<img src="./images/pi-rates watermark.png" alt="pirates logo" id="pirates-logo">
</div>
<div class="filter">
<label for="tagFilter">Filter by Chapter:</label>
<select id="tagFilter">
<option value="all">All</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
</div>
<p style="text-align: center;">Precalculus Guides</p>
<p style="text-align: center;">More resources are currently being added, will be available by January 2025</p>
<p style="text-align: center;"></p>
<table id="data-table">
<thead>
<tr>
<th>Chapter</th>
<th>Name</th>
<th>Guides</th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
<script>
document.addEventListener("DOMContentLoaded", function () {
const tagFilter = document.getElementById("tagFilter");
const tableBody = document.getElementById("table-body");
async function fetchData() {
const response = await fetch("precalculus_guides.json");
const data = await response.json();
return data;
}
async function populateTable() {
const data = await fetchData();
tableBody.innerHTML = "";
data.forEach(item => {
const row = document.createElement("tr");
const tagsCell = document.createElement("td");
tagsCell.textContent = item.tags.join(", ");
const nameCell = document.createElement("td");
nameCell.textContent = item.name;
const guideCell = document.createElement("td");
const guideLink = document.createElement("a");
guideLink.textContent = "Guide";
guideLink.target = "_blank";
guideLink.href = item.guideLink;
guideCell.appendChild(guideLink);
row.appendChild(tagsCell);
row.appendChild(nameCell);
row.appendChild(guideCell);
tableBody.appendChild(row);
});
}
tagFilter.addEventListener("change", () => {
const selectedTag = tagFilter.value;
const rows = tableBody.getElementsByTagName("tr");
for (const row of rows) {
const tagsCell = row.querySelector("td:first-child");
const tags = tagsCell.textContent.split(", ");
if (selectedTag === "all" || tags.includes(selectedTag)) {
row.style.display = "";
} else {
row.style.display = "none";
}
}
});
populateTable();
});
</script>
</body>
</html>