-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
44 lines (40 loc) · 2.14 KB
/
script.js
File metadata and controls
44 lines (40 loc) · 2.14 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
toSupervisor = document.getElementById("toSupervisor")
toUser = document.getElementById("toUser")
supervisor = document.getElementById("supervisor")
user = document.getElementById("user")
speech = document.getElementById('speech')
speechDisplay = document.getElementById('speechDisplay')
pastEmotion = document.getElementById('pastEmotion')
currentEmotion = document.getElementById('currentEmotion')
happyImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/beaming-face-with-smiling-eyes_1f601.png">'
sadImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/crying-face_1f622.png">'
fearImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/fearful-face_1f628.png">'
angerImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/pouting-face_1f621.png">'
surpriseImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/face-with-open-mouth_1f62e.png">'
disgustImage = '<img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/325/face-vomiting_1f92e.png">'
speech.onkeydown = function(e){
if(e.keyCode == 13){
alert("Sent!")
speechDisplay.placeholder = speech.value
radio = document.querySelector('input[name="emotion"]:checked')
if (radio.value == "happy") {
currentEmotion.innerHTML = happyImage;
pastEmotion.innerHTML += happyImage;
} else if (radio.value == "sad") {
currentEmotion.innerHTML = sadImage;
pastEmotion.innerHTML += sadImage;
} else if (radio.value == "fear") {
currentEmotion.innerHTML = fearImage;
pastEmotion.innerHTML += fearImage;
} else if (radio.value == "anger") {
currentEmotion.innerHTML = angerImage;
pastEmotion.innerHTML += angerImage;
} else if (radio.value == "surprise") {
currentEmotion.innerHTML = surpriseImage;
pastEmotion.innerHTML += surpriseImage;
} else if (radio.value == "disgust") {
currentEmotion.innerHTML = disgustImage;
pastEmotion.innerHTML += disgustImage;
}
}
};