Skip to content

Commit

Permalink
actually make custom schedules work pls no break everything
Browse files Browse the repository at this point in the history
AMEND: Finalize version
  • Loading branch information
ROTARTSI82 committed Aug 18, 2020
1 parent 445eb37 commit 1ea97bd
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 448 deletions.
2 changes: 2 additions & 0 deletions customize-schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ <h5><a href="index.html">← Back to the Bell</a></h5>
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script crossorigin="anonymous" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="scripts/default-schedules.js"></script>

<script src="scripts/customize-logic.js"></script>
</body>
</html>
11 changes: 5 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,17 @@ <h4 class="alert-heading">
</h4>
</div>

<!--
<div class="alert alert-danger" role="alert">
<h5 class="alert-heading">
<button aria-label="Close" class="close" data-dismiss="alert" type="button">
<span aria-hidden="true">&times;</span>
</button>
Welcome to version 3.3! As you may have heard, some classes will not be meeting on certain days,
starting next Monday (May 4). I've added a handy indicator for that! It will also indicate double
periods!
Welcome to version 4! Schedules are now <b>COMPLETELY</b> customizable! Go check it out
by clicking <a href="customize-schedule.html">Customize Schedules!</a>
</h5>
</div> -->
</div>

<h1>Harker Middle School Virtual Bell <span class="badge badge-secondary">v3.3</span></h1>
<h1>Harker Middle School Virtual Bell <span class="badge badge-secondary">v4</span></h1>
<h4>By Grant Yang <a href="mailto:25granty@students.harker.org"
target="_blank"><25granty@students.harker.org></a></h4>
<h5 style="color: yellow">Turn on sound and allow autoplay to hear the bells! If you don't want to hear them,
Expand Down Expand Up @@ -133,6 +131,7 @@ <h5><a href="https://www.github.com/ROTARTSI82/VirtualBell/issues" target="_blan
</div>


<script src="scripts/default-schedules.js"></script>
<script src="scripts/schedules.js"></script>
<script src="scripts/index-logic.js"></script>

Expand Down
31 changes: 0 additions & 31 deletions scripts/customize-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ let rowHtml =
" </div>\n" +
" </td>\n";

let getDefaultSched = function(d) {
switch (d) {
case 0:
return "off_duty";
case 1:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~47~[SE]~Period 2~[SA]~08~[SA]~52~[SE]~Passing Period (2->Meeting)~[SA]~09~[SA]~34~[SE]~Meeting~[SA]~09~[SA]~39~[SE]~Break~[SA]~09~[SA]~59~[SE]~Passing Period (Break->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Office Hours~[SA]~15~[SA]~05~[SE]~Free Time~[SA]~15~[SA]~35";
case 3:
return "OH by Appt.~[SA]~08~[SA]~00~[SE]~Passing Period (?->1)~[SA]~08~[SA]~25~[SE]~Period 1~[SA]~08~[SA]~30~[SE]~Passing Period (1->2)~[SA]~09~[SA]~12~[SE]~Period 2~[SA]~09~[SA]~17~[SE]~Break~[SA]~09~[SA]~59~[SE]~Passing Period (Break->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Free Time~[SA]~15~[SA]~05";
case 2:
case 4:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~47~[SE]~Period 2~[SA]~08~[SA]~52~[SE]~Break~[SA]~09~[SA]~34~[SE]~Passing Period (Break->Advisory)~[SA]~09~[SA]~47~[SE]~Advisory~[SA]~09~[SA]~52~[SE]~Passing Period (Advisory->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Office Hours~[SA]~15~[SA]~05~[SE]~Clubs~[SA]~15~[SA]~20~[SE]~Free Time~[SA]~15~[SA]~35";
case 5:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~46~[SE]~Period 2~[SA]~08~[SA]~51~[SE]~Break~[SA]~09~[SA]~32~[SE]~Passing Period (Break->3)~[SA]~09~[SA]~42~[SE]~Period 4~[SA]~10~[SA]~33~[SE]~L1~[SA]~11~[SA]~14~[SE]~L2~[SA]~11~[SA]~44~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~14~[SE]~Period 5~[SA]~12~[SA]~19~[SE]~Passing Period (5->6)~[SA]~13~[SA]~00~[SE]~Period 6~[SA]~13~[SA]~05~[SE]~Passing Period (6->7)~[SA]~13~[SA]~46~[SE]~Period 7~[SA]~13~[SA]~51~[SE]~Passing Period (7->Assembly)~[SA]~14~[SA]~32~[SE]~Assembly~[SA]~14~[SA]~37~[SE]~Free Time~[SA]~15~[SA]~35";
case 6:
return "off_duty";
}
}

let targetedDay = new Date().getDay();
let nextDay = function() {
if (!saveCustomSched(false)) {
Expand Down Expand Up @@ -71,19 +53,6 @@ let prevDay = function() {

updateDisplayedSched();
}
let getDayStr = function(d) {
switch (d) {
case 0: return "Sunday";
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
default: return "[ERROR: INVALID DAY]";
}
}

let saveCustomSched = function(b) {
if (custBody.children.length <= 0) {
localStorage.setItem(getDayStr(targetedDay) + "-schedule", "off_duty");
Expand Down
31 changes: 31 additions & 0 deletions scripts/default-schedules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
let getDefaultSched = function(d) {
switch (d) {
case 0:
return "off_duty";
case 1:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~47~[SE]~Period 2~[SA]~08~[SA]~52~[SE]~Passing Period (2->Meeting)~[SA]~09~[SA]~34~[SE]~Meeting~[SA]~09~[SA]~39~[SE]~Break~[SA]~09~[SA]~59~[SE]~Passing Period (Break->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Office Hours~[SA]~15~[SA]~05~[SE]~Free Time~[SA]~15~[SA]~35";
case 3:
return "OH by Appt.~[SA]~08~[SA]~00~[SE]~Passing Period (?->1)~[SA]~08~[SA]~25~[SE]~Period 1~[SA]~08~[SA]~30~[SE]~Passing Period (1->2)~[SA]~09~[SA]~12~[SE]~Period 2~[SA]~09~[SA]~17~[SE]~Break~[SA]~09~[SA]~59~[SE]~Passing Period (Break->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Free Time~[SA]~15~[SA]~05";
case 2:
case 4:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~47~[SE]~Period 2~[SA]~08~[SA]~52~[SE]~Break~[SA]~09~[SA]~34~[SE]~Passing Period (Break->Advisory)~[SA]~09~[SA]~47~[SE]~Advisory~[SA]~09~[SA]~52~[SE]~Passing Period (Advisory->3)~[SA]~10~[SA]~10~[SE]~Period 3~[SA]~10~[SA]~15~[SE]~Passing Period (3->4)~[SA]~10~[SA]~57~[SE]~Period 4~[SA]~11~[SA]~02~[SE]~L1~[SA]~11~[SA]~44~[SE]~L2~[SA]~12~[SA]~14~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~44~[SE]~Period 5~[SA]~12~[SA]~49~[SE]~Passing Period (5->6)~[SA]~13~[SA]~31~[SE]~Period 6~[SA]~13~[SA]~36~[SE]~Passing Period (6->7)~[SA]~14~[SA]~18~[SE]~Period 7~[SA]~14~[SA]~23~[SE]~Office Hours~[SA]~15~[SA]~05~[SE]~Clubs~[SA]~15~[SA]~20~[SE]~Free Time~[SA]~15~[SA]~35";
case 5:
return "Passing Period (?->1)~[SA]~08~[SA]~00~[SE]~Period 1~[SA]~08~[SA]~05~[SE]~Passing Period (1->2)~[SA]~08~[SA]~46~[SE]~Period 2~[SA]~08~[SA]~51~[SE]~Break~[SA]~09~[SA]~32~[SE]~Passing Period (Break->3)~[SA]~09~[SA]~42~[SE]~Period 4~[SA]~10~[SA]~33~[SE]~L1~[SA]~11~[SA]~14~[SE]~L2~[SA]~11~[SA]~44~[SE]~Passing Period (L2->5)~[SA]~12~[SA]~14~[SE]~Period 5~[SA]~12~[SA]~19~[SE]~Passing Period (5->6)~[SA]~13~[SA]~00~[SE]~Period 6~[SA]~13~[SA]~05~[SE]~Passing Period (6->7)~[SA]~13~[SA]~46~[SE]~Period 7~[SA]~13~[SA]~51~[SE]~Passing Period (7->Assembly)~[SA]~14~[SA]~32~[SE]~Assembly~[SA]~14~[SA]~37~[SE]~Free Time~[SA]~15~[SA]~35";
case 6:
return "off_duty";
}
}

let getDayStr = function(d) {
switch (d) {
case 0: return "Sunday";
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
default: return "[ERROR: INVALID DAY]";
}
}

51 changes: 20 additions & 31 deletions scripts/index-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,46 +242,35 @@ let intervalHandler = function () {
switch (now.getDay()) {
case (0): { // Sunday
noteDisp.textContent = "It's Sunday! ᕕ( ᐛ )ᕗ";
schoolsOut(1, 8, 5, "Period 1");
updateTable();
break;
}
case (6): { // Saturday
noteDisp.textContent = "It's Saturday! ᕕ( ᐛ )ᕗ";
schoolsOut(2, 8, 5, "Period 1");
updateTable();
break;
}
default: {
updateSchedule();
updateTable();

switch (now.getDay()) {
case (1): {
noteDisp.textContent = "Monday: No History. Meeting.";
break;
}
case (2): {
noteDisp.textContent = "Tuesday: No Science. Clubs.";
break;
}
case (3): {
noteDisp.textContent = "Wednesday: No Math. Double period today! Late Start.";
break;
}
case (4): {
noteDisp.textContent = "Thursday: No Language. Double period today! Clubs.";
break;
}
case (5): {
noteDisp.textContent = "Friday: No English or Expos. Assembly.";
break;
}
}

case (1): {
noteDisp.textContent = "Monday: No History. Meeting.";
break;
}
case (2): {
noteDisp.textContent = "Tuesday: No Science. Clubs.";
break;
}
case (3): {
noteDisp.textContent = "Wednesday: No Math. Double period today! Late Start.";
break;
}
case (4): {
noteDisp.textContent = "Thursday: No Language. Double period today! Clubs.";
break;
}
case (5): {
noteDisp.textContent = "Friday: No English or Expos. Assembly.";
break;
}
}
updateSchedule();
updateTable();

};

Expand Down
Loading

0 comments on commit 1ea97bd

Please sign in to comment.