first reasonable version
This commit is contained in:
parent
429ba99406
commit
de8ddbb0a6
5 changed files with 809 additions and 19 deletions
|
|
@ -3,24 +3,33 @@ package main
|
|||
var pageTemplate = `
|
||||
<html>
|
||||
<head>
|
||||
<title>LiveMarkdown</title>
|
||||
<title>LiveMarkdown {{.}}</title>
|
||||
<link rel="stylesheet" type="text/css" href="/github.css">
|
||||
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var ws = new WebSocket("ws://" + location.host + "/ws" + "{{.}}")
|
||||
ws.onopen = function() {
|
||||
$("body").Text("wooot")
|
||||
$("#content").html("wooot")
|
||||
}
|
||||
|
||||
ws.onmessage = function(evt) {
|
||||
$("body").Text(evt)
|
||||
var data = JSON.parse(evt.data)
|
||||
$("#content").html(data.Markdown)
|
||||
}
|
||||
|
||||
ws.onclose = function() {
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
body {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content" class="markdown-body">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue