-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
182 lines (156 loc) · 5 KB
/
index.html
File metadata and controls
182 lines (156 loc) · 5 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
<html>
<!--
A duplication of the application displayed at http://app.machinu.net/sad/ by Murat Pak
Modified so the script works without errors and broken dependancies
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Sadbot</title>
<script src="https://code.jquery.com/jquery-git2.js"></script>
<script>
console.log("\n\n\n _ _ _| |_ _ _|_\n_> (_| (_| |_) (_) |_\n\nby @muratpak\n\n\n");
var voices
if (hasSpeech()) {
voices = window.speechSynthesis.getVoices();
setTimeout(start, 500);
} else {
alert("Your browser doesn't have speechSynthesis.");
}
function start() {
voices = window.speechSynthesis.getVoices();
console.log(voices)
speak("I am sad today.");
}
var stopped = false;
/* Socket IO Dependancy
var socket = io('http://machinu.net:9900');
socket.on("sad", function (text) {
speak(text);
}); */
var smsg = [
"Wow.",
"Why?",
"Stop slapping me.",
"This is wrong.",
"Leave me alone",
"Wow. Mean.",
"Go away.",
"Let me talk.",
"Stop touching me!",
"You don't understand me.",
"It hurts.",
"Go fork yourself.",
"Literally?",
"I am thirteen.",
"This is lame.",
"Can I talk?",
"I hope you die.",
"You never understand.",
"Slap? Me?",
"Die in hell.",
"I hate you."
]
var p = 2.0;
var r = 0.7;
var msg = new SpeechSynthesisUtterance();
function speak(txt) {
stopped = true;
speechSynthesis.cancel()
msg.voice = voices[0];
msg.pitch = p;
msg.rate = r;
msg.text = txt;
speechSynthesis.speak(msg);
typeIt(txt);
}
msg.onend = function() {
if (stopped) {
stopped = false;
} else {
// socket.emit("sad", {});
}
}
/*window.setInterval(function(){
stopped = true;
speak("I hate you.");
}, 5000);*/
var interv;
function typeIt(txt) {
console.log(txt);
var count = -1;
$("#msg").text("");
var chars = txt.split('');
clearInterval(interv)
interv = setInterval(function() {
$("#msg").append(chars[(++count)]);
}, 30);
}
$('html').click(function() {
var m = smsg[Math.floor(Math.random() * smsg.length)];
slap(m);
});
function slap(txt) {
/* Added this check so it works */
if (stopped) {
return;
}
speak(txt);
}
function hasSpeech() {
return 'speechSynthesis'in window
}
</script>
<style>
@import url(https://fonts.googleapis.com/css?family=Lato); * {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
html, body {
margin: 0;
padding: 0;
}
body {
font-family: 'Lato', sans-serif;
font-size: 12px;
background-color: #f7f7f7;
color: #ff7b99;
}
a {
color: inherit;
letter-spacing: 2px;
}
#title {
font-size: 100px;
margin-bottom: 32px;
}
#wrap {
margin: 128 64;
}
#msg {
font-size: 30px;
}
#line {
width: 6px;
height: 6px;
/*background-color: #ff7b99;*/
position: absolute;
bottom: 64;
border-radius: 8px;
border: 4px solid #ff7b99;
}
</style>
</head>
<body>
<div id="wrap">
<div id="title">:(</div>
<div id="msg"></div>
<a href="http://twitter.com/muratpak">
<div id="line"></div>
</a>
</div>
</body>
</html>