forked from geraldwuhoo/heyhaveyouheardthisnewsong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhey.html
97 lines (95 loc) · 3.44 KB
/
hey.html
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
<!-- This may actually be the absolute worst, most horrendous code I've written in my life
Stop judging me Kevin-->
<html>
<head>
<title>Hey, have you heard this new song?</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js"></script>
<script type="text/javascript">
var lyrics = "Hey, I was doing just fine before I met you\n" +
"I drink too much and that's an issue\n" +
"But I'm okay.\n" +
"Hey, you tell your friends it was nice to meet them\n" +
"But I hope I never see them again\n" +
"I know it breaks your heart\n" +
"Moved to the city in a broke down car and\n" +
"Four years no calls\n" +
"Now you're looking pretty in a hotel bar\n" +
"And I-I-I-I-I can't stop\n" +
"No, I-I-I-I-I can't stop.\n" +
"So baby pull me closer\n" +
"In the backseat of your rover\n" +
"That I know you can't afford\n" +
"Bite that tattoo on your shoulder\n" +
"Pull the sheets right off the corner\n" +
"Of the mattress that you stole\n" +
"From your roommate back in boulder\n" +
"We ain't ever getting older\n" +
"Doo doo DOO doodoodoo doodoo doodoo DOO doodoo doodoodoo\n" +
"You look as good as the day I met you\n" +
"I forget just why I left you, I was insane\n" +
"Stay and play that Blink-182 song\n" +
"That we beat to death in Tuscon, okay\n" +
"I know it breaks your heart\n" +
"Moved to the city in a broke down car and\n" +
"Four years no calls\n" +
"Now I'm looking pretty in a hotel bar\n" +
"And I-I-I-I-I can't stop\n" +
"No, I-I-I-I-I can't stop\n" +
"So baby pull me closer\n" +
"In the backseat of your rover\n" +
"That I know you can't afford\n" +
"Bite that tattoo on your shoulder\n" +
"Pull the sheets right off the corner\n" +
"Of the mattress that you stole\n" +
"From your roommate back in boulder\n" +
"We ain't ever getting older"
var hello = lyrics.split("\n");
var counter = 1;
function keyPress(e) {
e = e || window.event;
if (e.keyCode == 13)
{
document.getElementById("button1").click();
return false;
}
return true;
}
function checkLyric() {
var userResponse = document.getElementById("userInput").value;
if(2*counter >= hello.length) {
if(2*counter == hello.length) {
if(userResponse == "We ain't ever getting older") {
document.getElementById("bodyLyrics").innerHTML += userResponse + "<br /><br />";
counter++;
}
else {
alert("Are you bad?");
}
}
document.getElementById("bodyLyrics").innerHTML += "<b>hey that's pretty good</b><br /><br />";
}
else {
if(userResponse == hello[2*counter-1]) {
document.getElementById("bodyLyrics").innerHTML += userResponse + "<br /><br />";
document.getElementById("bodyLyrics").innerHTML += "<b>" + hello[2*counter] + "</b><br /><br />";
document.getElementById("userInput").value = "";
counter++;
}
else {
alert("Are you bad?");
}
}
window.scrollTo(0,document.body.scrollHeight);
}
</script>
</head>
<body>
<p id="bodyLyrics">
<b>Hey, I was doing just fine before I met you</b><br /><br />
</p>
<br />
Your response:
<input name="userInput" type="text" maxlength="1024" id="userInput" onkeypress="return keyPress(event);"/>
<input type="submit" name="button" id="button1" onclick="checkLyric()" value="Enter" />
</body>
</html>