-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
120 lines (92 loc) · 2.79 KB
/
Copy pathmain.js
File metadata and controls
120 lines (92 loc) · 2.79 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
$(document).ready(function () {
$('.text').textillate({
loop: true,
sync: true,
in: {
effect: "bounceIn",
},
out: {
effect: "bounceOut",
},
});
// Siri configuration
var siriWave = new SiriWave({
container: document.getElementById("siri-container"),
width: 800,
height: 200,
style: "ios9",
amplitude: "1",
speed: "0.30",
autostart: true
});
// Siri message animation
$('.siri-message').textillate({
loop: true,
sync: true,
in: {
effect: "fadeInUp",
sync: true,
},
out: {
effect: "fadeOutUp",
sync: true,
},
});
// mic button click event
$("#MicBtn").click(function () {
eel.playAssistantSound()
$("#Oval").attr("hidden", true);
$("#SiriWave").attr("hidden", false);
eel.allCommands()()
});
function doc_keyUp(e) {
// this would test for whichever key is 40 (down arrow) and the ctrl key at the same time
if (e.key === 'j' && e.metaKey) {
eel.playAssistantSound()
$("#Oval").attr("hidden", true);
$("#SiriWave").attr("hidden", false);
eel.allCommands()()
}
}
document.addEventListener('keyup', doc_keyUp, false);
// to play assisatnt
function PlayAssistant(message) {
if (message != "") {
$("#Oval").attr("hidden", true);
$("#SiriWave").attr("hidden", false);
eel.allCommands(message);
$("#chatbox").val("")
$("#MicBtn").attr('hidden', false);
$("#SendBtn").attr('hidden', true);
}
}
// toogle fucntion to hide and display mic and send button
function ShowHideButton(message) {
if (message.length == 0) {
$("#MicBtn").attr('hidden', false);
$("#SendBtn").attr('hidden', true);
}
else {
$("#MicBtn").attr('hidden', true);
$("#SendBtn").attr('hidden', false);
}
}
// key up event handler on text box
$("#chatbox").keyup(function () {
let message = $("#chatbox").val();
ShowHideButton(message)
});
// send button event handler
$("#SendBtn").click(function () {
let message = $("#chatbox").val()
PlayAssistant(message)
});
// enter press event handler on chat box
$("#chatbox").keypress(function (e) {
key = e.which;
if (key == 13) {
let message = $("#chatbox").val()
PlayAssistant(message)
}
});
});