-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetroom.html
More file actions
70 lines (65 loc) · 2.28 KB
/
getroom.html
File metadata and controls
70 lines (65 loc) · 2.28 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>collab edit - cl.dedd.ca</title>
<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<!-- <link rel="stylesheet" href="http://codemirror.net/theme/ambiance.css"> -->
<link rel="stylesheet" href="http://codemirror.net/theme/ambiance.css">
<script src="http://codemirror.net/lib/codemirror.js"></script>
<script src="http://codemirror.net/addon/mode/overlay.js"></script>
<script src="http://codemirror.net/mode/xml/xml.js"></script>
<script src="http://codemirror.net/mode/markdown/markdown.js"></script>
<script src="http://codemirror.net/mode/gfm/gfm.js"></script>
<script src="http://codemirror.net/addon/scroll/simplescrollbars.js"></script>
<!-- Code block highlighting modes -->
<script src="http://codemirror.net/mode/javascript/javascript.js"></script>
<script src="http://codemirror.net/mode/css/css.js"></script>
<script src="http://codemirror.net/mode/htmlmixed/htmlmixed.js"></script>
<script src="http://codemirror.net/mode/clike/clike.js"></script>
<script src="http://codemirror.net/mode/clojure/clojure.js"></script>
<script src="http://codemirror.net/mode/ruby/ruby.js"></script>
<style type="text/css">
body
{
margin: 0;
padding: 0;
max-width:inherit;
height: 100%;
}
html, form, .CodeMirror, .CodeMirror-scroll
{
height: 100%;
}
</style>
</head>
<body>
<textarea id="textit"></textarea>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("textit"), {
mode: 'markdown',
lineNumbers: true,
theme: "ambiance"
});
</script>
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
var socket = io.connect();
socket.on('connect', function(){
socket.emit('getroom');
});
socket.on('refresh', function (data) {
editor.setValue(data.body);
});
socket.on('change', function (data) {
//console.log(data);
editor.replaceRange(data.text, data.from, data.to);
});
editor.on('change', function (i, op) {
//console.log(op);
socket.emit('change', op);
socket.emit('refresh', roomid, editor.getValue());
});
</script>
</body>
</html>