-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
79 lines (70 loc) · 2.86 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
70
71
72
73
74
75
76
77
78
79
<html>
<head>
<title>Window.js - Demo</title>
<link type="text/css" rel="stylesheet" href="window.css">
<link type="text/css" rel="stylesheet" href="demo.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script type="text/javascript" src="window.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var wm = $('#window').windowManager({
hooks : {
onAdd : function(obj){ message('Window type ' + obj.type + ' added.') },
onRemove: function(obj){ message('Window type ' + obj.type + ' removed.') },
onDrag : function(obj, pixels){ message('Divider moved ' + pixels + ' pixels.'); }
}
});
$('#bar button').click(function(){
$('.introduction').remove();
});
$('#bar button.add').click(function(){
var type = $(this).attr('id');
wm.windowManager('edit', type);
});
$('#bar button#remove').click(function(){
var type = $(this).attr('id');
wm.windowManager('edit', type, 'delete');
});
$('#load').click(function(){
var json = $('#json').val();
wm.windowManager('load', json);
})
$('#save').click(function(){
var json = wm.windowManager('save');
$('#json').val(json);
})
function message(string){
var messages = $('#messages').empty();
$('<div />')
.text(string)
.appendTo(messages)
.fadeOut(2000, function(){ $(this).remove() })
}
});
</script>
</head>
<body>
<div id="example">
<div id="bar">
<div class="left">
<button id="one" class="one add">Add type one</button>
<button id="two" class="two add">Add type two</button>
<button id="three" class="three add">Add type three</button>
</div>
<div class="right">
<div id="messages"></div>
<button id="remove">Remove a view</button>
<button id="load">Load</button>
<button id="save">Save</button>
<input id="json">
</div>
</div>
<div id="window">
<div class="introduction">
<h1>window.js</h1>
<h2>Add a view to begin!</h2>
</div>
</div>
</div>
</body>
</html>