From 4b991d01cf96b32ca4552a23797e4395dd71875e Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Sun, 25 Aug 2019 16:03:58 -0400
Subject: [PATCH 01/62] Bring Old Scheduler Files Into Folder
Has HTML file for I/O and a JS file to enter cookies
---
scheduler/scheduler.html | 204 ++++++++++++++++++++++++++++++++++
scheduler/script/scheduler.js | 70 ++++++++++++
2 files changed, 274 insertions(+)
create mode 100644 scheduler/scheduler.html
create mode 100644 scheduler/script/scheduler.js
diff --git a/scheduler/scheduler.html b/scheduler/scheduler.html
new file mode 100644
index 0000000..d02eb46
--- /dev/null
+++ b/scheduler/scheduler.html
@@ -0,0 +1,204 @@
+
+
+
+
+Scheduler for Hotchkiss Clock
+
+
+
+
+
+
+
+
+ If you have copied code from the alert bubble in another browser, paste it here to update your schedule.
+
+
+
+
diff --git a/scheduler/script/scheduler.js b/scheduler/script/scheduler.js
new file mode 100644
index 0000000..1bf669c
--- /dev/null
+++ b/scheduler/script/scheduler.js
@@ -0,0 +1,70 @@
+
+/*
+Scheduler for Hotchkiss Clock
+Nicholas Lorentzen
+Last updated 20190415
+*/
+var boiyardee = [];
+
+function addCookie(cookname)
+{
+ boiyardee.push(cookname);
+ document.cookie = cookname + ";domain=thehotchkissrecord.github.io;max-age=31536000";
+}
+
+function bakeCookies(recipe)
+{
+ addCookie(recipe + "=" + escape(document.getElementById(recipe).value));
+}
+
+function putCookie()
+{
+ var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
+
+ classes.forEach(bakeCookies);
+ console.log (boiyardee.join(";") + ";domain=thehotchkissrecord.github.io;max-age=31536000");
+ document.cookie = boiyardee.join(";") + ";domain=thehotchkissrecord.github.io;max-age=31536000";
+ return true;
+}
+
+function exitScheduler()
+{
+ putCookie();
+ alert("Cookies Set (Copy this for another browser): " + unescape(document.cookie));
+ window.location.replace("https://thehotchkissrecord.github.io/HotchkissClock/");
+}
+
+function cookiesAlert()
+{
+ window.alert("(STILL IN TESTING) Welcome to the scheduler! In order to use this service you will need cookies enabled. - Nicholas Lorentzen")
+ var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
+
+ classes.forEach(fillTable);
+}
+
+function fillTable(chef)
+{
+ document.getElementById(chef).value = getCookie(chef);
+}
+
+function getCookie(cname) {
+ var name = cname + "=";
+ var decodedCookie = decodeURIComponent(document.cookie);
+ var ca = decodedCookie.split(';');
+ for(var i = 0; i
Date: Sun, 25 Aug 2019 22:15:53 -0400
Subject: [PATCH 02/62] Clean Up A Bunch of Stuff
Removed duplicate Date(); calls to allow better debugging.
HTML fixes
Added proper counters
---
index.html | 9 ++++-----
script.js | 56 ++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/index.html b/index.html
index 8f9f25d..067ee8b 100644
--- a/index.html
+++ b/index.html
@@ -10,8 +10,7 @@
-
+
@@ -21,8 +20,8 @@
-
+
@@ -63,7 +62,7 @@
-
Eric Li ’13, Jiahua Chen ’20
+
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20
diff --git a/script.js b/script.js
index a04d24f..92e6f6b 100644
--- a/script.js
+++ b/script.js
@@ -1,19 +1,19 @@
/*
Controller for clock/time webapp
-Jiahua Chen, based off Eric Li's original design
-Last updated 6 July 2019
+Nicholas Lorentzen, Jiahua Chen, based off Eric Li's original design
+Last updated 25 August 2019
*/
// Gets the current date and time
-var d = new Date();
-// var d = new Date(2019,2,5,15,13,03,0);
+//var d = new Date();
+var d = new Date(2019,8,26,14,30,7,0);
// console.log(" *** d.getDate() " + d.getDate());
// console.log(" *** d.getMonth() " + d.getMonth());
// console.log(" *** dayType noClassSats" + i);
// Updates the date and time
function updateD() {
- d = new Date();
+ //d = new Date();
}
var showTime = true;
@@ -21,13 +21,17 @@ var descText;
var weekendText = "";
// Gets the classification of the date, and returns 0 if it is a normal day. Also contains dictionaries for special days.
+
// Defines the special days
-var onbreak = true;
+var onbreak = false;
var specialDays = [new CalDay(3, 8), new CalDay(4, 25)]; // <- For special event days
var noClassSats = [new CalDay(4, 20), new CalDay(5, 4), new CalDay(5, 18)]; // <- For days without Saturday classes
var noClassDays = [new CalDay(4, 22), new CalDay(5, 18), new CalDay(5, 27), new CalDay(6, 1)]; // <- For days without classes, or breaks
var holidayDays = []; // <- For holidays
+
+
function dayType() {
+ var i = 0;
for (i = 0; i < specialDays.length; i++) {
if (specialDays[i].month === d.getMonth() && specialDays[i].date === d.getDate()) {
return 1;
@@ -66,7 +70,7 @@ function dayType() {
}
function loadTime() {
- d = new Date();
+ //d = new Date();
// Adjusts into AM and PM time
var hr = ((d.getHours() + 11) % 12 + 1);
var sufx = (d.getHours() >= 12) ? 'PM' : 'AM';
@@ -78,7 +82,7 @@ function loadTime() {
function loadDate() {
// Dictionary for text-based date
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
- var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+ //var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
// Outputs to HTML
descText = days[d.getDay()];
@@ -106,6 +110,7 @@ function CalDay(month, date) {
// Updates the clock messages
function update() {
+ var i = 0;
// Stores the dayType
var type = dayType();
// Debug ***
@@ -144,17 +149,17 @@ function update() {
normalDay(currentSchedule[i].title, currentSchedule[i].endRaw - parseRaw(), currentSchedule[i + 2].title, currentSchedule[i + 2].startRaw - parseRaw());
}
}
+
if (parseRaw() > currentSchedule[currentSchedule.length - 1].endRaw) {
showTime = true;
document.getElementById("class-info").innerHTML = "";
document.getElementById("schedule-info").innerHTML = descText + " ⋅ Have a nice day! ";
}
}
- } else {
}
if (showTime) {
document.getElementById("hrs").style.display = "block";
- rawTime = parseRaw();
+ var rawTime = parseRaw();
document.documentElement.style.setProperty('--timer-hours', "'" + toHrs(rawTime).toLocaleString('en-US', {
minimumIntegerDigits: 2,
useGrouping: false
@@ -300,10 +305,10 @@ function beforeSchool(title, time) {
}
function thisWeekend() {
- for (d = 0; d < 7; d++) {
- var result = new Date();
- result.setDate(result.getDate() + d);
- for (i = 0; i < noClassSats.length; i++) {
+ for (var addDay = 0; addDay < 7; addDay++) {
+ var result = d;
+ result.setDate(result.getDate() + addDay);
+ for (var i = 0; i < noClassSats.length; i++) {
if (noClassSats[i].month === result.getMonth() && noClassSats[i].date === result.getDate()) {
return " ⋅ No-Class Weekend ";
}
@@ -348,7 +353,8 @@ function toSecs(raw) {
return (raw % 60);
}
-// Converts raw time format to a parsed time string
+// Converts raw time format to a parsed time string (DEPRECATED)
+/*
function rawToString(raw) {
var output = "";
@@ -391,17 +397,35 @@ function rawToString(raw) {
}
return output;
}
+*/
window.addEventListener('load', onLoad);
function onLoad() {
- d = new Date();
+ //d = new Date();
loadTime();
loadDate();
update();
weekendText = thisWeekend();
}
+//Some code off a website to check cookies
+function getCookie(cname) {
+ var name = cname + "=";
+ var decodedCookie = decodeURIComponent(document.cookie);
+ var ca = decodedCookie.split(';');
+ for(var i = 0; i
Date: Sun, 25 Aug 2019 23:30:14 -0400
Subject: [PATCH 03/62] Added Cookie Capability to Clock
---
script.js | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/script.js b/script.js
index 92e6f6b..d15a0fb 100644
--- a/script.js
+++ b/script.js
@@ -6,7 +6,7 @@ Last updated 25 August 2019
// Gets the current date and time
//var d = new Date();
-var d = new Date(2019,8,26,14,30,7,0);
+var d = new Date(2019,8,26,14,30,1,0);
// console.log(" *** d.getDate() " + d.getDate());
// console.log(" *** d.getMonth() " + d.getMonth());
// console.log(" *** dayType noClassSats" + i);
@@ -188,7 +188,7 @@ function update() {
function getSchedule() {
// console.log(" *** d.getDate() " + d.getDay());
var weekday = d.getDay();
-
+
// Defines the currentSchedule array
var currentSchedule = [];
@@ -217,7 +217,7 @@ function getSchedule() {
currentSchedule[0] = new Period("Period 1", 8, 30, 9, 10);
currentSchedule[1] = new Period("→ Period 2", 9, 10, 9, 15);
currentSchedule[2] = new Period("Period 2", 9, 15, 9, 55);
- currentSchedule[3] = new Period("Passing Period", 9, 55, 10, 0);
+ currentSchedule[3] = new Period("→ Auditorium", 9, 55, 10, 0);
currentSchedule[4] = new Period("Auditorium", 10, 0, 10, 35);
currentSchedule[5] = new Period("→ Period 3", 10, 35, 10, 40);
currentSchedule[6] = new Period("Period 3", 10, 40, 11, 20);
@@ -258,7 +258,8 @@ function getSchedule() {
} else {
noClasses();
}
- return currentSchedule;
+
+ return cookieCheck(currentSchedule);
}
function specialSchedule() // <- What to print during special schedules
@@ -409,6 +410,9 @@ function onLoad() {
weekendText = thisWeekend();
}
+// Below Code from Nicholas Lorentzen '20
+//This code was added to add the functionality of inputting a schedule
+
//Some code off a website to check cookies
function getCookie(cname) {
var name = cname + "=";
@@ -426,6 +430,34 @@ function getCookie(cname) {
return "";
}
+function cookieCheck(scheduleToCheck)
+{
+ var cookieAbbrev = ["m", "t", "w", "y", "f", "s"];
+ var currentAbbrev = cookieAbbrev[d.getDay()];
+
+ for(var i = 0; i < scheduleToCheck.length; i++){
+ var currentPeriod = scheduleToCheck[i];
+ var currentPeriodName = currentPeriod.title;
+ var addArrow = false;
+ if(currentPeriodName.includes("→")){
+ addArrow = true;
+ }
+ if(currentPeriodName.includes("Period")){
+ var numIdx = 7;
+ if(addArrow) {numIdx = 9;}
+ var currentPeriodNum = parseInt(currentPeriodName.charAt(numIdx));
+ if(getCookie(currentAbbrev + currentPeriodNum))
+ {
+ currentPeriodName = getCookie(currentAbbrev + currentPeriodNum);
+ if(addArrow){currentPeriodName = "→ " + currentPeriodName;}
+ }
+ currentPeriod.title = currentPeriodName;
+ scheduleToCheck[i] = currentPeriod;
+ }
+ }
+ return scheduleToCheck;
+}
+
setInterval(loadTime, 1000);
setInterval(loadDate, 1000);
setInterval(updateD, 1000);
From ec6c383b904d3d9427e371142f2c86f609acd4c8 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Sun, 25 Aug 2019 23:42:46 -0400
Subject: [PATCH 04/62] Update Scheduler Domain
---
scheduler/{script => js}/scheduler.js | 14 +++++++-------
scheduler/scheduler.html | 3 +--
2 files changed, 8 insertions(+), 9 deletions(-)
rename scheduler/{script => js}/scheduler.js (75%)
diff --git a/scheduler/script/scheduler.js b/scheduler/js/scheduler.js
similarity index 75%
rename from scheduler/script/scheduler.js
rename to scheduler/js/scheduler.js
index 1bf669c..96c39e7 100644
--- a/scheduler/script/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -2,14 +2,14 @@
/*
Scheduler for Hotchkiss Clock
Nicholas Lorentzen
-Last updated 20190415
+Last updated 2019 04 15
*/
var boiyardee = [];
function addCookie(cookname)
{
boiyardee.push(cookname);
- document.cookie = cookname + ";domain=thehotchkissrecord.github.io;max-age=31536000";
+ document.cookie = cookname + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
}
function bakeCookies(recipe)
@@ -22,16 +22,16 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=thehotchkissrecord.github.io;max-age=31536000");
- document.cookie = boiyardee.join(";") + ";domain=thehotchkissrecord.github.io;max-age=31536000";
+ console.log (boiyardee.join(";") + ";domain=domain=ekkoing.github.io/cclock/;max-age=31536000");
+ document.cookie = boiyardee.join(";") + ";domain=domain=ekkoing.github.io/cclock/;max-age=31536000";
return true;
}
function exitScheduler()
{
putCookie();
- alert("Cookies Set (Copy this for another browser): " + unescape(document.cookie));
- window.location.replace("https://thehotchkissrecord.github.io/HotchkissClock/");
+ //alert("Cookies Set (Copy this for another browser): " + unescape(document.cookie));
+ window.location.replace("https://ekkoing.github.io/cclock/");
}
function cookiesAlert()
@@ -65,6 +65,6 @@ function getCookie(cname) {
function updateScheduler()
{
- document.cookie = document.getElementById("pasteCode").value + ";domain=thehotchkissrecord.github.io;max-age=31536000";
+ document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
alert(document.cookie);
}
\ No newline at end of file
diff --git a/scheduler/scheduler.html b/scheduler/scheduler.html
index d02eb46..b4735ec 100644
--- a/scheduler/scheduler.html
+++ b/scheduler/scheduler.html
@@ -3,7 +3,6 @@
Scheduler for Hotchkiss Clock
-
@@ -195,7 +194,7 @@
- If you have copied code from the alert bubble in another browser, paste it here to update your schedule.
+ If you have copied code from the alert bubble in another browser, paste it here to update your schedule. (Not Working Yet)
From 866009cf9dc793f9f909d521cf8b759870db82d2 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Sun, 25 Aug 2019 23:44:47 -0400
Subject: [PATCH 05/62] Update File Name
---
scheduler/{scheduler.html => index.html} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename scheduler/{scheduler.html => index.html} (100%)
diff --git a/scheduler/scheduler.html b/scheduler/index.html
similarity index 100%
rename from scheduler/scheduler.html
rename to scheduler/index.html
From 2fa6a177833d91388ba87c18f3856964a52bafb0 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Sun, 25 Aug 2019 23:48:32 -0400
Subject: [PATCH 06/62] Fix Domain Error
---
scheduler/js/scheduler.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 96c39e7..46877c6 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -22,8 +22,8 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=domain=ekkoing.github.io/cclock/;max-age=31536000");
- document.cookie = boiyardee.join(";") + ";domain=domain=ekkoing.github.io/cclock/;max-age=31536000";
+ console.log (boiyardee.join(";") + ";domain=ekkoing.github.io/cclock/;max-age=31536000");
+ document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
return true;
}
From b3e1ef3cbb90913bd6bb39733e645e2443c17559 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 00:06:37 -0400
Subject: [PATCH 07/62] Change Customization Section
---
README.md | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index a680bc5..bb941b0 100644
--- a/README.md
+++ b/README.md
@@ -49,13 +49,7 @@ animation: Gradient 15s ease infinite;
## Customization
### Add your own schedule
-`script.js` is the controller for the clock on the page. It's simple but naïve –– the static page requires static changes to the code. For now, this means that you need to go into the actual functions to change the schedule, and the schedule unfortunately is not dynamically loading.
-
-`getSchedule()` gets the schedules of the day and outputs the correct block/period. `weekday` starts on Sunday (0), thus making Monday 1, and so on. You want to define and fill the array currentSchedule to indicate the period the specific weekday is following:
-```javascript
-currentSchedule[0] = new Period("Period 1", 8, 30, 9, 15);
-```
-Where `new Period("Period 1", 8, 30, 9, 15)` means that the first period of the day (in `currentSchedule[0]`) is called "Period 1", and it starts at 8:30 AM and ends at 9:15 AM. The rest of the periods, and the rest of the days are defined similarly.
+//NEEDS TO BE REWRITTEN TO SPECIFY 2 WAYS OF CUSTOMIZATION
### Special schedules
At the start of the document, there are definitions for special days. On some occasions, events or special schedules might disrupt the normal schedule. This is where it should be defined and noted. Note that `new CalDay(3, 8)` means 8th of March.
@@ -111,4 +105,4 @@ The clock will also display a random inspirational quote whenever you load it, l
## Thanks
The design of version 2 was inspired by [Decount](https://decount.co/) (and this design was reimplemented into Decount), and the original source code was adapted from [Eric Li's Network Clock](https://github.com/eli8527/Network-Clock).
-CClock © 2019, Jiahua Chen. Released under the [MIT License](https://mit-license.org/).
+CClock © 2019, [Jiahua Chen](github.com/jiahuac) & [Nicholas Lorentzen](github.com/EKKOING). Released under the [MIT License](https://mit-license.org/).
From 1d08a5d230751b52878034281ef32517c8bee604 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 00:08:13 -0400
Subject: [PATCH 08/62] Added Second Author
---
LICENSE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index e398f3c..68f9444 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019 Jiahua Chen
+Copyright (c) 2019 Jiahua Chen & Nicholas Lorentzen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
From f99607eedb2ec72484eebf351c8dfd3773f04260 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 00:12:59 -0400
Subject: [PATCH 09/62] Stop Scheduler from Auto Exiting
---
scheduler/js/scheduler.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 46877c6..bd8101d 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,7 +9,7 @@ var boiyardee = [];
function addCookie(cookname)
{
boiyardee.push(cookname);
- document.cookie = cookname + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
+ document.cookie = cookname + ";domain=ekkoing.github.io/cclock;max-age=31536000";
}
function bakeCookies(recipe)
@@ -22,8 +22,8 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=ekkoing.github.io/cclock/;max-age=31536000");
- document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
+ console.log (boiyardee.join(";") + ";domain=ekkoing.github.io/cclock;max-age=31536000");
+ document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io/cclock;max-age=31536000";
return true;
}
@@ -31,7 +31,7 @@ function exitScheduler()
{
putCookie();
//alert("Cookies Set (Copy this for another browser): " + unescape(document.cookie));
- window.location.replace("https://ekkoing.github.io/cclock/");
+ //window.location.replace("https://ekkoing.github.io/cclock");
}
function cookiesAlert()
@@ -65,6 +65,6 @@ function getCookie(cname) {
function updateScheduler()
{
- document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io/cclock/;max-age=31536000";
+ document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io/cclock;max-age=31536000";
alert(document.cookie);
}
\ No newline at end of file
From 14e203852af38649d9a3ace23ee29fd354f8f877 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 00:43:04 -0400
Subject: [PATCH 10/62] Update Domain for Testing
---
scheduler/js/scheduler.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index bd8101d..d0677e6 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,7 +9,7 @@ var boiyardee = [];
function addCookie(cookname)
{
boiyardee.push(cookname);
- document.cookie = cookname + ";domain=ekkoing.github.io/cclock;max-age=31536000";
+ document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000";
}
function bakeCookies(recipe)
@@ -22,8 +22,8 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=ekkoing.github.io/cclock;max-age=31536000");
- document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io/cclock;max-age=31536000";
+ console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000");
+ document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000";
return true;
}
@@ -65,6 +65,6 @@ function getCookie(cname) {
function updateScheduler()
{
- document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io/cclock;max-age=31536000";
+ document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io;max-age=31536000";
alert(document.cookie);
}
\ No newline at end of file
From b951f7aa683e8f7dee3bef2af731c23428246b8e Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 00:56:51 -0400
Subject: [PATCH 11/62] Fix Logic Statement
---
script.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/script.js b/script.js
index d15a0fb..19a3aea 100644
--- a/script.js
+++ b/script.js
@@ -446,8 +446,7 @@ function cookieCheck(scheduleToCheck)
var numIdx = 7;
if(addArrow) {numIdx = 9;}
var currentPeriodNum = parseInt(currentPeriodName.charAt(numIdx));
- if(getCookie(currentAbbrev + currentPeriodNum))
- {
+ if(!(getCookie(currentAbbrev + currentPeriodNum) === "")){
currentPeriodName = getCookie(currentAbbrev + currentPeriodNum);
if(addArrow){currentPeriodName = "→ " + currentPeriodName;}
}
From 5a33987b5eef98fb064b72eaea83cb8159654b01 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:10:43 -0400
Subject: [PATCH 12/62] Set a cookie path
---
scheduler/js/scheduler.js | 8 ++++----
script.js | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index d0677e6..6a9c29b 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,7 +9,7 @@ var boiyardee = [];
function addCookie(cookname)
{
boiyardee.push(cookname);
- document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000";
+ document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000;path=\";
}
function bakeCookies(recipe)
@@ -22,8 +22,8 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000");
- document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000";
+ console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=\");
+ document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=\";
return true;
}
@@ -65,6 +65,6 @@ function getCookie(cname) {
function updateScheduler()
{
- document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io;max-age=31536000";
+ document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io;max-age=31536000;path=\";
alert(document.cookie);
}
\ No newline at end of file
diff --git a/script.js b/script.js
index 19a3aea..e31dd36 100644
--- a/script.js
+++ b/script.js
@@ -433,7 +433,7 @@ function getCookie(cname) {
function cookieCheck(scheduleToCheck)
{
var cookieAbbrev = ["m", "t", "w", "y", "f", "s"];
- var currentAbbrev = cookieAbbrev[d.getDay()];
+ var currentAbbrev = cookieAbbrev[d.getDay() - 1];
for(var i = 0; i < scheduleToCheck.length; i++){
var currentPeriod = scheduleToCheck[i];
From 05768646cfdcdc5dcedc615af3b99f866454ccf2 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:18:14 -0400
Subject: [PATCH 13/62] Fix backslash direction
---
scheduler/js/scheduler.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 6a9c29b..e6f6395 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,7 +9,7 @@ var boiyardee = [];
function addCookie(cookname)
{
boiyardee.push(cookname);
- document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000;path=\";
+ document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000;path=/";
}
function bakeCookies(recipe)
@@ -22,8 +22,8 @@ function putCookie()
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(bakeCookies);
- console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=\");
- document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=\";
+ console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=/");
+ document.cookie = boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=/";
return true;
}
@@ -65,6 +65,6 @@ function getCookie(cname) {
function updateScheduler()
{
- document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io;max-age=31536000;path=\";
+ document.cookie = document.getElementById("pasteCode").value + ";domain=ekkoing.github.io;max-age=31536000;path=/";
alert(document.cookie);
}
\ No newline at end of file
From b5721610959a84c57a33347e47c0dceb7e537123 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:27:06 -0400
Subject: [PATCH 14/62] Fix 5A/5B Bug
---
script.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/script.js b/script.js
index e31dd36..5389440 100644
--- a/script.js
+++ b/script.js
@@ -446,6 +446,8 @@ function cookieCheck(scheduleToCheck)
var numIdx = 7;
if(addArrow) {numIdx = 9;}
var currentPeriodNum = parseInt(currentPeriodName.charAt(numIdx));
+ if(currentPeriodNum > 5){currentPeriodNum = currentPeriodNum + 1;}
+ if(currentPeriodName.includes("5B")){currentPeriodNum = 6;}
if(!(getCookie(currentAbbrev + currentPeriodNum) === "")){
currentPeriodName = getCookie(currentAbbrev + currentPeriodNum);
if(addArrow){currentPeriodName = "→ " + currentPeriodName;}
From feedeb48425dfdd96f294065ec171b776fa3550f Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:31:48 -0400
Subject: [PATCH 15/62] Happiness was mispelled
---
message.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/message.js b/message.js
index e65e016..7939b2e 100644
--- a/message.js
+++ b/message.js
@@ -103,7 +103,7 @@ var quotes = [
name: "George Carlin"
},
{
- quote: "Hapiness is not something ready made. It comes from your own actions.",
+ quote: "Happiness is not something ready made. It comes from your own actions.",
name: "Dalai Lama"
}
]; // <- Quotes go here
From 102d0ea05bbc3b63d6c0555cc7929455501f0d72 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:38:59 -0400
Subject: [PATCH 16/62] Take out of testing mode
---
script.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/script.js b/script.js
index 5389440..092d00d 100644
--- a/script.js
+++ b/script.js
@@ -1,19 +1,19 @@
/*
Controller for clock/time webapp
Nicholas Lorentzen, Jiahua Chen, based off Eric Li's original design
-Last updated 25 August 2019
+Last updated 26 August 2019
*/
// Gets the current date and time
-//var d = new Date();
-var d = new Date(2019,8,26,14,30,1,0);
+var d = new Date();
+//var d = new Date(2019,8,26,14,30,1,0);
// console.log(" *** d.getDate() " + d.getDate());
// console.log(" *** d.getMonth() " + d.getMonth());
// console.log(" *** dayType noClassSats" + i);
// Updates the date and time
function updateD() {
- //d = new Date();
+ d = new Date();
}
var showTime = true;
From c5a2ced90eaba3c9041621a0939f01d07037f009 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 26 Aug 2019 18:43:46 -0400
Subject: [PATCH 17/62] Update Scheduler Style
---
scheduler/index.html | 7 +------
scheduler/style/scheduler.css | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 6 deletions(-)
create mode 100644 scheduler/style/scheduler.css
diff --git a/scheduler/index.html b/scheduler/index.html
index b4735ec..e2d210b 100644
--- a/scheduler/index.html
+++ b/scheduler/index.html
@@ -4,6 +4,7 @@
Scheduler for Hotchkiss Clock
+
-
- If you have copied code from the alert bubble in another browser, paste it here to update your schedule. (Not Working Yet)
-
-
diff --git a/scheduler/style/scheduler.css b/scheduler/style/scheduler.css
new file mode 100644
index 0000000..9cb3bf6
--- /dev/null
+++ b/scheduler/style/scheduler.css
@@ -0,0 +1,22 @@
+@charset "utf-8";
+/* CSS Document */
+
+
+/* Body style */
+body {
+ /* Font */
+ font-family: 'Open Sans', sans-serif;
+ min-height: 300px;
+ min-width: 500px;
+ display: flex;
+ align-items: center;
+ justify-content: left;
+ color: #20265A;
+ /* Animated gradient background */
+ /*background: linear-gradient(-30deg, #111E6C, #0E4D92, #0F52BA, #003152);*/
+ background-size: 1000% 1000%;
+ -webkit-animation: Gradient 15s ease infinite;
+ -moz-animation: Gradient 15s ease infinite;
+ animation: Gradient 15s ease infinite;
+ z-index: -50;
+}
From 231d56d776bbfa366e073499e03a68fbbb1fe219 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Sun, 1 Sep 2019 23:46:26 -0400
Subject: [PATCH 18/62] Start Work on the new Schedule Preview Widget
---
index.html | 3 +++
message.js | 6 ++----
scheduler/index.html | 39 +++++++++++++++++++++++++++++++++++++++
scheduler/js/scheduler.js | 4 ++--
4 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/index.html b/index.html
index 067ee8b..45a3682 100644
--- a/index.html
+++ b/index.html
@@ -74,6 +74,9 @@
+
diff --git a/message.js b/message.js
index 7939b2e..342f0cd 100644
--- a/message.js
+++ b/message.js
@@ -8,7 +8,7 @@ Last updated 6 July 2019
window.addEventListener('load', loadMessage);
// Loads a series of messages and quotes
-var message = ["Have a great summer! "]; // <- Message goes here!
+var message = ["Welcome Back!"]; // <- Message goes here!
var quotes = [
{
quote: "Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible.",
@@ -109,11 +109,9 @@ var quotes = [
]; // <- Quotes go here
function loadMessage() {
- if (message.length !== 0) {
+ if (!(message === "")) {
document.getElementById("message").innerHTML = message[0];
document.getElementById("message-widget").style.display = "block";
- } else {
-
}
var idx = Math.floor(Math.random() * quotes.length);
// var idx = 5; // <- Clock quote
diff --git a/scheduler/index.html b/scheduler/index.html
index e2d210b..bebf648 100644
--- a/scheduler/index.html
+++ b/scheduler/index.html
@@ -187,6 +187,45 @@
+
+
+
+
+
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index e6f6395..7c2621b 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -19,7 +19,7 @@ function bakeCookies(recipe)
function putCookie()
{
- var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
+ var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4","name"];
classes.forEach(bakeCookies);
console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=/");
@@ -36,7 +36,7 @@ function exitScheduler()
function cookiesAlert()
{
- window.alert("(STILL IN TESTING) Welcome to the scheduler! In order to use this service you will need cookies enabled. - Nicholas Lorentzen")
+ window.alert("Welcome to the scheduler! In order to use this service you will need cookies enabled. Note that any data entered here cannot be read from any other computer and exists purely on your device. This means that all data must be entered on each device separately until I come up with a more elegant solution - Nicholas Lorentzen '20")
var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(fillTable);
From 4d00101e89f83344e54cd5ec224a6cf2801f7bef Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 2 Sep 2019 00:05:04 -0400
Subject: [PATCH 19/62] Add Dates for Fall 2019
---
scheduler/js/scheduler.js | 3 +--
script.js | 12 +++++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 7c2621b..7a0874f 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -5,6 +5,7 @@ Nicholas Lorentzen
Last updated 2019 04 15
*/
var boiyardee = [];
+var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4","name"];
function addCookie(cookname)
{
@@ -19,7 +20,6 @@ function bakeCookies(recipe)
function putCookie()
{
- var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4","name"];
classes.forEach(bakeCookies);
console.log (boiyardee.join(";") + ";domain=ekkoing.github.io;max-age=31536000;path=/");
@@ -37,7 +37,6 @@ function exitScheduler()
function cookiesAlert()
{
window.alert("Welcome to the scheduler! In order to use this service you will need cookies enabled. Note that any data entered here cannot be read from any other computer and exists purely on your device. This means that all data must be entered on each device separately until I come up with a more elegant solution - Nicholas Lorentzen '20")
- var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5","t6","t7","t8","w1","w2","w3","w4","y1","y2","y3","y4","y5","y6","y7","y8","f1","f2","f3","f4","f5","f6","f7","f8","s1","s2","s3","s4"];
classes.forEach(fillTable);
}
diff --git a/script.js b/script.js
index 092d00d..7dd3fc3 100644
--- a/script.js
+++ b/script.js
@@ -24,10 +24,10 @@ var weekendText = "";
// Defines the special days
var onbreak = false;
-var specialDays = [new CalDay(3, 8), new CalDay(4, 25)]; // <- For special event days
-var noClassSats = [new CalDay(4, 20), new CalDay(5, 4), new CalDay(5, 18)]; // <- For days without Saturday classes
-var noClassDays = [new CalDay(4, 22), new CalDay(5, 18), new CalDay(5, 27), new CalDay(6, 1)]; // <- For days without classes, or breaks
-var holidayDays = []; // <- For holidays
+var specialDays = [new CalDay(9, 2), new CalDay(10, 12), new CalDay(11, 23)]; // <- For special event days
+var noClassSats = [new CalDay(9, 14), new CalDay(10, 5), new CalDay(11, 2), new CalDay(12, 7)]; // <- For days without Saturday classes
+var noClassDays = [new CalDay(5, 27), new CalDay(6, 1)]; // <- For days without classes, or breaks
+var holidayDays = [new CalDay(10, 14), new CalDay(10, 15), new CalDay(12, 2)]; // <- For holidays
function dayType() {
@@ -265,7 +265,7 @@ function getSchedule() {
function specialSchedule() // <- What to print during special schedules
{
document.getElementById("class-info").innerHTML = "Special Schedule ";
- document.getElementById("schedule-info").innerHTML = "Please consult your planner for details.";
+ document.getElementById("schedule-info").innerHTML = "Please consult your email for details.";
}
function noClassSat() // <- What to print for no-class Saturdays
@@ -459,6 +459,8 @@ function cookieCheck(scheduleToCheck)
return scheduleToCheck;
}
+//Adds Schedule Preview and Custom Messages
+
setInterval(loadTime, 1000);
setInterval(loadDate, 1000);
setInterval(updateD, 1000);
From 575e61705f7a85cf4c650d0add6f5db2e25351c0 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 2 Sep 2019 10:05:26 -0400
Subject: [PATCH 20/62] Add links and autoredirect from scheduler
---
index.html | 3 ++-
scheduler/js/scheduler.js | 6 +++---
script.js | 1 +
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/index.html b/index.html
index 45a3682..96c5b84 100644
--- a/index.html
+++ b/index.html
@@ -62,7 +62,7 @@
-
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20
+
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20 V1.01
@@ -76,6 +76,7 @@
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 7a0874f..ead24bc 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -29,9 +29,9 @@ function putCookie()
function exitScheduler()
{
- putCookie();
- //alert("Cookies Set (Copy this for another browser): " + unescape(document.cookie));
- //window.location.replace("https://ekkoing.github.io/cclock");
+ putCookie();
+ alert("Schedule Updated!");
+ window.location.href("https://ekkoing.github.io/cclock");
}
function cookiesAlert()
diff --git a/script.js b/script.js
index 7dd3fc3..03c5554 100644
--- a/script.js
+++ b/script.js
@@ -408,6 +408,7 @@ function onLoad() {
loadDate();
update();
weekendText = thisWeekend();
+ document.getElementById("schedule-message").style.display = "block";
}
// Below Code from Nicholas Lorentzen '20
From 7f4450608d56e2f97b67e5f333cdfb661d2561a7 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Mon, 2 Sep 2019 12:56:27 -0400
Subject: [PATCH 21/62] Fix Redirect
---
scheduler/js/scheduler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index ead24bc..5ee3fd8 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -31,7 +31,7 @@ function exitScheduler()
{
putCookie();
alert("Schedule Updated!");
- window.location.href("https://ekkoing.github.io/cclock");
+ window.location.href = "https://ekkoing.github.io/cclock";
}
function cookiesAlert()
From 2ca5cf7c387c639726e236a2b4d94922f3a2077e Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 00:40:24 -0400
Subject: [PATCH 22/62] Add Schedule Preview Widget
---
message.js | 4 --
scheduler/js/scheduler.js | 2 +-
script.js | 145 +++++++++++++++++++++++++++++++++++---
3 files changed, 137 insertions(+), 14 deletions(-)
diff --git a/message.js b/message.js
index 342f0cd..256da69 100644
--- a/message.js
+++ b/message.js
@@ -109,10 +109,6 @@ var quotes = [
]; // <- Quotes go here
function loadMessage() {
- if (!(message === "")) {
- document.getElementById("message").innerHTML = message[0];
- document.getElementById("message-widget").style.display = "block";
- }
var idx = Math.floor(Math.random() * quotes.length);
// var idx = 5; // <- Clock quote
document.getElementById("quote").innerHTML = quotes[idx].quote;
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 5ee3fd8..e43c3b3 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -36,7 +36,7 @@ function exitScheduler()
function cookiesAlert()
{
- window.alert("Welcome to the scheduler! In order to use this service you will need cookies enabled. Note that any data entered here cannot be read from any other computer and exists purely on your device. This means that all data must be entered on each device separately until I come up with a more elegant solution - Nicholas Lorentzen '20")
+ window.alert("Welcome to the scheduler! In order to use this service you will need cookies enabled. Note that any data entered here cannot be read from any other computer and exists purely on your device. This means that all data must be entered on each device separately until I come up with a more elegant solution - Nicholas Lorentzen '20");
classes.forEach(fillTable);
}
diff --git a/script.js b/script.js
index 03c5554..9bb19b0 100644
--- a/script.js
+++ b/script.js
@@ -19,16 +19,20 @@ function updateD() {
var showTime = true;
var descText;
var weekendText = "";
+var mainMessage = "";
// Gets the classification of the date, and returns 0 if it is a normal day. Also contains dictionaries for special days.
// Defines the special days
var onbreak = false;
-var specialDays = [new CalDay(9, 2), new CalDay(10, 12), new CalDay(11, 23)]; // <- For special event days
+var specialDays = [new CalDay(10, 12), new CalDay(11, 23)]; // <- For special event days
var noClassSats = [new CalDay(9, 14), new CalDay(10, 5), new CalDay(11, 2), new CalDay(12, 7)]; // <- For days without Saturday classes
var noClassDays = [new CalDay(5, 27), new CalDay(6, 1)]; // <- For days without classes, or breaks
var holidayDays = [new CalDay(10, 14), new CalDay(10, 15), new CalDay(12, 2)]; // <- For holidays
+//What the current period's array location is
+var currentArrayLoc = 0;
+
function dayType() {
var i = 0;
@@ -129,7 +133,7 @@ function update() {
} else if (type === 0) {
// console.log(" *** Is normal day");
// Gets today's schedule
- var currentSchedule = getSchedule();
+ var currentSchedule = getSchedule(d.getDay());
// console.log(" *** currentSchedule " + currentSchedule.length);
// Checks which Period it currently is
@@ -143,6 +147,7 @@ function update() {
if (currentSchedule[i].startRaw < parseRaw() && parseRaw() < currentSchedule[i].endRaw) {
// console.log(" *** currentSchedule[i].startRaw " + currentSchedule[i].startRaw);
+ currentArrayLoc = i;
if (currentSchedule[i].title === "Passing Period") {
normalDay(currentSchedule[i].title, currentSchedule[i].endRaw - parseRaw(), currentSchedule[i + 1].title, currentSchedule[i + 1].startRaw - parseRaw());
} else {
@@ -151,11 +156,13 @@ function update() {
}
if (parseRaw() > currentSchedule[currentSchedule.length - 1].endRaw) {
+ currentArrayLoc = currentSchedule.length + 1;
showTime = true;
document.getElementById("class-info").innerHTML = "";
document.getElementById("schedule-info").innerHTML = descText + " ⋅ Have a nice day! ";
}
}
+ previewTableCreate();
}
if (showTime) {
document.getElementById("hrs").style.display = "block";
@@ -185,9 +192,8 @@ function update() {
}
// Gets the right schedule for a regular class day
-function getSchedule() {
+function getSchedule(weekday) {
// console.log(" *** d.getDate() " + d.getDay());
- var weekday = d.getDay();
// Defines the currentSchedule array
var currentSchedule = [];
@@ -197,7 +203,7 @@ function getSchedule() {
currentSchedule[0] = new Period("Period 1", 8, 30, 9, 15);
currentSchedule[1] = new Period("→ Period 2", 9, 15, 9, 20);
currentSchedule[2] = new Period("Period 2", 9, 20, 10, 5);
- currentSchedule[3] = new Period("Passing Period", 10, 5, 10, 10);
+ currentSchedule[3] = new Period("→ Chapel / Class Meeting", 10, 5, 10, 10);
currentSchedule[4] = new Period("Chapel / Class Meeting", 10, 10, 10, 35);
currentSchedule[5] = new Period("→ Period 3", 10, 35, 10, 40);
currentSchedule[6] = new Period("Period 3", 10, 40, 11, 20);
@@ -259,7 +265,7 @@ function getSchedule() {
noClasses();
}
- return cookieCheck(currentSchedule);
+ return cookieCheck(currentSchedule, weekday);
}
function specialSchedule() // <- What to print during special schedules
@@ -300,7 +306,7 @@ function normalDay(nowTitle, nowDiff, nextTitle, nextDiff) // <- What to print d
}
function beforeSchool(title, time) {
- document.getElementById("class-info").innerHTML = "→ " + title;
+ document.getElementById("class-info").innerHTML = title;
document.getElementById("schedule-info").innerHTML = descText + weekendText;
printTime(time);
}
@@ -431,10 +437,10 @@ function getCookie(cname) {
return "";
}
-function cookieCheck(scheduleToCheck)
+function cookieCheck(scheduleToCheck, weekday)
{
var cookieAbbrev = ["m", "t", "w", "y", "f", "s"];
- var currentAbbrev = cookieAbbrev[d.getDay() - 1];
+ var currentAbbrev = cookieAbbrev[weekday - 1];
for(var i = 0; i < scheduleToCheck.length; i++){
var currentPeriod = scheduleToCheck[i];
@@ -461,8 +467,129 @@ function cookieCheck(scheduleToCheck)
}
//Adds Schedule Preview and Custom Messages
+function previewTableCreate() {
+ if(document.cookie === "") {return;}
+ var myArrayLoc = currentArrayLoc;
+ var currentSchedule = getSchedule(d.getDay());
+ var nextDay = false;
+ if(myArrayLoc > currentSchedule.length){
+ if(d.getDay() + 1 == 7 || d.getDay() + 1 == 0){
+ return;
+ }
+ currentSchedule = getSchedule(d.getDay() + 1);
+ myArrayLoc = -1;
+ nextDay = true;
+ }
+ var openingMessage = "";
+ if(nextDay){
+ openingMessage = "Here's a preview of your schedule tomorrow:";
+ } else if(currentArrayLoc > currentSchedule.length / 2){
+ openingMessage = "Here's what the rest of your day looks like:";
+ } else {
+ openingMessage = "Here's your schedule for today:"
+ }
+
+ document.getElementById("opening-message").innerHTML = openingMessage;
+
+ removeElement("schedule-preview");
+ var widget = document.getElementById("preview-table");
+ var tbl = document.createElement('table');
+ tbl.style.width = '100%';
+ tbl.setAttribute("align", "center");
+ tbl.setAttribute("id","schedule-preview")
+ var tbdy = document.createElement('tbody');
+ var tr = document.createElement('tr');
+ tr.style.textDecoration = "underline";
+ for (var j = 0; j < 2; j++) {
+ var th = document.createElement("th");
+ th.setAttribute("id","t"+j)
+ th.style.fontWeight = "600";
+ if (j === 0) {th.innerHTML= "Time Till";} else {th.innerHTML= "Event";}
+ tr.appendChild(th);
+ }
+ tbdy.appendChild(tr);
+
+ for(var i = myArrayLoc + 1; i < currentSchedule.length - 2; i++) {
+ var currentPeriod = currentSchedule[i];
+ if(!(currentPeriod.title.includes("→") || currentPeriod.title.includes("Bell"))){
+ tr = document.createElement('tr');
+ for (j = 0; j < 2; j++) {
+ var td = document.createElement('td');
+ td.setAttribute("id","td"+i+j);
+ td.setAttribute("align","center");
+
+ if(j == 0){
+ if (nextDay){
+ currentPeriod.startRaw = currentPeriod.startRaw + (3600 * 24);
+ }
+ var minsToClass = toMins(currentPeriod.startRaw - parseRaw());
+ if (minsToClass < 10) {
+ minsToClass = "0" + minsToClass;
+ if (minsToClass < 1) {
+ minsToClass = "01";
+ }
+ }
+ var hrsToClass = toHrs(currentPeriod.startRaw- parseRaw());
+ if (hrsToClass < 1){
+ hrsToClass = "0";
+ }
+ td.innerHTML = "T- " + hrsToClass + ":" + minsToClass;
+ } else {
+ td.innerHTML = currentPeriod.title;
+ }
+ tr.appendChild(td);
+ }
+ tbdy.appendChild(tr);
+ }
+ }
+ tbl.appendChild(tbdy);
+ widget.appendChild(tbl);
+}
+
+function removeElement(elementId) {
+ // Removes an element from the document
+ var element = document.getElementById(elementId);
+ if (element){
+ element.parentNode.removeChild(element);
+ }
+}
+
+function updateMainMessage()
+{
+ if(d.getMonth() === 8 && d.getDay() < 2){
+ mainMessage = "Welcome Back!";
+ if(getCookie("name") != ""){
+ mainMessage = "Welcome Back " + getCookie("name") +"!";
+ }
+ }else{
+ if(d.getHours() <= 5 || d.getHours() > 8){
+ mainMessage = "Goodnight...";
+ }else if (d.getHours() < 12 || d.getHours() >= 8){
+ mainMessage = "Good Morning!";
+ if(getCookie("name") != ""){
+ mainMessage = "Good Morning " + getCookie("name") +"!";
+ }
+ }else if (d.getHours() < 17 || d.getHours() >= 12){
+ mainMessage = "Good Afternoon!";
+ if(getCookie("name") != ""){
+ mainMessage = "Good Afternoon " + getCookie("name") +"!";
+ }
+ }else{
+ mainMessage = "Good Evening!";
+ if(getCookie("name") != ""){
+ mainMessage = "Good Evening " + getCookie("name") +"!";
+ }
+ }
+ }
+
+ if (!(mainMessage === "")) {
+ document.getElementById("message").innerHTML = mainMessage;
+ document.getElementById("message-widget").style.display = "block";
+ }
+}
setInterval(loadTime, 1000);
setInterval(loadDate, 1000);
setInterval(updateD, 1000);
setInterval(update, 1000);
+setInterval(updateMainMessage, 1000);
From b34656628c90b05f200a39ba79c6ed209653ccf1 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 00:49:48 -0400
Subject: [PATCH 23/62] Update index.html
---
index.html | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 96c5b84..c9597c0 100644
--- a/index.html
+++ b/index.html
@@ -62,7 +62,7 @@
-
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20 V1.01
+
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20 V1.13
@@ -75,9 +75,10 @@
-
From 36e6ab2955f8f8ce90d4efc4875fe0d4a3e4de47 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 00:58:52 -0400
Subject: [PATCH 24/62] Assume blanks are frees
---
scheduler/js/scheduler.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index e43c3b3..80fd74e 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,6 +9,9 @@ var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5",
function addCookie(cookname)
{
+ if (cookname === "" && !cookname.includes("name")){
+ cookname = "Free";
+ }
boiyardee.push(cookname);
document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000;path=/";
}
From 68f2aa23dfac29e5b6f8901588ba5eed7f612105 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 01:08:40 -0400
Subject: [PATCH 25/62] Fix Autofill
---
scheduler/js/scheduler.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 80fd74e..daa4a1e 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -9,15 +9,20 @@ var classes = ["m1","m2","m3","m4","m5","m6","m7","m8","t1","t2","t3","t4","t5",
function addCookie(cookname)
{
- if (cookname === "" && !cookname.includes("name")){
- cookname = "Free";
- }
+
boiyardee.push(cookname);
document.cookie = cookname + ";domain=ekkoing.github.io;max-age=31536000;path=/";
}
function bakeCookies(recipe)
{
+ if (recipe.includes(5) || recipe.includes(6)){
+ recipe = "Lunch";
+ }
+ if (recipe === "" && !recipe.includes("name")){
+ recipe = "Free";
+ }
+
addCookie(recipe + "=" + escape(document.getElementById(recipe).value));
}
From 33bf3948ebd9783cc070edbaf9e7f618a1cc6b4c Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 01:14:24 -0400
Subject: [PATCH 26/62] Fix Spacing of Schedule Box
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index c9597c0..dc4615c 100644
--- a/index.html
+++ b/index.html
@@ -76,8 +76,8 @@
From 252de483fd5451d9332f737e9b9eed58143a83f8 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 09:27:14 -0400
Subject: [PATCH 27/62] Update script.js
---
script.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/script.js b/script.js
index 9bb19b0..d53c340 100644
--- a/script.js
+++ b/script.js
@@ -562,14 +562,14 @@ function updateMainMessage()
mainMessage = "Welcome Back " + getCookie("name") +"!";
}
}else{
- if(d.getHours() <= 5 || d.getHours() > 8){
+ if(d.getHours() <= 5 && d.getHours() > 8){
mainMessage = "Goodnight...";
- }else if (d.getHours() < 12 || d.getHours() >= 8){
+ }else if (d.getHours() < 12 && d.getHours() >= 8){
mainMessage = "Good Morning!";
if(getCookie("name") != ""){
mainMessage = "Good Morning " + getCookie("name") +"!";
}
- }else if (d.getHours() < 17 || d.getHours() >= 12){
+ }else if (d.getHours() < 17 && d.getHours() >= 12){
mainMessage = "Good Afternoon!";
if(getCookie("name") != ""){
mainMessage = "Good Afternoon " + getCookie("name") +"!";
From 090cdea343fa8e21f0e681e52525575f61ea2664 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 09:52:25 -0400
Subject: [PATCH 28/62] Update script.js
---
script.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/script.js b/script.js
index d53c340..acb9c4e 100644
--- a/script.js
+++ b/script.js
@@ -562,9 +562,9 @@ function updateMainMessage()
mainMessage = "Welcome Back " + getCookie("name") +"!";
}
}else{
- if(d.getHours() <= 5 && d.getHours() > 8){
+ if(d.getHours() <= 5 && d.getHours() > 20){
mainMessage = "Goodnight...";
- }else if (d.getHours() < 12 && d.getHours() >= 8){
+ }else if (d.getHours() < 12 && d.getHours() >= 5){
mainMessage = "Good Morning!";
if(getCookie("name") != ""){
mainMessage = "Good Morning " + getCookie("name") +"!";
From b2e8bce4b6bb5f66c37fa62d45ff622a02de9a64 Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 10:57:43 -0400
Subject: [PATCH 29/62] Fix autofill
---
scheduler/js/scheduler.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index daa4a1e..0bb260b 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -16,14 +16,15 @@ function addCookie(cookname)
function bakeCookies(recipe)
{
+ var cookieValue = document.getElementById(recipe).value
if (recipe.includes(5) || recipe.includes(6)){
- recipe = "Lunch";
+ cookieValue = "Lunch";
}
- if (recipe === "" && !recipe.includes("name")){
- recipe = "Free";
+ if (cookieValue === "" && !recipe.includes("name")){
+ cookieValue = "Free";
}
- addCookie(recipe + "=" + escape(document.getElementById(recipe).value));
+ addCookie(recipe + "=" + escape(cookieValue));
}
function putCookie()
From 2dc4a60eb9e6d1baf711e410c51b8559ecbbcbfe Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 11:21:14 -0400
Subject: [PATCH 30/62] Update scheduler.js
---
scheduler/js/scheduler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scheduler/js/scheduler.js b/scheduler/js/scheduler.js
index 0bb260b..0f7329f 100644
--- a/scheduler/js/scheduler.js
+++ b/scheduler/js/scheduler.js
@@ -17,7 +17,7 @@ function addCookie(cookname)
function bakeCookies(recipe)
{
var cookieValue = document.getElementById(recipe).value
- if (recipe.includes(5) || recipe.includes(6)){
+ if ((recipe.includes(5) || recipe.includes(6)) && cookieValue === ""){
cookieValue = "Lunch";
}
if (cookieValue === "" && !recipe.includes("name")){
From 132148d9537b4da9cedd34141b1d853c9e0f6a8f Mon Sep 17 00:00:00 2001
From: Nicholas L <33159891+EKKOING@users.noreply.github.com>
Date: Tue, 3 Sep 2019 11:49:57 -0400
Subject: [PATCH 31/62] Update Dev Email
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index dc4615c..adfd3d7 100644
--- a/index.html
+++ b/index.html
@@ -64,7 +64,7 @@
Eric Li ’13, Jiahua Chen ’20, Nicholas Lorentzen ’20 V1.13
-
+