-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
69 lines (63 loc) · 2.04 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
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sequencer</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,400i,700,700i" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" media="screen" charset="utf-8">
<style media="screen">
.container {
display: flex;
flex-direction: row;
height: 100vh;
width: 100vw;
}
#editor {
box-sizing: border-box;
display: flex;
flex: 0 0 450px;
padding: 12px;
font-family: 'Roboto Mono', monospace;
font-size: 12px;
border: none;
color: #444;
background-color: #EEE;
line-height: 18px;
outline: none;
}
#diagram {
box-sizing: border-box;
padding: 4px;
flex: 10 0 75%;
overflow: auto;
}
</style>
</head>
<body>
<div class="container">
<textarea id="editor"></textarea>
<div id="diagram"></div>
<div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.6/sequence-diagram-min.js"></script>
<script type="text/javascript">
(function(){
var storage_key = 'SequencerText';
var editor = document.getElementById('editor');
var diagram_div = document.getElementById('diagram');
var localText = localStorage.getItem(storage_key) || "Title: Your diagram here";
var draw = function (){
var text = editor.value;
var diagram = Diagram.parse(text);
localStorage.setItem(storage_key, text);
diagram_div.innerHTML = '';
diagram.drawSVG('diagram', {theme: 'simple'});
}
editor.addEventListener('keyup', _.debounce(draw, 500));
editor.value = localText;
draw();
})();
</script>
</body>
</html>