-
Notifications
You must be signed in to change notification settings - Fork 3
/
animations.js
72 lines (57 loc) · 1.49 KB
/
animations.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
66
67
68
69
70
71
72
var tenMinsSuggestions = document.getElementById("tenMins"),
thirtyMinsSuggestions = document.getElementById("thirtyMins"),
oneHourSuggestions = document.getElementById("oneHour"),
congrats = document.getElementById("zero-time-wasted"),
FbEndTime,
FbStartTime,
FbTime,
FbMins,
thisSiteMins = -1;
window.onload = function(){
setFbTime();
FbTimer();
keepTime();
};
function setFbTime(){
FbEndTime = new Date().getTime();
FbStartTime = localStorage.getItem("FBtime");
FbTime = FbEndTime - FbStartTime;
FbMins = (Math.round(FbTime/1000/60));
}
function checkTime(i) {
if (i < 10) { i = "0" + i; }
return i;
}
function showThirtyMins(){
hide("tenMins");
show("thirtyMins");
}
function showOneHour(){
hide("thirtyMins");
show("oneHour");
}
function keepTime() {
thisSiteMins++;
thisSiteMins = checkTime(thisSiteMins);
document.getElementById("footer-timer").innerHTML = thisSiteMins;
document.getElementById("wishd-time").innerHTML = thisSiteMins;
setTimeout(keepTime, 1000);
}
function showCongrats(){
hide("tenMins");
hide("headings");
show("zero-time-wasted");
}
function FbTimer(){
if(FbMins===0) showCongrats();
if(FbMins===2) showThirtyMins();
if(FbMins===3) showOneHour();
FbMins = checkTime(FbMins);
document.getElementById("fb-timer").innerHTML = FbMins;
}
function hide(item) {
document.getElementById(item).className += " hidden";
}
function show(item) {
document.getElementById(item).classList.remove("hidden");
}