forked from lbondaryk/PlayerProto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttonTests.html
More file actions
179 lines (138 loc) · 4.3 KB
/
buttonTests.html
File metadata and controls
179 lines (138 loc) · 4.3 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8">
<meta name="Author" content="Jordan Vishniac" />
<meta name="Owner" content="Pearson" />
<meta name="Copyright" content="Copyright (c) 2013 Pearson. All rights reserved." />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="eCourses Author, Title" name="description" />
<!-- Bootstrap -->
<link href="css/bootstrap_plus.css" rel="stylesheet" media="screen">
<link href="css/graphics_and_svg.css" rel="stylesheet">
<link href="css/learning-objective.css" rel="stylesheet">
<link href="css/eCourse-master.css" rel="stylesheet" media="screen">
<title class="setTitle"></title>
<style>
div.test
{
min-height: 200px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span6 leftCol">
<div class="test">
<p>Test 0: One button</p>
<span id="t0button"></span>
</div>
<div class="test">
<p>Test 1: Two buttons</p>
<span id="t1_1button"></span>
<span id="t1_2button"></span>
</div>
<div class="test">
<p>Test 2: One button with event</p>
<span id="t2button"></span>
<p>Click to increment: <span id="t2val"></span></p>
</div>
</div>
<div class="span6 rightCol">
<div class="test">
<p>Test 3: Two buttons with events</p>
<span id="t3_1button"></span>
<p>Click button 1 to increment</p>
<span id="t3_2button"></span>
<p>Click button 2 to decrement
<p>Value: <span id="t3val"></span></p>
</div>
</div>
</div>
</div>
<script src="js/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<!--script src="js/jquery.touchSwipe.min.js"></script-->
<script src="js/jquery-ui-1.10.2.custom.js"></script>
<script src="js/toc-structure.js"></script>
<script src="js/eCourse-master.js"></script>
<script src="js/d3.v2.min.js"></script>
<script src="js/widgets.js"></script>
<script src="js/eventmanager.js"></script>
<script src="js/widget-button.js"></script>
<script src="js/widget-numeric.js"></script>
<script>
// create event manager
var eventManager = new EventManager();
///////////////////////////////////////////
// Test 0: One button
var t0Button = new Button ({
id: "t0",
text: "Test 0"
}, eventManager);
$('#t0button').append(t0Button.getRootEl());
///////////////////////////////////////////
// Test 1: Two Buttons
var t1_1Button = new Button ({
id: "t1_1",
text: "Test 1 Button 1"
}, eventManager);
$('#t1_1button').append(t1_1Button.getRootEl());
var t1_2Button = new Button ({
id: "t1_2",
text: "Test 1 Button 2"
}, eventManager);
$('#t1_2button').append(t1_2Button.getRootEl());
///////////////////////////////////////////
// Test 2: One button with event
var t2Button = new Button ({
id: "t2",
text: "Test 2 Button"
}, eventManager);
$('#t2button').append(t2Button.getRootEl());
var t2Readout = new Readout ({
node: d3.select("#t2val"),
id: "t2Read",
startVal: 0,
readOnly: true,
size: 10
}, eventManager);
eventManager.subscribe(t2Button.pressedEventId, t2handleClick);
function t2handleClick()
{
t2Readout.setValue(parseInt(t2Readout.getValue()) + 1);
}
////////////////////////////////////////////
// Test 3: Two buttons with events
var t3_1Button = new Button ({
id: "t3_1",
text: "Test 3 Button 1"
}, eventManager);
$('#t3_1button').append(t3_1Button.getRootEl());
var t3_2Button = new Button ({
id: "t3_2",
text: "Test 3 Button 2"
}, eventManager);
$('#t3_2button').append(t3_2Button.getRootEl());
var t3Readout = new Readout ({
node: d3.select("#t3val"),
id: "t3Read",
startVal: 0,
readOnly: true,
size: 10
}, eventManager);
eventManager.subscribe(t3_1Button.pressedEventId, t3_1handleClick);
eventManager.subscribe(t3_2Button.pressedEventId, t3_2handleClick)
function t3_1handleClick()
{
t3Readout.setValue(parseInt(t3Readout.getValue()) + 1);
}
function t3_2handleClick()
{
t3Readout.setValue(parseInt(t3Readout.getValue()) - 1);
}
</script>
</body>
</html>