-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
224 lines (190 loc) · 9.25 KB
/
main.js
File metadata and controls
224 lines (190 loc) · 9.25 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
function loaded(){
//notification
// Notification.requestPermission()
//original
$("#timer").css("visibility","hidden")
// alert("Welcome To The #100DEVS Class Reminder! \n\n There should be an audible warning at 2 minutes before the class starts please let me know if this isnt the case\n\n Created by Imran Mohamed")
alert("Welcome To The #100DEVS Homework countdown of doom! \n\n There should be an audible warning at 2 minutes before the first class of january to remind you that if you havent got your homework done ....well..you ducked up(But it aint the end of the world)\n\n Created by Imran Mohamed")
function clicked(){
$("div").css("visibility", "visible");
$("#reveal").remove()
}
$("#reveal").click(clicked)
/*
classDates
"3 December 2020 23:30 GMT"
"5 December 2020 17:30 GMT"
"12 December 2020 17:30 GMT"
"15 December 2020 23:30 GMT"
"17 December 2020 23:30 GMT"
"19 December 2020 17:30 GMT"
"5 January 2021 23:30 GMT"
"7 January 2021 23:30 GMT"
"9 January 2021 17:30 GMT"
"12 January 2021 23:30 GMT"
"14 January 2021 23:30 GMT"
"16 January 2021 17:30 GMT"
"19 January 2021 23:30 GMT"
"21 January 2021 23:30 GMT"
"23 January 2021 17:30 GMT"
"26 January 2021 23:30 GMT"
"28 January 2021 23:30 GMT"
"30 January 2021 17:30 GMT"
*/
function makeTimer() {
let endTime =new Date("27 May 2021 15:00 GMT");
endTime = (Date.parse(endTime) / 1000);
let now = new Date();
now = (Date.parse(now) / 1000);
let timeLeft = endTime - now;
let days = Math.floor(timeLeft / 86400);
let hours = Math.floor((timeLeft - (days * 86400)) / 3600);
let minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
let seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
if (hours < "10") { hours = "0" + hours; }
if (minutes < "10") { minutes = "0" + minutes; }
if (seconds < "10") { seconds = "0" + seconds; }
$("#days").html(days + "<span>Days</span>");
$("#hours").html(hours + "<span>Hours</span>");
$("#minutes").html(minutes + "<span>Minutes</span>");
$("#seconds").html(seconds + "<span>Seconds</span>");
// if(timeLeft===600){
// let notification = new Notification("Hi there class starts in 10 minutes!");
// Notification.requireInteraction = true;
// }
// if(timeLeft===300){
// let notification = new Notification("Hi there class starts in 5 minutes!");
// Notification.requireInteraction = true;
// }
if(timeLeft<=121&&timeLeft>120){
let audio = new Audio("bensound-scifi.mp3");
audio.loop = true;
audio.play().loop();}
if(timeLeft<=110){
let footer= '<span>Music: <a href="https://www.bensound.com">"Royalty Free Music from Bensound, Name: Sci Fi"</a></span>'
$('footer').html(footer)
}
if(timeLeft===5){
$("h1").text('runUpload()');
}
if(timeLeft===4){
$("h1").text('BINARY UPLOAD.')
}
if(timeLeft===3){
$("h1").text('BINARY UPLOAD..')
}
if(timeLeft===2){
$("h1").text('BINARY UPLOAD...')
}
if(timeLeft===1){
$("h1").text('BINARY UPLOAD....')
}
if (timeLeft<=0) {
let img= '<img src="logo.png" width="100px" height="100px" class="img"></img>'
$("#days").remove();
$("#hours").remove();
$("#minutes").remove();
$("#seconds").remove();
$(".imgSmall").remove()
//main class link
let reveal=img+"Check in on twitter!!"+img+"<h2><a href='https://www.twitch.tv/learnwithleon'>Click here for #100DEVS class!!! </a></h2>"
//alternate/past links
// let reveal=img+img+img+img+img+img+img+img+img+img+img+img+"<h1> Click on your respective houses <a href='https://icebreaker.video/events/ex9Wzbp5qPb3Dhr5osF2'>TURING 8:00pm EST </a><br><a href='https://icebreaker.video/events/U3aXEZDAGhRw1Tjc7pIs'>HOPPER 7:15pm EST</a><br><a href='https://icebreaker.video/events/U9BmGUHBO4Q5HMDhGDEP'>HAMILTON(max 200) 6:30pm EST </a>!!!</h2>"
$("h1").html(reveal)
};
}
setInterval(function() { makeTimer(); }, 1000);
}
// $(function () {
// var dte = new Date();
// let d = document.getElementById('d');
// let m = document.getElementById('m');
// let y = document.getElementById('y');
// let hh = document.getElementById('hh');
// let mm = document.getElementById('mm');
// if (dte.getDay() === 1) {
// d.value = dte.getDate() + 2;
// //d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// m.value = dte.getMonth() + 1;
// //m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// y.value = dte.getFullYear();
// hh.value = 19;
// mm.value = 30;
// } else if (dte.getDay() === 2) {
// d.value = dte.getDate() + 1;
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// y.value = dte.getFullYear();
// hh.value = 19;
// mm.value = 30;
// } else if (dte.getDay() === 3) {
// d.value = dte.getDate();
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// y.value = dte.getFullYear();
// hh.value = 19;
// mm.value = 30;
// } else if (dte.getDay() === 0){
// y.value = dte.getFullYear();
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// d.value = dte.getDate();
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// hh.value = 17;
// mm.value = '00';
// } else if (dte.getDay() === 4){
// y.value = dte.getFullYear();
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// d.value = dte.getDate() + 3;
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// hh.value = 17;
// mm.value = '00';
// }else if (dte.getDay() === 5){
// y.value = dte.getFullYear();
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// d.value = dte.getDate() + 2;
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// hh.value = 17;
// mm.value = '00';
// }else if (dte.getDay() === 6){
// y.value = dte.getFullYear();
// m.value = dte.getMonth() + 1;
// // m.value = m.value > 12 ? alert('Something is not right with the month \nPlease check and correct Manually') : m.value;
// d.value = dte.getDate() + 1;
// // d.value = d.value > 31 ? alert('Something is not right with the date \nPlease check and correct Manually') : d.value;
// hh.value = 17;
// mm.value = '00';
// } else {
// y.value = dte.getFullYear();
// m.value = dte.getMonth() + 1;
// d.value = dte.getDate() + 1;
// hh.value = 23;
// mm.value = 59;
// }
// var calcNewYear = setInterval(function () {
// date_future = new Date(y.value, m.value - 1, d.value, hh.value, mm.value);
// date_now = new Date();
// seconds = Math.floor((date_future - (date_now)) / 1000);
// minutes = Math.floor(seconds / 60);
// hours = Math.floor(minutes / 60);
// days = Math.floor(hours / 24);
// hours = hours - (days * 24);
// hours = hours < 10 ? '0' + hours : hours;
// minutes = minutes - (days * 24 * 60) - (hours * 60);
// minutes = minutes < 10 ? '0' + minutes : minutes;
// seconds = seconds - (days * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
// seconds = seconds < 10 ? '0' + seconds : seconds;
// if (y.value !== '' && m.value !== '' && d.value !== '' && hh.value !== '' && mm.value !== '' && date_now < date_future) {
// $("#time").html("<h2 id='heading2'>Remaining Time For Next Session</h2> <p id='timeLeft'>" + days + "<span class='red'>D </span>: " + hours + "<span class='red'>H</span> : " + minutes + "<span class='red'>M</span> : " + seconds + "<span class='red'>S</span> </p>")
// } else if (date_future < date_now) {
// $('#time').html("<h2 id='heading2'>Date/Time Cannot be Less than Current Date/Time nor can be Blank</h2>");
// }
// else {
// $('#time').html("<h2 id='heading2'>CountDown Rules: </h2> <ul id='white'><li>Date/Time Cannot be Blank</li><li>Date/Time Cannot be Past Date.");
// }
// }, 1000);
// });