Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cybermajeed authored Sep 25, 2023
1 parent 864002d commit 2f70150
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ body {
left: 0;
align-items: center;
justify-content: center;
background: #ffffffb4;
background: #000000d0;
width: 100%;
height: 100%;
margin: 0;
Expand Down
80 changes: 73 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ changeSize();
//------------

//notify
function today() {
const days = ["monday", "tuesday", "wednesday", "thursday", "friday"];
}

const days = [
"sunday",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
];
function showNotification(periodNum, today) {
const newNotif = new Notification("Time for class!!!", {
body: `${timetables[`${userName}`][`${today}`][periodNum]}`,
Expand All @@ -89,14 +96,73 @@ function showNotification(periodNum, today) {
Notification.requestPermission().then((permission) => {
if (permission == "granted") {
setInterval(() => {
let hour = new Date().getHours() - 12,
mins = new Date().getMinutes() - 12;
let hour = new Date().getHours(),
mins = new Date().getMinutes(),
today = new Date().getDay();
// mon,tue,wed,thur
if (!(today() in [0 /*sun*/, 5 /*fri*/, 6 /*sat*/])) {
if (!(today in [0 /*sun*/, 5 /*fri*/, 6 /*sat*/])) {
//period 1
if ([hour, mins].join() == [8, 15].join()) {
//showNotification(periodNum, day);
showNotification(1, today());
showNotification(1, days[today]);
}
//period 2
else if ([hour, mins].join() == [8, 55].join()) {
//showNotification(periodNum, day);
showNotification(2, days[today]);
}
//period 3
else if ([hour, mins].join() == [9, 35].join()) {
//showNotification(periodNum, day);
showNotification(3, days[today]);
}
//period 4
else if ([hour, mins].join() == [10, 30].join()) {
//showNotification(periodNum, day);
showNotification(4, days[today]);
}
//period 5
else if ([hour, mins].join() == [11, 10].join()) {
//showNotification(periodNum, day);
showNotification(5, days[today]);
}
//period 6
else if ([hour, mins].join() == [12, 5].join()) {
//showNotification(periodNum, day);
showNotification(6, days[today]);
}
//period 7
else if ([hour, mins].join() == [12, 45].join()) {
//showNotification(periodNum, day);
showNotification(7, days[today]);
}
//period 8
else if ([hour, mins].join() == [13, 25].join()) {
//showNotification(periodNum, day);
showNotification(8, days[today]);
}
}
//fri
if (today == 5) {
//period 1
if ([hour, mins].join() == [8, 20].join()) {
//showNotification(periodNum, day);
showNotification(1, days[today]);
}
//period 2
if ([hour, mins].join() == [9, 5].join()) {
//showNotification(periodNum, day);
showNotification(1, days[today]);
}
//period 3
if ([hour, mins].join() == [10, 5].join()) {
//showNotification(periodNum, day);
showNotification(1, days[today]);
}
//period 4
if ([hour, mins].join() == [10, 50].join()) {
//showNotification(periodNum, day);
showNotification(1, days[today]);
}
}
}, 2000);
Expand Down
17 changes: 17 additions & 0 deletions timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,22 @@ const timetables = {
fri: ["", "12A", "", ""],
},
};
/*
timing
1 - 8:15
2 - 8:55
3 - 9:35
4 - 10:30
5 - 11:10
6 - 12:05
7 - 12:45
8 - 13:25
fri
1 - 8:20
2 - 9:05
3 - 10:05
4 - 10:50
*/

export default timetables;

0 comments on commit 2f70150

Please sign in to comment.