-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtimefork.html
95 lines (69 loc) · 2.59 KB
/
timefork.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<head>
<script src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script src="deltatree.js"></script>
<script src="statenode.js"></script>
<script src="timefork.js"></script>
<script src="objeditor.js"></script>
<script src="timeforkhtmlrenderer.js"></script>
<script>
$(function() {
$(".property").live("change", function(e){ console.log(e)});
})
</script>
<script>
(function(){
this.myHistory;
function init(){
var myHistory = new timeFork('Bada bing', function() { $(myHistory).trigger("change"); });
var editor = new ObjEditor( document.getElementById('inner'), function(d){ $(editor).trigger("change") });
var forkRenderer = new TimeForkHtmlRenderer(document.getElementById('pane'));
$(myHistory).bind("change", function(e){
editor.render(this.currentState());
});
$(myHistory).bind("change", function(e){
forkRenderer.render(this);
});
$(editor).bind("change", function(e){
myHistory.recordState(this.decode());
});
$("a").live('click', function(){
var id = this.getAttribute("href").slice(1, this.getAttribute("href").length);
myHistory.go(myHistory.stateTree.find(id));
});
editor.render({});
};
document.addEventListener( 'DOMContentLoaded', function(){ init(); }, false );
})();
</script>
<style type="text/css">
.undoable ul {list-style-type: none; padding: none; width: 300px;}
.undoable ul:before {content: "{";}
.undoable ul::after {content: "}";}
.undoable li {margin-left: 50px; text-align: right;}
.undoable .key { width: 80px; text-align: right;}
.undoable .key:after {content: ":";}
</style>
<style type="text/css">
#pane {display: block;}
#pane ul {list-style-type: none; display: inline-block; padding:0; margin:0;}
#pane li a {border-bottom: 1px solid black; text-decoration: none; display: inline-block; padding: 0 5px 0 5px; color: blue;}
#pane li { border-left: 1px solid black;}
#pane ul > li:first-child { border-left: 0;}
#pane .active ~ li { border-left: 1px solid red; }
#pane .active > a { border-bottom: 1px solid red; }
</style>
</head>
<body>
<style type="text/css">
.undoable ul {list-style-type: none; padding: none; width: 300px;}
.undoable ul:before {content: "{";}
.undoable ul::after {content: "}";}
.undoable li {margin-left: 50px; text-align: right;}
.undoable label {/* display: inline-block; width: 150px; */text-align: right;}
.undoable label:after {content: ":";}
</style>
<div class="undoable">
<div id="inner"></div>
</div>
<div id="pane"></div>
</body>