This repository has been archived by the owner on Nov 15, 2020. It is now read-only.
/
template.html
47 lines (40 loc) · 1.93 KB
/
template.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jinfinote Demo</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/static/styles/editor.css" />
<script type="text/javascript" src="/static/algorithm/text.js"></script>
<script type="text/javascript" src="/static/algorithm/operations.js"></script>
<script type="text/javascript" src="/static/algorithm/request.js"></script>
<script type="text/javascript" src="/static/algorithm/state.js"></script>
<script type="text/javascript" src="/static/scripts/json2.js"></script>
<script type="text/javascript" src="/static/scripts/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/static/scripts/diff_match_patch.js"></script>
<script type="text/javascript" src="/static/scripts/editor.js"></script>
<script type="text/javascript">
var session_name = '%(path)s';
$(window).load(function() {
// Obtain the server name from the current URL (we need this to construct the WebSocket URL)
var server_name_match = /:\/\/([^\/]+)(?:\/|$)/.exec(document.location.href);
if (server_name_match != null) {
var server_name = server_name_match[1];
} else {
var server_name = "127.0.0.1:8080";
}
console.debug("Using WebSocket server", server_name, "and session name", session_name);
var edit = document.getElementById("edit");
var collabEdit = new CollaborativeEditor(edit, "ws://" + server_name + "/transport", session_name);
if (window.WebSocket) {
$("#websocket-notice").hide();
}
});
</script>
</head>
<body>
<p id="websocket-notice">This demo requires a recent browser with JavaScript and WebSockets enabled, e.g. Google Chrome or Safari.</p>
<textarea id="edit" spellcheck="false" rows="30" cols="80" readonly="readonly"></textarea>
<div id="buffer"></div>
</body>
</html>