-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsock.html
63 lines (53 loc) · 1.66 KB
/
sock.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
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Smaki - Maki - Mooki</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
</head>
<body>
<script src="/socket.io/socket.io.js"></script>
<KBD><p>Message From Server:</p></KBD>
<p><KBD id="mfs"> Loading ... </KBD></p>
<input type="text" placeholder="Enter Search Sentence" id="sentence"><br>
<script>
var socket = io.connect('http://localhost',{'reconnect': true, 'reconnection delay': 500});
socket.once('firstMsg', function (data) {
$('#mfs').html('<li>'+ data + '</li>');
});
$('#sentence').keypress(function (event) {
if(event.which == 13) {
event.preventDefault();
$('#test').html('');
var str = $('#sentence').val().toString();
socket.emit('twitS', str);
socket.once('twitFrame' , function (frame) {
frame.forEach(function (signal){
$('.y#test').append('<tr class="sent" id="'+signal+'"></tr>')
});
frame.forEach(function (signal){
socket.on(signal, function (data){
if ($('#respSent'+signal).length == 0)
{
$('.sent#'+signal)
.append('<th class="respSent" id="respSent'+signal+'" align="left"><KBD>'+data+'</KBD><th>');
}
});
})
});
}
});
</script>
<br>
<div>
<p>
<KBD>Twit Sub - Space:</KBD>
</p>
<table>
<tbody class="y" id="test">
</tbody>
</table>
</div>
</body>
</html>