-
Notifications
You must be signed in to change notification settings - Fork 1
/
jndex-v.0.1.html
223 lines (211 loc) · 5.33 KB
/
jndex-v.0.1.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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<html>
<head>
<title> Title? Fuck you! </title>
<script type="text/javascript">
/*
1559149381976,size,s
1559149394981,speed,slow
1559149407986,speed,fast
1559149421987,duration,zero
1559149426991,shape,curvy
1559149437995,duration,zero
1559149448001,shape,wave
1559149456004,speed,a.f.a.p
1559149461005,direction,chaotic
1559149471007,texture,minimal
1559149481011,shape,linear
1559149495014,shape,twisted
1559149506016,size,xl
1559149514018,level,low
1559149527023,direction,left
1559149535030,duration,forever
1559149541033,speed,fast
1559149546037,level,fly
1559149552041,direction,give 'n' take
1559149557041,polarity,right
1559149570045,shape,spiral
1559149581050,duration,slong
1559149593054,speed,slow
1559149600057,level,standing
1559149607059,polarity,positive
1559149614062,direction,down
1559149626064,level,low
1559149636041,texture,thick
1559149648071,shape,linear
1559149656104,level,low
1559149664154,shape,cubic
1559149676207,shape,zero
1559149683254,speed,a.f.a.p
1559149690287,texture,sliding
1559149698323,size,s
1559149709328,level,high
1559149723331,shape,zero
1559149729334,polarity,positive
1559149737339,duration,normal
1559149751345,level,flat
1559149763350,level,low
1559149776353,speed,cockain
1559149781357,speed,death
1559149794359,level,high
1559149799363,polarity,down
1559149808365,level,medium
1559149816368,texture,condenced
1559149821372,texture,hitting
1559149827378,speed,chill
1559149841382,speed,death
1559149850384,size,l
1559149855385,size,s
*/
// @flow
const cats = new Map([
["direction", [
"front",
"back",
"down",
"up",
"left",
"right",
"diagonal",
"rotating",
"reverse",
"undefined",
"give 'n' take",
"contra",
]],
["duration", [
"forever",
"slong",
"long",
"normal",
"short",
"very short",
]],
["level",[
"high",
"standing",
"medium",
"low",
"all fours",
"flat",
]],
["polarity", [
"positive",
"negative",
"up",
"down",
"left",
"right",
]],
["shape", [
"circular",
"cross",
"cubic",
"edgy",
"linear",
"spiral",
"tilt",
"twisted",
"wave",
"gesture",
"point",
]],
["size", [
"xs",
"s",
"m",
"l",
"xl",
]],
["speed", [
"cocaine",
"fast",
"hurry",
"normal",
"chill",
"super slow",
]],
])
const duration_min = 5
const duration_span = 10
const synth = window.speechSynthesis;
const text = "Hello, V.0.1. If you are wondering what the hell is going on, check this shit out"
const get_display = () => document.getElementById('display')
const get_logstash = () => document.getElementById('stash')
const get_sleeping_display = () => document.getElementById('sleeping_display')
function db(text) {
return
const child = document.createElement("pre")
child.innerText = text
get_display().appendChild(child)
}
function say(text) {
db(text)
const utter = new SpeechSynthesisUtterance(text)
synth.speak(utter)
}
window.resizeTo(800, 600)
window.onload = (e) => {
say(text)
}
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
/**
* @param ts {number}
* @param cat {string}
* @param val {string}
*/
function log_entry(ts, cat, val) {
get_logstash().innerText += `\n${ts},${cat},${val}`
}
/**
* @param secs {number}
*/
function update_sleeping(secs) {
var tick = 0
const disp = get_sleeping_display()
const update = () => { disp.innerText = (secs - tick).toString() }
const recur = () => {
if (tick !== secs) {
update()
tick += 1
setTimeout(recur, 1000)
}
}
recur()
}
function start_talking_shit() {
const cati = getRandomInt(cats.size)
const cat = Array.from(cats.keys())[cati]
const vals = cats.get(cat)
const vali = getRandomInt(vals.length)
const val = vals[vali]
const wait = (duration_min + getRandomInt(duration_span))
const ts = Date.now()
log_entry(ts, cat, val)
say(`${cat}: ${val}`)
db(`sleeping ${wait} seconds...`)
update_sleeping(wait)
setTimeout(start_talking_shit, wait * 1000)
}
</script>
</head>
<body>
<div id="display">
Hello, V.0.1.
</div>
<div>
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API#Demo_2">
this shit
</a>
</div>
<p>
CLICK ME ==> <span onclick="start_talking_shit()">Start talking shit</span> <== CLICK ME
</p>
<p id="sleeping_display" style="text-align: center; font-size: 1.3em">
</p>
<pre id="stash">
# || Timestamp (ms) || Category || Value ||
</pre>
</body>
</html>