Skip to content

Commit

Permalink
1.2.1 Update
Browse files Browse the repository at this point in the history
Updated schedules for the 2021-22 school year.

Fixed schedule overrides.
Fixed points display.
ezzhang8 committed Sep 13, 2021
1 parent 26c637e commit e26eac3
Showing 4 changed files with 81 additions and 62 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "STMC Chrome Extension",
"description": "Live block rotation checker, calendar, quick resource links, and notifications.",
"version": "1.2",
"version": "1.2.1",
"icons": {"128":"res/imgs/icons/icon_128.png"},
"browser_action": {
"default_icon": "res/imgs/icons/icon.png",
4 changes: 2 additions & 2 deletions popup.html
Original file line number Diff line number Diff line change
@@ -258,8 +258,8 @@ <h3 class="main-header">Settings</h3>
<div class="uk-text-center">
<br>
<img width="64px" src="res/imgs/icons/icon_128.png"></img>
<h5 class="main-header">STMC App for Chrome v1.2</h5>
<h6 class="main-header">9/7/2021</h6>
<h5 class="main-header">STMC App for Chrome v1.2.1</h5>
<h6 class="main-header">9/13/2021</h6>
<h5>Developed and coded by Eric Zhang ('22)</h5>
<h5>House crests designed by Charlotte Cho ('21)</h5>
<h5>Calendar API by Philip Stachura ('19)</h5>
23 changes: 13 additions & 10 deletions res/js/explore.js
Original file line number Diff line number Diff line change
@@ -53,16 +53,19 @@ async function newSchedule() {
let dayMatrix = structureScheduleData(events);

for (schedule of overrides) {
let dateData = schedule.date.split("-")
let overrideDate = new Date(parseInt(dateData[0]), parseInt(dateData[1])-1, parseInt(dateData[2]))


for (found of dayMatrix) {
if (found.date == overrideDate.toDateString()) {
found.schedule = schedule.blockRotation;
found.label = schedule.scheduleType;
found.override = schedule.schedule;
if (!schedule.scheduleType.includes(".")) {
let dateData = schedule.date.split("-")
let overrideDate = new Date(parseInt(dateData[0]), parseInt(dateData[1])-1, parseInt(dateData[2]))


for (found of dayMatrix) {
if (found.date == overrideDate.toDateString()) {
found.schedule = schedule.blockRotation;
found.label = schedule.scheduleType;
found.override = schedule.schedule;
}
}

}
}

@@ -141,7 +144,7 @@ function loadHouses() {

const houseTable = document.getElementById("house-table")
for (i=0; i<housePoints.length; i++) {
houseTable.insertAdjacentHTML('beforeend', '<tr><td style="width: 20%; text-align: center"><img class="crest left" src="res/imgs/house/'+housePoints[i].houseName.toLowerCase()+`.png"><div class="other-bg score-div" style="width: ${(housePoints[i].points/housePoints[0].points)*98}%;"><h5 class="house-title small-header white left"><a class="white" id="house-`+housePoints[i].houseId+'">'+housePoints[i].houseName+'</a></h5><span class="score-span right white">'+housePoints[i].points+' pts.</span></div></td></tr>')
houseTable.insertAdjacentHTML('beforeend', '<tr><td style="width: 20%; text-align: center"><img class="crest left" src="res/imgs/house/'+housePoints[i].houseName.toLowerCase()+`.png"><div class="other-bg score-div" style="width: ${(Math.max(housePoints[i].points/housePoints[0].points, 0.75)*98)}%;"><h5 class="house-title small-header white left"><a class="white" id="house-`+housePoints[i].houseId+'">'+housePoints[i].houseName+'</a></h5><span class="score-span right white">'+housePoints[i].points+' pts.</span></div></td></tr>')

document.getElementById("house-"+housePoints[i].houseId).addEventListener('click', (event)=> {
showHouseTab(parseInt(event.target.id.substr(-1)));
114 changes: 65 additions & 49 deletions res/js/schedule.js
Original file line number Diff line number Diff line change
@@ -2,58 +2,69 @@
Declares all 4 schedule variants.
*/

const regularSchedule = {
"Morning X Block": "7:00-8:15",
"1st Block": "8:25-9:40",
"2nd Block": "9:45-11:00",
"Break": "11:00-11:15",
"3rd Block": "11:20-12:35",
"Lunch": "12:35-1:20",
"4th Block": "1:25-2:40",
"Afternoon Y Block": "2:45-4:00"
const regularSchedule = (schedule) => {
return {
"Morning X Blocks": "7:00-8:15",
"Warning Bell": "8:20",
["Block " + schedule.charAt(0)]: "8:25-9:45",
["Block " + schedule.charAt(1)]: "9:50-11:05",
"Break": "11:05-11:15",
["Block " + schedule.charAt(2)]: "11:20-12:35",
"Lunch": "12:35-1:20",
["Block " + schedule.charAt(3)]: "1:25-2:40",
"Afternoon Y Blocks": "2:45-4:00"
}
};

const lateStart = {
"Morning X Block": "7:00-8:10",
"Staff Meeting/PLC": "8:15-9:10",
"1st Block": "9:20-10:25",
"2nd Block": "10:30-11:35",
"Lunch": "11:35-12:20",
"3rd Block": "12:25-1:30",
"4th Block": "1:35-2:40",
"Afternoon Y Block": "2:45-4:00"
const lateStart = (schedule) => {
return {
"Morning X Blocks": "7:00-8:10",
"PLC/Staff Meetings": "8:20-9:05",
"Warning Bell": "9:10",
["Block " + schedule.charAt(0)]: "9:20-10:25",
["Block " + schedule.charAt(1)]: "10:35-11:35",
["Block " + schedule.charAt(2)]: "11:40-12:45",
"Lunch": "12:45-1:30",
["Block " + schedule.charAt(3)]: "1:35-2:40",
"Afternoon Y Blocks": "2:45-4:00"
}
};

const academicAssembly = {
"Morning X Block": "7:00-8:15",
"1st Block": "8:25-9:25",
"2nd Block": "9:30-10:30",
"Break": "10:30-10:45",
"3rd Block": "10:50-11:50",
"Lunch": "11:50-12:40",
"A/A Block": "12:45-1:35",
"4th Block": "1:40-2:40",
"Afternoon Y Block": "2:45-4:00"
const academicAssembly = (schedule) => {
return {
"Morning X Blocks": "7:00-8:15",
"Warning Bell": "8:20",
["Block " + schedule.charAt(0)]: "8:25-9:30",
["Block " + schedule.charAt(1)]: "9:35-10:40",
"Break": "10:40-10:50",
["Block " + schedule.charAt(2)]: "10:55-12:00",
"Lunch": "12:00-12:40",
"Career Ed ": "12:45-1:35",
["Block " + schedule.charAt(3)]: "1:35-2:40",
"Afternoon Y Blocks": "2:45-4:00"
}
};
const massSchedule = {
"Morning X Block": "7:00-8:15",
"1st Block": "8:25-9:25",
"Break": "9:25-9:35",
"2nd Block": "9:40-10:40",
"Mass": "10:45-11:45",
"Lunch": "11:45-12:30",
"3rd Block": "12:35-1:35",
"4th Block": "1:40-2:40",
"Afternoon Y Block": "2:40-4:00"
const massSchedule = (schedule) => {
return {
"Morning X Blocks": "7:00-8:15",
"Warning Bell": "8:20",
["Block " + schedule.charAt(0)]: "8:25-9:35",
["Block " + schedule.charAt(1)]: "9:40-10:45",
"Break": "10:45-10:55",
["Block " + schedule.charAt(2) + " & Mass"]: "11:00-12:50",
"Lunch": "12:50-1:30",
["Block " + schedule.charAt(3)]: "1:35-2:40",
"Afternoon Y Block": "2:40-4:00"
}
};


let currentScheduleIncrement = 0;

document.getElementById("schedule-prev").addEventListener("click", function() {
document.getElementById("schedule-prev").addEventListener("click", () => {
paginator(-1);
})
document.getElementById("schedule-next").addEventListener("click", function() {
document.getElementById("schedule-next").addEventListener("click", () => {
paginator(1);
})

@@ -162,15 +173,18 @@ async function advanceSchedule(dateForward) {
console.log(schoolDate);

for (schedule of overrides) {
let dateData = schedule.date.split("-")
let overrideDate = new Date(parseInt(dateData[0]), parseInt(dateData[1])-1, parseInt(dateData[2]))
if (!schedule.scheduleType.includes(".")) {

let dateData = schedule.date.split("-")
let overrideDate = new Date(parseInt(dateData[0]), parseInt(dateData[1])-1, parseInt(dateData[2]))


for (found of dayMatrix) {
if (found.date == overrideDate.toDateString()) {
found.schedule = schedule.blockRotation;
found.label = schedule.scheduleType;
found.override = schedule.schedule;
for (found of dayMatrix) {
if (found.date == overrideDate.toDateString()) {
found.schedule = schedule.blockRotation;
found.label = schedule.scheduleType;
found.override = schedule.schedule;
}
}
}
}
@@ -191,12 +205,14 @@ async function advanceSchedule(dateForward) {
}

if (dayMatrix[dateForward].override == undefined) {
loadSchedule(scheduleJSON[dayMatrix[dateForward].label]);
loadSchedule(scheduleJSON[dayMatrix[dateForward].label](dayMatrix[dateForward].schedule));
}
else {
const table = document.getElementById("schedule-table");
table.innerHTML = "";
for (row of dayMatrix[dateForward]["schedule"+scheduleMode]) {
console.log(dayMatrix[dateForward]);

for (row of dayMatrix[dateForward]["override"]) {
table.insertAdjacentHTML("beforeend", '<tr><td>' + row.name + '</td><td>' + row.timeSlot + '</td></tr>')

}

0 comments on commit e26eac3

Please sign in to comment.