-
Notifications
You must be signed in to change notification settings - Fork 0
/
selection2.html
293 lines (260 loc) · 9.79 KB
/
selection2.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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<html>
<head>
<title> Selection </title>
<!--
<link rel="stylesheet" type="text/css" href="examples/fvlogger/logger.css" />
<script type="text/javascript" src="examples/fvlogger/logger.js"></script>
-->
<!-- somehow, this breaks in Firefox when in the escaped block -->
<script>
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while (i--){document.createElement(e[i])}})();
</script>
<!--[if lte IE 8]>
<OBJECT ID="canvasFactory" CLASSID="clsid:785740C4-DD04-4B91-8AD7-44CC9FFB4984" CODEBASE="http://vnmeta.com/IECanvas/IECanvas118.cab#version=1,1,8,0"></OBJECT>
<style>
canvas { behavior: url(#canvasFactory); -filter:progid:DXImageTransform.IECanvas.CanvasTransform; display: block; width: 300px; height: 150px; background: transparent!important; }
</style>
<canvas id="CanvasRenderingContext2D" style="display: none" />
<script>
var info;
if(typeof(info) == 'undefined') info = function(a) { console.log(a); };
// FIXME: c.__proto__ = p.prototype = c.constructor.prototype
// Lets tie this .prototype into canvasFactory, and rename canvasFactory to CanvasRenderingContext2D
//CanvasRenderingContext2D.prototype = CanvasRenderingContext2D.getContext('2d').prototype;
// Allows: var x = document.createElement('canvas').getContext('2d');
document._createElement = document.createElement;
document.createElement = function(tagName) {
var tag = document._createElement(tagName);
if(tagName.toUpperCase() == 'CANVAS') tag.addBehavior("#canvasFactory");
return tag;
};
// Crash: alert("canvasFactory"+CanvasRenderingContext2D.prototype.fillStyle);
</script>
<![endif]-->
<style>
input.w3canvas {background-color: black; color: white; border: none;}
</style>
<script src="base2-jsb-fp.js"></script>
<!--
helpers: mixin, clone, others.
-->
<script src="lang_util.js" ></script>
<script src="lang_debug.js" ></script>
<script src="canvas_lib.js" ></script>
<!--
fillText, strokeText, measureText
FIXME: We have a new library, and many browsers have these built-in.
-->
<script src="font/font.js" ></script>
<script src="font/path.js" ></script>
<script src="font/arial_font.js" ></script>
<!--
createElement, element.style
-->
<script src="css/box_basic.js" ></script>
<script src="css/box_model.js" ></script>
<script src="css/css_style.js" ></script>
<script src="css/box_paint.js" ></script>
<script src="css/scrollbar.js" ></script>
<script src="css/viewport.js" ></script>
<script src="css/line_basic.js" ></script>
<script src="css/text_wrap.js" ></script>
<script src="css/line_model.js" ></script>
<script src="css/line_paint.js" ></script>
<!-- // css3-content is insanely cool
// css/content_model.js [ this is the goal ]
-->
<!-- overflow: scroll; overflow-style: move; overflow-y: hidden; -->
<script src="css/overflow.js" ></script>
<!--
DOM API
-->
<script src="html/dom_core.js" ></script>
<script src="html/dom_html_basic.js" ></script>
<script src="html/dom_html_option.js" ></script>
<script src="html/dom_html_select.js" ></script>
<!-- document.createElement -->
<script src="html/dom_html_doc.js" ></script>
<!--
HTML Painters and Event Listeners
-->
<script src="html/control_factory.js" ></script>
<script src="html/select_control.js" ></script>
<script src="html/combobox_control.js" ></script>
<script src="html/image_control.js" ></script>
<script src="html/button_control.js" ></script>
<script src="html/slider_control.js" ></script>
<!-- text -->
<script src="html/textbox/factory.js" ></script>
<script src="html/textbox/basic_model.js" ></script>
<!-- css3-ui module has removed ::selection recently, css3-selectors has as well -->
<!-- strongly related: Range, Selection -->
<script src="html/textbox/cursor.js" ></script>
<script src="html/textbox/selection.js" ></script>
<!--
<select>
FIXME: Use webkit CSS APIs for gradient, rounded rectangles,
custom scroller styling and arrow url
-->
<script src="style/combo_blue.js" ></script>
<script src="style/combo_mike.js" ></script>
<script src="style/select_main.js" ></script>
<!--
<img>
FIXME: Finish css parser for border, margin, padding and so on.
-->
<script src="style/image_main.js" ></script>
<!--
<input type="[checkbox|radio]">
FIXME: Uses XForms setLabel to set associated text.
Investigate this. Wouldn't :after css selector work the same way?
-->
<script src="style/button_main.js" ></script>
<!--
<textarea> <input type="text">
TODO: setStyle is great, keep working on it
FIXME: Allow inlined styles [ <div><span></span></div> ]
-->
<!-- ui-events -->
<script src="html/textbox/keyboard.js" ></script>
<script src="html/textbox/mouse.js" ></script>
<!-- css3-content: move-to -->
<script src="html/textbox/keyboard_edit.js" ></script>
<!-- css3-ui: keyboard -->
<script src="html/textbox/keyboard_nav.js" ></script>
<!-- textarea / clipboard -->
<script src="html/textbox/textbox_comp.js" ></script>
<script src="html/textbox/textmodel_copypaste.js" ></script>
<script src="html/textbox/textmodel.js" ></script>
<script src="style/input_main.js" ></script>
<script src="jsb/behaviors.js" ></script>
<script>
</script>
<script>
function setupCombos() {
setupComboBoxFruits();
setupComboBoxOther(); // <select><option /></select>
setupImageTest(); // <img>
setupButtons(); // <input type="checkbox" /><input type="radio" />
drawBoxes(); // <input type="text" /><textarea />
//var a = 10;
//colorjack.debug.checkNull(a);
}
loadFont(setupCombos);
</script>
<script>
// display the underlying slider value
new jsb.RuleList({
"canvas.InputRange": {
onchange: function(element) {
var control = this.getPrivateData(element, "control");
this.querySelector(element, "+span").innerHTML = control.getValue();
}
},
"#sliders + p > button": {
onclick: function(element) {
var sliders = this.querySelector("#sliders");
var slider = document.createElement("input");
slider.className = "w3canvas";
slider.setAttribute("type", "range");
sliders.appendChild(slider);
sliders.appendChild(document.createElement("br"));
}
}
});
</script>
</head>
<body bgColor="black" text="white">
<br />
<br />
<form>
<table>
<tr>
<td>Selection Label:</td>
<td><input type="text" value="Hello" id="selectionInputBox" /></td>
</tr>
<tr>
<td>Hover Label:</td>
<td><input type="text" value="Hello" id="hoverInputBox" /></td>
</tr>
<tr>
<td>Up</td>
<td><input type="submit" value="Up" onclick="up();return false;"/></td>
</tr>
<tr>
<td>Down</td>
<td><input type="submit" value="Down" onclick="down();return false;"/></td>
</tr>
</table>
</form>
<!-- slider -->
<div id="sliders">
<input class="w3canvas" id="slider1" type="range" value="0"> <span>0</span><br />
<input class="w3canvas" id="slider2" type="range" value="0" min="0" max="255"> <span>0</span><br />
<input class="w3canvas" id="slider3" type="range" value="0" style="width:22px;height:200px"> <span style="vertical-align:top">0</span><br />
</div>
<p><button>Add new slider</button></p>
<br />
<br />
<!-- select menus -->
<canvas id="chordComboBox" width="500" height="50" ></canvas>
<canvas id="scalesComboBox" width="500" height="50" ></canvas>
<br />
<br />
<canvas id="fruitComboBox" width="1000" height="60"> </canvas>
<br />
<br />
<canvas id="composerComboBox" width="1000" height="60" > </canvas>
<br />
<hr />
<!-- image elements -->
<img src="examples/marilyn_th.jpg" style="display: none" />
<canvas width="600" height="200" id="cBox_image1"></canvas>
<img src="examples/marilyn2_th.jpg" style="display: none" />
<canvas width="600" height="200" id="cBox_image1b"></canvas>
<hr />
<canvas width="300" height="100" id="cBox_image2"></canvas>
<hr />
<!-- Radio Buttons -->
<br />
<input class="w3canvas" id="radio1a" name="Radio1" type="radio"><label for="radio1a"> Hello1</label>
<input class="w3canvas" id="radio2a" name="Radio1" type="radio"><label for="radio2a"> Hello2</label>
<input class="w3canvas" id="radio3a" name="Radio1" type="radio" checked><label for="radio3a"> Hello3</label>
<br />
<canvas id="radio1" width="600" height="100" ></canvas>
<canvas id="radio2" width="600" height="100" ></canvas>
<canvas id="radio3" width="600" height="100" ></canvas>
<br />
<canvas id="radio4" width="600" height="100" ></canvas>
<canvas id="radio5" width="600" height="100" ></canvas>
<canvas id="radio6" width="600" height="100" ></canvas>
<br />
<canvas id="checkbox1" width="600" height="150" ></canvas>
<canvas id="checkbox2" width="600" height="150" ></canvas>
<canvas id="checkbox3" width="600" height="150" ></canvas>
<br />
<hr />
<!-- text input -->
<div style="margin:25px;padding:10px;border:5px solid black;background:#333">
<canvas width="800" height="220" id="cBox_top" style="background:black"></canvas>
</div>
<hr />
<div style="margin:25px;padding:10px;border:5px solid black;background:black">
<canvas width="800" height="500" id="cBox_bottom"></canvas>
</div>
<hr />
<h2> Debugging </h2>
<div id="fvlogger">
<dl>
<dt>fvlogger</dt>
<dd class="all"><a href="#fvlogger" onclick="showAll();" title="show all" id="abcdef">all</a></dd>
<dd class="debug"><a href="#fvlogger" onclick="showDebug();" title="show debug" id="showDebug">debug</a></dd>
<dd class="info"><a href="#fvlogger" title="show info" id="showInfo">info</a></dd>
<dd class="warn"><a href="#fvlogger" onclick="showWarn();" title="show warnings" id="showWarn">warn</a></dd>
<dd class="error"><a href="#fvlogger" onclick="showError();" title="show errors" id="showError">error</a></dd>
<dd class="fatal"><a href="#fvlogger" onclick="showFatal();" title="show fatals" id="showFatal">fatal</a></dd>
<dd><a href="#fvlogger" onclick="eraseLog(true);" title="erase">erase</a></dd>
</dl>
</div>
</body>
</html>