-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapplication.js
69 lines (66 loc) · 2.33 KB
/
application.js
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
$(document).ready(function(){
//connect to the socket server.
var socket = io.connect('http://' + document.domain + ':' + location.port + '/start');
console.log('http://' + document.domain + ':' + location.port + '/start');
//receive details from server
socket.on('newnumber', function(msg) {
console.log("Received number" + msg.number);
//maintain a list of ten numbers
if (msg.number == 0)
{
result_string = '<b> Thumb UP selected </b>';
setTimeout(function(){
window.location.href = "/ticket_printing";
}, 4000);
}
else if (msg.number == 1) {
result_string = '<b> Thumb DOWN selected </b>';
setTimeout(function(){
window.location.href = "/";
}, 4000);
}
else if (msg.number == 9){
result_string = '<b>No fruit Detected</b>';
setTimeout(function(){
window.location.href = "/";
}, 4000);
}
else if (msg.number == 10) {
result_string = '<b>Tomato Detected </b>';
setTimeout(function(){
window.location.href = "/thumb_video/Tomato";
}, 4000);
}
else if (msg.number == 11) {
result_string = '<b>Apple detected </b>';
setTimeout(function(){
window.location.href = "/thumb_video/Apple";
}, 4000);
}
else if (msg.number == 12) {
result_string = '<b>Banana detected</b>';
setTimeout(function(){
window.location.href = "/thumb_video/Banana";
}, 4000);
}
else if (msg.number == 13) {
result_string = '<b>Mango detected </b>';
setTimeout(function(){
window.location.href = "/thumb_video/Mango";
}, 4000);
}
else if (msg.number == 14) {
result_string = '<b>Several fruits detected </b>';
setTimeout(function(){
window.location.href = "/";
}, 4000);
}
else {
result_string = '<b>No selection found </b>';
setTimeout(function(){
window.location.href = "/fruit_manual_choice";
}, 4000);
}
$('#log').html(result_string);
});
});