-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstuff.js
65 lines (53 loc) · 1.9 KB
/
stuff.js
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
$(document).ready(function() {
var mainDiv = $('#main');
var defaultButton = $('#show-default');
var aboutButton = $('#show-about');
var sponsorsButton = $('#show-sponsors');
var faqButton = $('#show-faq');
var applyButton = $('#show-apply');
var defaultDiv = $('#default-content');
var aboutDiv = $('#about-content');
var sponsorsDiv = $('#sponsors-content');
var faqDiv = $('#faq-content');
var applyDiv = $('#apply-content');
var terminalText = '>Washington University in St. Louis\'s Upsilon Pi Epsilon is hosting a hackathon open to all college students this fall<br>' +
'>The hackathon will run from September 12th — 14th and will have top companies such as Google and Microsoft as sponsors<br>' +
'>Submit an application to register!';
var timer;
function show(div) {
stopTyping();
mainDiv.html(div.html());
}
function startTyping() {
terminal = $('#main .terminal');
var i = 0;
(function addCharacter() {
var delay = Math.random() * 5 + 15;
if (terminalText.charAt(i) == ' ') {
delay += 30;
} else if (terminalText.charAt(i) == '\n') {
}
timer = setTimeout(function() {
terminal.html(terminalText.substring(0, ++i) + '_');
if (i == terminalText.length) {
terminal.html(terminalText);
clearTimeout(timer);
} else {
addCharacter();
}
}, delay);
}());
}
function stopTyping() {
clearTimeout(timer);
terminal = $('#main .terminal');
terminal.text('');
}
defaultButton.click(function() { show(defaultDiv); startTyping(); });
aboutButton.click(function() { show(aboutDiv); });
sponsorsButton.click(function() { show(sponsorsDiv); });
faqButton.click(function() { show(faqDiv); });
applyButton.click(function() { show(applyDiv); });
show(defaultDiv);
startTyping();
});