-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (39 loc) · 1.29 KB
/
index.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
<html>
<head>
<title>Jarvis Voice Detector</title>
</head>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/annyang/2.6.0/annyang.min.js"></script>
<script>
function httpGetAsync(theUrl, callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
if (annyang) {
// Let's define a command.
var commands = {
'Jarvis *message': found,
'Javis *message': found,
'javis *message': found,
'jarvis *message': found
};
function found(message) {
document.write(message + "<br>")
httpGetAsync("http://localhost:3333/" + message, function() {})
}
// Add our commands to annyang
annyang.addCommands(commands);
annyang.debug(function(msg) {
console.log(msg)
});
// Start listening.
annyang.start();
}
</script>
</body>
</html>