forked from hackthepart/Jarvis
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.js
145 lines (118 loc) · 4.15 KB
/
script.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
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
$(function(){
//deleteAllCookies();
//alert(document.cookie.length);
//document.cookie.clear();
if(sessionStorage.jarvis != "1")
{
jarvis_intro();
sessionStorage.clear();
sessionStorage.setItem("jarvis","1");
}
else
{
$("#cover").remove();
}
$("#incomplete").animate({
'left':'5%',
'top':'5%'
});
$("#complete").animate({
'right':'5%',
'top':'5%'
});
$("#taskAdder").animate({
'top':'40%'
});
for(i=1;i<=document.cookie.length;i++)
{
$("#todoTable").append('<tr><td>' + getCookie("task"+i) + '</td></tr>');
}
});
function jarvis_intro()
{
audio = new Audio();
audio.src = "Robotic_Countdown.mp3";
audio.play();
intro = new Audio();
intro.src = "I_am_jarvis.mp3";
assist = new Audio();
assist.src = "jarvis_assist.mp3";
$("#cover").animate({
backgroundColor:"#000000"
});
setTimeout(function()
{
$('#counter').fadeIn();
var c = 5;
$("#cv").html(c);
setInterval(function()
{
if(c > 1)
{
$('#cv').html(--c);
}
else
{
clearInterval();
}
},1000);
},4000)
setTimeout(function(){
$('#cover').html('<h1>ENTER THE PASSWORD</h1><div id="pword"><input type="password" id="pass" class="input" /><button id="btn" class="addBtn" style="border: none;">Enter</button></div>');
$("#btn").click(function()
{
if($("#pass").val() == "1234")
{
intro.play();
$("#cover").html('<span style="font-size: 500%;" id="jar">I AM JARVIS.<br/> <br/>I AM HERE TO ASSIST YOU.</span>');
setTimeout(function(){
assist.play();
$("#cover>span").append("<br/><br/>WITH VARITIES OF TASKS.");
setTimeout(function()
{
$("#cover>span").append("<br/>24 HRS A DAY 7 DAYS A WEEK.");
},3500);
},4000);
setTimeout(function()
{
$("#cover").remove();
},10000);
}
});
},8500);
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
// This function creates a new list item when `add button` is clicked
function newElement() {
var li = document.createElement("li");
var inputValue = document.getElementById("myInput").value;
if(/\S/.test(inputValue)) // Checking if the task field is empty.
{
c = (document.cookie.length + 1);
setCookie("task"+c,inputValue,1);
$("#todoTable").append('<tr><td>' + inputValue + '</td></tr>');
}
else
{
alert("Please Enter Some Task.");
}
}