-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
65 lines (62 loc) · 2.49 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"></script>
<script src="js/polyfills.js"></script>
<![endif]-->
<title>Open Hack Socket IO</title>
<link href='http://www.google.com/fonts#UsePlace:use/Collection:Open+Sans:700,400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css">
<!--<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.js"></script>
<!--All.js is the compiled and compressed version of the scripts listed in Gruntfile.js!-->
<!--<script src="js/all.js"></script>-->
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="sigpad/jquery.signaturepad.min.js"></script>
</head>
<body class="clearfix">
Hello world
<form action="javascript:void(0)">
<input type="text" id="message">
<input type="submit">
</form>
<form method="post" action="javascript:void(0)" class="sigPad">
<ul class="sigNav">
<li class="clearButton"><a href="#clear">Clear</a></li>
</ul>
<div class="sig sigWrapper">
<canvas class="pad" width="500" height="500"></canvas>
<input type="hidden" name="output" class="output">
</div>
<button type="submit">Send Drawing</button>
</form>
<ul>
</ul>
<script>
var socket = io();
// On the client side, emit and recieve messages
// On the server emit and receive a message
document.forms[0].onsubmit=function(){
socket.emit('message',document.getElementById('message').value)
}
document.forms[1].onsubmit=function(){
console.log(document.querySelector(".output").value)
socket.emit('image',document.querySelector(".output").value)
}
socket.on('message',function(message){
document.getElementsByTagName('ul')[0].innerHTML+='<li>'+message+'</li>';
});
socket.on('image',function(imageStr){
$('.sigPad').signaturePad().regenerate(imageStr);
});
$(document).ready(function () {
$('.sigPad').signaturePad({drawOnly:true,lineWidth:0});
});
</script>
</body>
</html>