-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
362 lines (337 loc) · 18.7 KB
/
Copy pathindex.html
File metadata and controls
362 lines (337 loc) · 18.7 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!DOCTYPE HTML>
<html lang="en">
<head>
<title> NHS Calendar-Maker - Newtown High School </title>
<meta name="Author" content="NHS Tech Team">
<meta name="msapplication-TileColor" content="#3A7BFF">
<meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#3A7BFF">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<link rel="apple-touch-icon" sizes="57x57" href="images/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="images/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="images/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="images/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="images/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="images/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="images/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/gif" sizes="192x192" href="images/favicon/192x192.gif">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="images/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon/favicon-16x16.png">
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="assets/css/uikit.almost-flat.css" />
<link rel="stylesheet" href="assets/css/components/datepicker.almost-flat.min.css" />
<link rel='stylesheet' href='assets/fullcalendar/fullcalendar.min.css' />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" href="assets/css/calendar-maker.css" />
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/index.global.min.js'></script>
<script src="assets/js/uikit.min.js"></script>
<script src="assets/js/components/datepicker.min.js" async></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script type="text/javascript">
function SetAllCheckBoxes(FormName, FieldName, CheckValue) {
document.querySelectorAll("input[type=checkbox]").forEach(element => {
element.checked = CheckValue;
});
}
</script>
<script>
regDays = ["A", "B", "C", "D", "E", "F", "G", "H"];
//helper functions
function getDate(str) {
const [year, month, day] = str.split("-").map(Number);
return new Date(year, month - 1, day);
}
async function fetchCSV(url) {
let response = await fetch(url);
let text = await response.text();
return text.split("\n").map(row => row.split(","));
}
//add checkboxes
document.addEventListener("DOMContentLoaded", function () {
let schedule = document.getElementById("scheduleinputs");
for (let i = 1; i <= 8; i++) {
let periodDiv = document.createElement("div");
periodDiv.id = `period${i}container`
periodDiv.innerHTML = `<h2><strong>Period ${i} Class:</strong></h2>` +
`<input data-clarity="Period ${i}" type=text name='period${i}' id='period${i}' placeholder="Period ${i} Class" size=25 tabindex=3/></br>`;
regDays.forEach(l => {
periodDiv.innerHTML += `<input data-clarity="Period ${i}-${l}" type="checkbox" id="${l}-${i}" checked name="day${l}[]" value="${l}"> <label for="${l}-${i}">${l}</label>`
});
//periodDiv.innerHTML += `</br><input type="radio" id="LW1-${i}" checked name="day${i}LW" value="LW1"> <label for="LW-${i}">Wave 1</label>` +
// `<input type="radio" id="LW2-${i}" name="day${i}LW" value="LW2"> <label for="LW2-${i}">Wave 2</label>` +
// `<input type="radio" id="LW3-${i}" name="day${i}LW" value="LW3"> <label for="LW3-${i}">Wave 3</label>`
schedule.appendChild(periodDiv);
}
});
//exporting
async function exportSchedule() {
var special_days = ["S", "SS", "SSS", "M1", "M2", "M3", "M4", "Y1", "Y2", "Y3", "Y4"];
var exportText = "Subject,Start Date,Start Time,End Date,End Time\r\n";
let daysData = await fetchCSV("schedules/days.csv");
let bellsData = await fetchCSV("schedules/bells.csv");
let startDate = getDate(document.getElementById("startdate").value)
let endDate = getDate(document.getElementById("enddate").value);
daysData.forEach(day => {
date = day[0]
console.log(day)
if (getDate(day[0]) >= startDate && getDate(day[0]) <= endDate) {
console.log("Processing day: " + date);
if (document.getElementById("advisory").checked) {
if (day[2] == "4") {
//Today is an Advisory Day.
exportText += `Advisory,${date},08:00,${date},08:40\r\n`;
}
}
bellsData.filter((bell) => {
return (bell[0] == day[2]) && (bell[1] == day[1])
}).forEach((block) => {
console.log(block)
dayCode = block[0] //ex. 1,2,3,4 type of day ex. early dismissal midterm/final
letterDay = block[1] //ex. A-H
period = block[2] //ex. 1-8
startTime = block[3]
endTime = block[4]
className = document.getElementById("period" + period).value //ex. Chemistry, History
if (className.length > 0) {
if (!regDays.includes(letterDay) || document.getElementById(`${letterDay}-${period}`).checked) {
exportText += `${className},${date},${startTime},${date},${endTime}\r\n`
}
}
})
}
});
let blob = new Blob([exportText], { type: "text/csv" });
let link = document.getElementById('downloadLink')
link.href = URL.createObjectURL(blob);
link.download = "schedule.csv";
const calendarAsJSON = exportText.trim().split("\r\n").map(row => row.split(","));
var json = [];
for (var i = 1; i < calendarAsJSON.length; i++) {
var title = calendarAsJSON[i][0];
var start_date = calendarAsJSON[i][1];
if (calendarAsJSON[i][2].split(":")[0].length == 1) {
calendarAsJSON[i][2] = "0" + calendarAsJSON[i][2] + ":00"; //fix single digit hours
}
var start_time = calendarAsJSON[i][2];
var end_date = calendarAsJSON[i][3];
if (calendarAsJSON[i][4].split(":")[0].length == 1) {
calendarAsJSON[i][4] = "0" + calendarAsJSON[i][4] + ":00"; //fix single digit hours
}
var end_time = calendarAsJSON[i][4];
json.push({
title: title,
start: start_date + "T" + start_time,
end: end_date + "T" + end_time
})
}
console.log(json)
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'timeGridWeek',
businessHours: {
start: '08:00',
end: '14:32',
dow: [1, 2, 3, 4, 5]
},
slotMinTime: "08:00",
slotMaxTime: "14:32",
editable: false,
height: "auto",
weekends: false,
allDaySlot: false,
events: json,
initialDate: startDate.toISOString().split('T')[0]
});
document.querySelector(".beginingpage").hidden = true
document.querySelector(".endingpage").hidden = false
calendar.render();
$('html, body').animate({ scrollTop: 0 }, 200);
}
</script>
<script type="text/javascript">
(function (c, l, a, r, i, t, y) {
c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };
t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/" + i;
y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "ss8i5ja1k5");
</script>
</head>
<body>
<div id="wrapper" class="endingpage" hidden>
<header id="header" class="alt">
<h1>Thanks for using the Newtown High School Calendar Generator</h1>
</header>
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="#download" class="active">Download</a></li>
<li><a href="#instructions">Instructions</a></li>
</ul>
</nav>
<!-- Main -->
<div id="main">
<!-- Introduction -->
<section id="download" class="main">
<div class="spotlight">
<div class="content">
<header class="major">
<h2>Download and View your new Calendar</h2>
</header>
<ul class="actions">
<li><a href="" class="button special icon fa-download" id="downloadLink">Download File</a>
</li>
</ul>
<div class="major" id="calendar"></div>
</div>
</div>
</section>
<section id="instructions" class="main">
<div class="spotlight">
<div class="content">
<header class="major">
<h2>Use Instructions</h2>
</header>
<h3>Here are instructions for creating a new calendar in Google Calendar and importing the CSV
file</h3>
<ul>
<li>Open <a href="https://calendar.google.com">Google Calendar</a></li>
<li>Click on the "gear" in the upper right corner and access "settings" </br> <img
src="images/settings.PNG" width="50%" border="0" alt=""></li>
<li>Under the "Add Calendar" section, select "Create new calendar" </br> <img
src="images/calendartab.PNG" width="30%" border="0" alt=""></li>
<li>Create a new calendar by entering a calendar name and clicking on "Create Calendar"
(you
can import the file directly into your main calendar <em>but</em> if you create a
new
calendar you can always delete it or share it without affecting your other
events)</li>
<li>On the left side of the screen select "Import & export" </br> <img
src="images/import.png" width="25%" border="0" alt=""></li>
<li>Select the CSV file that you downloaded, select your new calendar, and then click
"Import" </br> <img src="images/finalstep.png" width="50%" border="0" alt=""></li>
</ul>
</div>
</div>
</section>
</div>
</div>
<!-- Wrapper -->
<div id="wrapper" class="beginingpage">
<!-- Header -->
<header id="header">
<span class="logo"><img src="images/logo.png" width="10%" alt="" /></span>
<h1>Welcome to the Newtown High School Calendar Generator</h1>
<p>Maintained by <a href="https://newtownhs.tech">NHS Tech Team</a>
<br>
Currently Supporting Schedules for the 2025-2026 School Year
</p>
</header>
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="#intro" class="active">Instructions</a></li>
<li><a href="#cta">Build Schedule</a></li>
</ul>
</nav>
<!-- Main -->
<div id="main">
<!-- Introduction -->
<section id="intro" class="main">
<div class="spotlight">
<div class="content">
<header class="major">
<h2>Welcome to the Newtown High School Calendar Generator</h2>
</header>
<p>This program will generate a CSV file (suitable for import to Google Calendar) that
recognizes
Letter Day Designations, Half Days and even Finals.</p>
<p>
How to use it:
<ul>
<li>Be creative. Do it in pieces and establish a calendar for each course or section to be
shared with others.
</li>
<li>In the "Start Date" field, enter the date you would like the calendar information to
begin
on. Appropriate format is YYYY-MM-DD.
</li>
<li>In the "End Date" field, enter the date you would like the calendar information to end
on.
Appropriate format is YYYY-MM-DD. (Perhaps you have semester courses and need to run
this
twice.)
</li>
<li>In the "Period # Class" field, enter the name of the course, the duty, or whatever other
"period regular" activity you have (do not include commas - commas will be replaced with
dashes).
</li>
<li>Leave all of the Letter boxes checked if this event occurs on every letter day (don't
worry
about days that drop - the program knows which letter day it is). If an event occurs
only on
specific Letter days (like science lab), just leave those boxes checked.
</li>
<li>Click "Submit Schedule". Your CSV file will be created and you will see instructions on
how
to set up your Google calendar
</li>
</ul>
</p>
</div>
</div>
</section>
<!-- Get Started -->
<section id="cta" class="main special">
<form name="schedule" id="schedule">
<div class="row uniform">
<div class="6u 12u$(small)">Start Date: <input
data-uk-datepicker="{minDate:'2025-08-25', maxDate:'2026-06-10'}" type=text
name='startdate' id='startdate' size=50% value='2025-08-25' tabindex=1></div>
<div class="6u$ 12u$(small)">End Date: <input
data-uk-datepicker="{minDate:'2025-08-25', maxDate:'2026-06-10'}" type=text
name='enddate' id='enddate' size=50% value='2026-06-10' tabindex=2></div>
</div>
</br>
<div id="scheduleinputs"></div>
<input type="button"
onclick="SetAllCheckBoxes('schedule', 'day1[]', false);SetAllCheckBoxes('schedule', 'day2[]', false);SetAllCheckBoxes('schedule', 'day3[]', false);SetAllCheckBoxes('schedule', 'day4[]', false);SetAllCheckBoxes('schedule', 'day5[]', false);SetAllCheckBoxes('schedule', 'day6[]', false);SetAllCheckBoxes('schedule', 'day7[]', false);SetAllCheckBoxes('schedule', 'day8[]', false);"
value="Uncheck All"> <input type="button"
onclick="SetAllCheckBoxes('schedule', 'day1[]', true);SetAllCheckBoxes('schedule', 'day2[]', true);SetAllCheckBoxes('schedule', 'day3[]', true);SetAllCheckBoxes('schedule', 'day4[]', true);SetAllCheckBoxes('schedule', 'day5[]', true);SetAllCheckBoxes('schedule', 'day6[]', true);SetAllCheckBoxes('schedule', 'day7[]', true);SetAllCheckBoxes('schedule', 'day8[]', true);"
value="Check All">
<input type="checkbox" name="advisory" id="advisory"></input><label for="advisory">Advisory</label>
</br></br>
<input type=button onclick='exportSchedule()' id='submitschedule' name='submitschedule'
value='Submit Schedule' tabindex=10 />
</form>
<!--
<p>Looking for a new maintainer, contact <a
href="mailto:calendarmaker@devinmatte.com?subject=Calendar Maker">Devin Matte</a></p>
-->
</section>
</div>
<!-- Footer -->
<footer id="footer">
<p class="copyright">© 2025 <a href="https://newtownhs.tech">NHS Tech Team</a>
</br>
Design: <a href="https://github.com/devinmatte">Devin Matte</a> - Initial Design: <a
href="https://twitter.com/charlesdumais">Charles Dumais</a>
</br>
CSS Template: <a href="https://html5up.net">HTML5 UP</a>
</br>
<a href="https://github.com/NHSTechTeam/NHS-Calendar-Maker" title="GitHub" class="icon fa-github"><span
class="label">GitHub</span>
</a>
</p>
</footer>
</div>
</body>
</html>