-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmylib-examples.html
2696 lines (2407 loc) · 114 KB
/
mylib-examples.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Last-Modified" content="6 May 2010 22:29:00 GMT">
<meta name="description" content="Examples of My Library, a cross-browser scripting library, written in Javascript">
<meta name="keywords" content="My Library, Javascript, library, project, repository, builder, browser scripting, Ajax, comp.lang.javascript, newsgroup, example">
<meta name="author" content="David Mark">
<title>My Library Examples</title>
<link rel="home" href="mylib.html" title="Home">
<link rel="bookmark" href="#content" title="Content">
<link rel="stylesheet" type="text/css" href="style/mylib.css" media="all">
<link rel="stylesheet" type="text/css" href="style/mylib-widgets.css" media="all">
<link rel="stylesheet" type="text/css" href="style/mylib-skin-blues.css" media="all" title="Blues">
<link rel="alternate stylesheet" type="text/css" href="style/mylib-skin-doom.css" media="all" title="Doom">
<link rel="alternate stylesheet" type="text/css" href="style/mylib-skin-froggy.css" media="all" title="Froggy">
<link rel="alternate stylesheet" type="text/css" href="style/mylib-skin-hades.css" media="all" title="Hades">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="style/mylib-ie.css" media="all">
<link rel="stylesheet" type="text/css" href="style/mylib-widgets-ie.css" media="all">
<script type="text/javascript">
// IE8 breaks conditional comments
(function() {
var doc = this.document;
if (doc && typeof doc.documentMode == 'number' && doc.documentMode < 8 && typeof doc.write != 'undefined') {
doc.write('<link rel="stylesheet" type="text/css" href="style/mylib-widgets-ieold.css" media="all">');
}
if (typeof doc.compatMode == 'undefined' || doc.compatMode.toLowerCase().indexOf('css') == -1) {
this.document.write('<link rel="stylesheet" type="text/css" media="all" href="style/mylib-widgets-ie5.css">');
}
})();
</script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="style/mylib-alert.css" media="all">
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="style/mylib-widgets-ieold.css" media="all">
<![endif]-->
<!--[if lt IE 6]>
<link rel="stylesheet" type="text/css" media="all" href="style/mylib-widgets-ie5.css">
<![endif]-->
<link rel="stylesheet" type="text/css" href="style/mylib-handheld.css" media="handheld">
<link rel="stylesheet" type="text/css" href="style/mylib-print.css" media="print">
<link rel="stylesheet" type="text/css" href="style/mylib-widgets-print.css" media="print">
<script type="text/javascript">
var API = { deferAudio:true };
</script>
<script type="text/javascript" src="mylib-example-build-min.js"></script>
<script type="text/javascript">
var API, global = this;
/* Prevent FoUC for example alert style
getEBI will be needed to find it and the related anchor, which will be turned into a link on ready
attachListener will be needed to attach a click listener to the newly created link
canAdjustStyle is consulted to determine if display styles can be changed by script (else example would be irretrievably hidden) */
if (API && API.forEach && API.attachListener && API.getEBI && API.canAdjustStyle && API.canAdjustStyle('display') && API.isHostMethod(this.document, 'write')) {
this.document.write('<style type="text/css" media="all">#examplealertstyle { display:none }<\/style><style type="text/css" media="print">#examplealertstyle { display:block !important }<\/style>');
}
</script>
<style type="text/css" media="all">
#testalertleftlabel {
margin-left:.5em
}
#alerttestmessages div { margin-top:.5em }
fieldset div.dialognote, #toolbarlanding { margin-bottom:1em }
#skintoolbar, #apptoolbar, .tabstrip, fieldset.abrupt { margin-top:1em }
#createbuttonremoveall, #confirmchanges, #backgroundmusicstatuspanel, div.aside { float:right }
#backgroundmusicstatuspanel { margin-top:-.75em }
#backgroundmusicstatusduration { font-family:monospace;font-size:80%;text-align:right }
#backgroundmusiccontrols {
background:url(images/jukebox.gif) no-repeat right top;
}
#backgroundmusiccontrols.playing {
background-image:url(images/jukeboxflashing.gif)
}
#backgroundmusictrack input {
width:7.5em
}
#skinblues {
background-image:url(images/cloud.gif);
}
#skindoom {
background-image:url(images/skull.png);
}
#skinfroggy {
background-image:url(images/frog.png);
}
#skinhades {
background-image:url(images/devil.gif);
}
#testtransform, #testtransformadvanced { width:297px;text-align:center }
#testtransform img, #testtransformadvanced img { display:block; }
#testalerttext { margin-bottom:.5em; }
.textinput { width:3em }
.matrix { width:7em }
.flat { border:none }
div.music, div.sounds { background-image:url(images/music.gif);background-repeat:no-repeat;background-position:left;padding-left:4em;white-space:normal;width:10em }
div.sounds { background-image:url(images/speaker.gif) }
iframe.test { width:100%;height:9.25em;border:none }
</style>
</head>
<body>
<div id="sidebar">
<a href="#content" id="skipnav">Skip Navigation</a>
<h2>Resources</h2>
<h3>Contents</h3>
<ul><li><a href="mylib.html" accesskey="1" title="Home [1]">Home</a></li><li><a href="mylib-downloads.html">Downloads</a></li><li><a href="mylib-doc0.html">Documentation</a></li><li><span id="current">Examples</span></li><li><a href="mylib-builder.asp">Builder</a></li><li><a href="mylib-test.asp?version=1.0&requester=on&array=on&script=on&mouseposition=on&drag=on&every=on&cookie=on&contextclick=on&adjacent=on&ajaxlink=on&ajax=on&event=on&audio=on&statusbar=on&position=on&scrollfx=on&filter=on&dispatch=on&help=on&flash=on&opacity=on&maximize=on&ashtml=on&foreach=on&query=on&serialize=on&region=on&class=on&show=on&map=on&bookmark=on&collections=on&html=on&offset=on&size=on&fx=on&ajaxform=on&overlay=on&some=on&crumb=on&text=on&dom0=on&mousewheel=on&preload=on&margin=on&ease=on&dom=on&setattribute=on&stylesheets=on&style=on&coverdocument=on&dollar=on&objects=on&import=on&rollover=on&locationquery=on&border=on&updater=on&form=on&image=on&plugin=on&directx=on&present=on&viewport=on&fullscreen=on&scroll=on&center=on&gethtml=on&mode=HTML" title="Test full build">Build Test</a></li><li><a href="mylib-testspeed.html" title="Compare the performance of the query feature to three popular libraries">Speed Tests</a></li><li><a href="mylib-sponsors.html" title="List of our benefactors">Sponsors</a></li></ul>
<h3>Related Links</h3>
<ul><li><a href="http://www.pledgie.com/campaigns/9768" title="Please make a donation today!">Donations</a></li><li><a href="http://groups.google.com/group/my-library-general-discussion/">Discussion</a></li><li><a href="http://code.google.com/p/ourlibrary/source/checkout">Repository</a></li></ul>
<h3>Primers</h3>
<ul><li><a href="attributes.html" title="A is for Attributes primer">Attributes</a></li><li><a href="host.html" title="H is for Host primer">Host</a></li><li><a href="keyboard.html" title="K is for Keyboard primer">Keyboard</a></li><li><a href="position.html" title="P is for Position primer">Position</a></li><li><a href="size.html" title="S is for Size primer">Size</a></li><li><a href="viewport.asp" title="V is for Viewport primer">Viewport</a></li></ul>
<h3>Bookmark</h3>
<ul><li><a title="Digg this" href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fwww.cinsoft.net%2Fmylib-downloads.html&title=My%20Library&bodytext=Build%20your%20own%20browser%20scripting%20library&topic=programming">Digg This</a></li><li><a title="Add bookmark to deli.cio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.cinsoft.net%2Fmylib-downloads.html">Add to deli.cio.us</a></li></ul>
<h3>Javascript Help</h3>
<ul><li><a href="http://groups.google.com/group/comp.lang.javascript/topics" title="comp.lang.javascript newsgroup">Newsgroup</a></li><li><a href="http://jibbering.com/faq/index.html" title="comp.lang.javascript newsgroup FAQ">FAQ</a></li></ul>
<script type="text/javascript">
google_ad_client = "pub-0919891272636534";
google_ad_slot = "6037707224";
google_ad_width = 120;
google_ad_height = 90;
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div>
<a name="content"></a>
<h1><span class="redundant">My Library </span>Examples</h1>
<p>Many additional examples can be found on the <a href="mylib-test.asp?version=1.0&requester=on&array=on&script=on&mouseposition=on&drag=on&every=on&cookie=on&contextclick=on&adjacent=on&ajaxlink=on&ajax=on&event=on&audio=on&statusbar=on&position=on&scrollfx=on&filter=on&dispatch=on&help=on&flash=on&opacity=on&maximize=on&ashtml=on&foreach=on&query=on&serialize=on&region=on&class=on&show=on&map=on&bookmark=on&collections=on&html=on&offset=on&size=on&fx=on&ajaxform=on&overlay=on&some=on&crumb=on&text=on&dom0=on&mousewheel=on&preload=on&margin=on&ease=on&dom=on&setattribute=on&stylesheets=on&style=on&coverdocument=on&dollar=on&objects=on&import=on&rollover=on&locationquery=on&border=on&updater=on&form=on&image=on&plugin=on&directx=on&present=on&viewport=on&fullscreen=on&scroll=on&center=on&gethtml=on&mode=HTML">Build Test</a> page.</p>
<p>This document uses a <a href="mylib-example-build-min.js">minified</a> version of a <a href="mylib-build.asp?version=1.0&array=on&mouseposition=on&drag=on&adjacent=on&foreach=on&region=on&class=on&show=on&map=on&collections=on&offset=on&size=on&fx=on&overlay=on&dom=on&style=on&coverdocument=on&text=on&dom0=on&preload=on&margin=on&ease=on&event=on&statusbar=on&position=on&scrollfx=on&form=on&image=on&present=on&viewport=on&fullscreen=on&scroll=on&center=on&border=on&opacity=on&maximize=on&stylesheets=on&rollover=on">custom build</a> that weighs approximately 76K. The minified versions of the demonstrated add-ons weigh between 2 and 7K. As always, reported sizes are pre-GZIP-compression as GZIP is not a constant on the Web and compressed sizes are less than ideal for comparative purposes (unless you manually GZIP every asset you compare).</p>
<ul id="toc" title="Contents"><li><a href="#myaudio">Audio</a></li><li><a href="#addons">Add-ons</a><ul><li><a href="#myalert">Alert</a></li><li><a href="#scrollinganchors">Scrolling Anchors</a></li><li><a href="#sidebars">Sidebar</a></li><li><a href="#toast">Toast</a></li><li><a href="#mytoolbar">Toolbar</a></li><li><a href="#transform">Transform</a><ul><li><a href="#transformbasic">Basic</a></li><li><a href="#transformbymatrix">By Matrix</a></li><li><a href="#transformreveal">Reveal</a></li></ul></li></ul></li><li><a href="#userexamples">User Examples</a><ul><li><a href="#slideshow">Slide Show</a></li><li><a href="#tabbedpane">Tabbed Pane Widget</a></li></ul></li></ul>
<h2 id="myaudio">Audio</h2>
<p>Where permitted, the Audio module, in conjunction with the Playlist add-on can enhance the following examples. When enabled, the <code>API.playEventSound</code> function is called to play specified sound clips on <a href="#myalert">alert</a> and <a href="#toast">toast</a> operations. Applications can use the <code>API.addEventSound</code> and <code>API.removeEventSound</code> functions to create audio schemes.</p>
<p><strong>Note</strong> in browsers that use plug-ins for audio (e.g. most but IE), performance is limited to the ability of the plug-in.</p>
<fieldset>
<legend>Event Sounds</legend>
<input id="eventsounds" type="button" value="Enable" title="Enable event sounds (disabled)" disabled>
</fieldset>
<pre id="codeaudio">
(Code will appear when event sounds are enabled)
</pre>
<fieldset>
<legend>Background Music</legend>
<fieldset id="backgroundmusiccontrols">
<legend>
<input id="backgroundmusic" type="button" value="Enable" title="Enable background music (disabled)" disabled>
</legend>
<input type="checkbox" id="backgroundmusicautorepeat" disabled><label for="backgroundmusicautorepeat" id="backgroundmusicautorepeatlabel" class="disabled">Auto Repeat</label>
</fieldset>
<fieldset id="backgroundmusictrack">
<legend>Track</legend>
<div id="backgroundmusicstatuspanel"><div id="backgroundmusicstatus"></div><div id="backgroundmusicstatusduration"></div></div>
<input id="backgroundmusicfirst" type="button" value="First" disabled title="First track (disabled)">
<input id="backgroundmusicprevious" type="button" value="Previous" disabled title="Previous track (disabled)">
<input id="backgroundmusicnext" type="button" value="Next" disabled title="Next track (disabled)">
<input id="backgroundmusiclast" type="button" value="Last" disabled title="Last track (disabled)">
</fieldset>
</fieldset>
<pre id="codemusic">
(Code will appear when background music is enabled)
</pre>
<h2 id="addons">Add-ons</h2>
<p>This section demonstrates a few of the <a href="mylib-downloads.html#addons">add-ons available for My Library</a>.</p>
<h3 id="myalert">Alert</h3>
<p>The Alert add-on is a basic alert replacement, which was originally written to demonstrate progressive enhancement on the <a href="mylib-builder.asp">builder</a> test page. At one point efforts were undertaken to add additional functionality to allow it to serve as a confirm replacement, as well as a customizable dialog. A prompt feature will be added shortly, as well as property sheets (tabbed dialogs) and wizards with validation callbacks.</p>
<h4>Styling</h4>
<p>Example styles for the alert element are available for <a href="mylib-downloads.html#skins" title="Download sample alert style sheet">download</a> or <a id="examplealertstyleanchor">study here</a>. It will be enhanced by the use of a <a href="mylib-downloads.html#skins">skin</a>. The curtain fade-in effect in this example is accomplished with only skin CSS and only works in some browsers (e.g. Chrome, Safari, iPhone/Pod/Pad).</p>
<pre id="examplealertstyle">
div.alert div.content {
text-align:center;
padding:1em
}
div.alert fieldset {
text-align:center;
border:none;
white-space:nowrap
}
div.alert input.commandbutton {
width:5em;
margin-left:.25em
}
div.alert input.close {
margin-left:0
}
div.alert div.icon {
position:absolute;
left:2px;
top:.2em
}
div.alert div.movehandle {
padding-right:20px
}
div.maxminbuttons div.movehandle {
padding-right:60px
}
div.fixable div.movehandle {
padding-right:42px
}
div.fixable.maxminbuttons div.movehandle {
padding-right:82px
}
div.nocaptionbuttons div.movehandle {
padding-right:2px
}
div.iconic div.movehandle {
padding-left:20px
}
div.alert div.maximize {
right:20px
}
div.alert div.fix {
right:62px
}
div.nomaxminbuttons div.fix {
right:22px
}
div.alert div.minimize {
right:40px
}
div.alert div.close {
right:0px
}
</pre>
<h4>Modality</h4>
<p>Care has been taken to enforce <em>real</em> modality for this application. This is accomplished by attaching <code>focus</code> listeners to links and form controls.</p>
<pre>
var focusListener = function(e) {
if (API.isAlertModal()) {
window.setTimeout(function() {
API.focusAlert();
}, 1);
return API.cancelDefault(e);
}
};
</pre>
<p>To draw further attention to the plight of the user trying to break out of the modal alert, the <code>flashAlert</code> function can be called in addition to <code>focusAlert</code>.</p>
<p><strong>Note</strong> that the dialog type does not display an actual dialog in this example, but plain text. The Set Dirty buttons allow simulation of data changes by its controls and/or the controls of a successor dialog. The Apply button enables and, in the latter case, the OK button changes to Close and the Cancel button is disabled). A dialog application would pass controls as HTML (<code>html</code> option) or DOM nodes (<code>nodes</code> option). In the former case, it would attach <code>change</code> listeners in the <code>onopen</code> callback. In either case, it would call the <code>setAlertDirty</code> API function to signal user changes. When dirty, the <code>onsave</code> callback is called on a positive outcome (OK button) or when the Apply button is pressed. Also note that, for dialogs, the escape key does not trigger a negative outcome (cancel button) but simply closes the dialog, calling the <code>onclose</code> callback. This is <strong>important</strong> as applications should <em>always</em> abandon changes on cancel, but should prompt the user to save any <em>pending</em> changes on close.</p>
<!--[if gt IE 7]>
<p><strong>Note</strong> that in some circumstances there is an issue with showing the alert using effects that are implemented with DirectX (e.g. skew, spin, fade) where IE8 standards mode shows a flash of the final animation state initially. This is not something we've seen before (certainly not with any of the effects on the <a href="mylib-test.asp?version=1.0&requester=on&array=on&script=on&mouseposition=on&drag=on&every=on&cookie=on&contextclick=on&adjacent=on&ajaxlink=on&ajax=on&event=on&audio=on&statusbar=on&position=on&scrollfx=on&filter=on&dispatch=on&help=on&flash=on&opacity=on&maximize=on&ashtml=on&foreach=on&query=on&serialize=on&region=on&class=on&show=on&map=on&bookmark=on&collections=on&html=on&offset=on&size=on&fx=on&ajaxform=on&overlay=on&some=on&crumb=on&text=on&dom0=on&mousewheel=on&preload=on&margin=on&ease=on&dom=on&setattribute=on&stylesheets=on&style=on&coverdocument=on&dollar=on&objects=on&import=on&rollover=on&locationquery=on&border=on&updater=on&form=on&image=on&plugin=on&directx=on&present=on&viewport=on&fullscreen=on&scroll=on&center=on&gethtml=on&mode=HTML" title="Test full build">Build Test</a> page). The issue is not present when effects are combined (e.g. spin + fade). For this example, which uses one effect at a time, the workaround is simple. Where previously we had this:</p>
<pre>
API.alert(text, options);
</pre>
<p>...we have replaced it with this:</p>
<pre>
var elAlert = API.getAlertElement();
API.setOpacity(elAlert, 0);
API.alert(text, options);
if (effectName != 'fade') {
API.setOpacity(elAlert, 1);
}
</pre>
<p>...setting the alert to transparent initially and then putting it back after the show has started and the effects have initialized (unless the fade effect is used).</p>
<p><strong>Note</strong> that, also in IE8 standards mode, using the spin effect <em>after</em> the slide or clip effects results in some cropping during the transition. This appears to be related to the <code>clip</code> style used by the slide effect, but is odd as the element is "unclipped" at the end of that transition (clipping is set to automatic).</p>
<![endif]-->
<fieldset>
<legend>Alert</legend>
<div class="dialognote"><strong>Note</strong> that changes are only applied on show.</div>
<label for="testalerttype" id="testalerttypelabel" class="disabled">Type:</label><select id="testalerttype" disabled><option selected>alert</option><option>confirm</option><option>yes/no</option><option>yes/no/cancel</option><option>dialog</option></select>
<label id="testalerttitlelabel" class="disabled">Title:</label><input id="testalerttitle" value="Alert" disabled>
<label id="testalertstepslabel" for="testalertsteps" class="disabled">Steps:</label><input id="testalertsteps" value="1" class="textinput" disabled>
<div>
<label id="testalerttextlabel" class="disabled">Text:</label><textarea rows="5" cols="80" id="testalerttext" disabled>This is only a test!</textarea>
</div>
<fieldset>
<legend>Configuration</legend>
<input id="testalertmodal" type="checkbox" checked disabled><label class="disabled" id="testalertmodallabel" for="testalertmodal">Modal</label>
<input id="testalertfixable" type="checkbox" checked disabled><label class="disabled" id="testalertfixablelabel" for="testalertfixable">Fixable</label>
<input id="testalertautodismiss" type="checkbox" disabled><label class="disabled" id="testalertautodismisslabel" for="testalertautodismiss">Auto dismiss</label><label for="testalertautodismissseconds" id="testalertautodismisssecondslabel" class="disabled">after</label><input id="testalertautodismissseconds" disabled class="textinput" value="30"><span class="disabled" id="testalertautodismisssecondsdecoration">seconds</span>
<fieldset class="abrupt">
<legend>Position</legend>
<input type="radio" name="testalertposition" id="testalertcenter" disabled checked><label for="testalertcenter" id="testalertcenterlabel" class="disabled">Center</label>
<div><input type="radio" name="testalertposition" id="testalertcorner" disabled><label for="testalertcorner" id="testalertcornerlabel" class="disabled">Corner</label><label for="testalertcornerposition" id="testalertcornerpositionlabel" class="disabled">at</label><select id="testalertcornerposition" disabled><option selected>Top Left</option><option>Top Right</option><option>Bottom Left</option><option>Bottom Right</option></select></div>
<div><input type="radio" name="testalertposition" id="testalertoffset" disabled><label for="testalertoffset" id="testalertoffsetlabel" class="disabled">Offset</label><label class="disabled" for="testalerttop" id="testalerttoplabel">Top:</label><input class="textinput" id="testalerttop" disabled value="0"><span id="testalerttopdecoration" title="pixels">px</span><label class="disabled" for="testalertleft" id="testalertleftlabel">Left:</label><input class="textinput" id="testalertleft" disabled value="0"><span id="testalertleftdecoration" title="pixels">px</span></div>
<input type="checkbox" id="testalertfixed" disabled><label for="testalertfixed" id="testalertfixedlabel" class="disabled">Fixed</label>
</fieldset>
<fieldset class="abrupt">
<legend><input id="testalertsizable" type="checkbox" checked disabled><label class="disabled" for="testalertsizable" id="testalertsizablelabel">Sizable</label></legend>
<input id="testalertmaximizable" type="checkbox" checked disabled><label class="disabled" for="testalertmaximizable" id="testalertmaximizablelabel">Maximizable</label>
<input id="testalertminimizable" type="checkbox" checked disabled><label class="disabled" for="testalertminimizable" id="testalertminimizablelabel">Minimizable</label>
</fieldset>
<fieldset>
<legend>Buttons</legend>
<input id="testalertbuttons" type="checkbox" checked disabled><label class="disabled" for="testalertbuttons" id="testalertbuttonslabel">Command</label>
<input id="testalertcaptionbuttons" type="checkbox" checked disabled><label class="disabled" for="testalertcaptionbuttons" id="testalertcaptionbuttonslabel">Caption</label>
<input id="testalerticon" type="checkbox" checked disabled><label class="disabled" for="testalerticon" id="testalerticonlabel">Icon</label>
</fieldset>
</fieldset>
<fieldset>
<legend>Class</legend>
<input id="testalertclassinformational" name="testalertclass" type="radio" checked disabled><label id="testalertclassinformationallabel" for="testalertclassinformational" class="disabled">Informational</label>
<input id="testalertclasswarning" name="testalertclass" type="radio" disabled><label id="testalertclasswarninglabel" for="testalertclasswarning" class="disabled">Warning</label>
<input id="testalertclasserror" name="testalertclass" type="radio" disabled><label id="testalertclasserrorlabel" for="testalertclasserror" class="disabled">Error</label>
<fieldset class="abrupt">
<legend>Skin</legend>
<div class="dialognote">The skin can be changed with a View command in some browsers. Applications can use the <a href="mylib-doc.asp#setactivestylesheet"><code>setActiveStyleSheet</code></a> API function, as seen in the <a href="#mytoolbar">Toolbar</a> example.</div>
<input id="testalertclassrounded" type="checkbox" checked disabled><label id="testalertclassroundedlabel" for="testalertclassrounded" class="disabled">Rounded</label>
<input id="testalertclassshadowed" type="checkbox" checked disabled><label id="testalertclassshadowedlabel" for="testalertclassshadowed" class="disabled">Shadowed</label>
<input id="testalertclasswrapped" type="checkbox" checked disabled><label id="testalertclasswrappedlabel" for="testalertclasswrapped" class="disabled">Wrap</label>
</fieldset>
</fieldset>
<fieldset>
<legend>CSS Transitions</legend>
<div class="dialognote"><strong>Note</strong> that CSS transitions do not work in all browsers. In this example, only the curtain has CSS transitions declared in the skins. Switching between CSS and scripted transitions is an <em>experimental</em> feature.</div>
<input name="testalerttransitioned" id="testalerttransitionedalways" type="radio" disabled><label id="testalerttransitionedalwayslabel" for="testalerttransitionedalways" class="disabled">Always</label>
<input name="testalerttransitioned" id="testalerttransitionedonanimation" type="radio" disabled><label id="testalerttransitionedonanimationlabel" for="testalerttransitionedonanimation" class="disabled">On Animation</label>
<input name="testalerttransitioned" id="testalerttransitionednever" type="radio" checked disabled><label id="testalerttransitionedneverlabel" for="testalerttransitionednever" class="disabled">Never</label>
</fieldset>
<fieldset>
<legend><label for="animatealert" id="animatealertlabel" class="disabled">Animate</label><select id="animatealert" disabled><option selected>[None]</option></select></legend>
<label for="durationalert" id="durationalertlabel" class="disabled">Duration:</label><input id="durationalert" class="textinput" value=".7" disabled><span id="durationalertdecoration" class="disabled">seconds</span>
<label for="easealert" id="easealertlabel" class="disabled">Easing:</label><select id="easealert" disabled><option>[None]</option></select>
<input type="checkbox" id="addfadealert" disabled><label for="addfadealert" id="addfadealertlabel" class="disabled">Add Fade</label>
</fieldset>
<fieldset>
<legend><input id="animatecurtain" type="checkbox" disabled><label id="animatecurtainlabel" for="animatecurtain" class="disabled">Animate Curtain</label></legend>
<label for="durationcurtain" id="durationcurtainlabel" class="disabled">Duration:</label><input id="durationcurtain" class="textinput" value=".4" disabled><span id="durationcurtaindecoration" class="disabled">seconds</span>
<label for="easecurtain" id="easecurtainlabel" class="disabled">Easing:</label><select id="easecurtain" disabled><option>[None]</option></select>
</fieldset>
<fieldset id="alerttestmessages">
<legend>Test Messages</legend>
<div>
<label for="testalertpositivemessage" id="testalertpositivemessagelabel" class="disabled">Positive:</label><input id="testalertpositivemessage" value="Affirmative" disabled>
<label for="testalertnegativemessage" id="testalertnegativemessagelabel" class="disabled">Negative:</label><input id="testalertnegativemessage" value="Negative" disabled>
</div>
<div>
<label for="testalertindeterminatemessage" id="testalertindeterminatemessagelabel" class="disabled">Indeterminate:</label><input id="testalertindeterminatemessage" value="Unsure" disabled>
<label for="testalerthelpmessage" id="testalerthelpmessagelabel" class="disabled">Help:</label><input id="testalerthelpmessage" disabled>
</div>
<div>
<label for="testalertsavemessage" id="testalertsavemessagelabel" class="disabled">Save:</label><input id="testalertsavemessage" value="Save" disabled>
<label for="testalertstepmessage" id="testalertstepmessagelabel" class="disabled">Step:</label><input id="testalertstepmessage" value="Step" disabled>
</div>
</fieldset>
<input id="testalert" type="button" value="Show" disabled><input id="testalerthide" type="button" value="Hide" disabled><input id="testalertdirty" type="button" value="Set Dirty" disabled><input id="testalertdirtyexternal" type="button" value="Set Dirty (External)" disabled><input type="button" id="testalertfocus" value="Focus" disabled><input type="button" id="testalertblur" value="Blur" disabled><input type="button" value="Flash" id="testalertflash" disabled>
</fieldset>
<pre id="codealert" class="code">
(Code will appear hear when popup is shown)
</pre>
<h3 id="scrollinganchors">Scrolling Anchors</h3>
<p>The Scrolling Anchors add-on enables scrolling effects for navigation within the document. <span id="autoscroll">For this example, it is started automatically</span>. See the <a href="#toc">table of contents</a> for links that navigate to anchors.</p>
<p><strong>Note</strong> that the <code>updateHash</code> option to change the hash at the end of the scroll (enabled by default as it is typically the desired behavior) will disallow some browsers (e.g. IE6/7), degrading back to standard navigation. This is a better strategy for such an enhancement than using hacks involving extraneous <code>iframe</code> elements. The functions return <code>false</code> in these cases. Like <em>any</em> script that modifies the hash (e.g. Ajax "history managers" and "back button fixers"), this add-on is <em>not</em> normally recommended, except as an example (or perhaps for a game application).</p>
<pre>
API.attachLinkScrollEvents({
duration: 1000,
ease: API.ease.circle
});
</pre>
<p>This example allows interruption of the animation by the mousewheel.</p>
<pre>
API.attachLinkScrollEvents({
duration: 1000,
ease: API.ease.circle,
wheelInterrupts: true
});
</pre>
<p>This example will not update the hash on navigation.</p>
<pre>
API.attachLinkScrollEvents({
duration: 1000,
ease: API.ease.circle,
updateHash: false
});
</pre>
<p>This example will animate on back and forward actions when possible.</p>
<pre>
API.attachLinkScrollEvents({
duration: 1000,
ease: API.ease.circle,
animateBackForward: true
});
</pre>
<h3 id="sidebars">Sidebar</h3>
<p>The Sidebar widgets are panels arranged around the edges of the viewport. The inner rectangle created can be retrieved with the <code>getWorkspaceRectangle</code> API function and is used for centering and maximizing other widgets (e.g. <a href="#myalert">alert</a>).</p>
<fieldset>
<legend>Create</legend>
<input type="button" id="createsidebarleft" value="Left" disabled>
<input type="button" id="createsidebartop" value="Top" disabled>
<input type="button" id="createsidebarbottom" value="Bottom" disabled>
<input type="button" id="createsidebarright" value="Right" disabled>
</fieldset>
<pre id="codesidebar">
(Code will appear on creation)
</pre>
<h3 id="toast">Toast</h3>
<p>The Toast widget corners elements.</p>
<fieldset>
<legend>Create</legend>
<label for="createtoasttext" id="createtoasttextlabel" class="disabled">Text:</label>
<textarea rows="5" cols="80" id="createtoasttext" disabled>This just in...
Toast is ready!</textarea>
<fieldset>
<legend>Options</legend>
<div class="aside"><input id="createtoastiniframe" type="checkbox" disabled><label for="createtoastiniframe" id="createtoastiniframelabel" class="disabled">in <code>iframe</code></label></div>
<label class="disabled" for="createtoastduration" id="createtoastdurationlabel">Duration:</label><input id="createtoastduration" class="textinput" value="5" disabled><span id="createtoastdurationdecoration" class="disabled">seconds</span>
<input type="checkbox" id="createtoastfixed"><label class="disabled" for="createtoastfixed" id="createtoastfixedlabel">Fixed</label>
</fieldset>
<fieldset>
<legend><label class="disabled" id="animatetoastlabel" for="animatetoast">Animate:</label><select id="animatetoast" disabled><option>[None]</option></select></legend>
<label for="durationtoast" id="durationtoastlabel" class="disabled">Duration:</label><input id="durationtoast" class="textinput" value=".7" disabled>
<label for="easetoast" id="easetoastlabel" class="disabled">Ease:</label><select id="easetoast" disabled><option selected>[None]</option></select>
<input type="checkbox" id="addfadetoast" disabled><label for="addfadetoast" id="addfadetoastlabel" class="disabled">Add Fade</label>
</fieldset>
<input type="button" id="createtoasttopleft" value="Top Left" disabled>
<input type="button" id="createtoasttopright" value="Top Right" disabled>
<input type="button" id="createtoastbottomleft" value="Bottom Left" disabled>
<input type="button" id="createtoastbottomright" value="Bottom Right" disabled>
</fieldset>
<script type="text/javascript">
if (API && API.isHostMethod && API.isHostMethod(this.document, 'write')) {
this.document.write('<iframe class="test" id="createtoastframe" src="blank.html"><\/iframe>');
}
</script>
<pre id="codetoast">
(Code will appear on creation)
</pre>
<h3 id="mytoolbar">Toolbar</h3>
<div class="toolbar panel" id="skintoolbar">
<div id="skinblues" title="Change to Blues skin (disabled)" class="commandbutton button disabled iconic">Blues</div><div title="Change to Doom skin (disabled)" id="skindoom" class="commandbutton button disabled iconic separator">Doom</div><div title="Change to Froggy skin (disabled)" id="skinfroggy" class="commandbutton button disabled iconic separator">Froggy</div><div title="Change to Hades skin (disabled)" id="skinhades" class="commandbutton button disabled iconic separator">Hades</div>
</div>
<p>This lovely toolbar was created from static markup with the Toolbar add-on. By default it is disabled. When skin changing features are available, it is enabled. When scripting is disabled, it still functions as an indicator of the current skin. Double-click to display an <a href="#myalert">alert</a>.</p>
<pre>
var el = enhanceToolbar(el, {
oncustomize: function() {
API.alert('No customization available', {
className: 'alert caution rounded shadowed',
title: 'Toolbar',
effects: API.effects && API.effects.drop,
ease: API.ease && API.ease.bounce
});
},
onclick: function(el, elButton) {
API.setActiveStyleSheet(elButton.id.substring(4));
if (API.setWaiProperty) {
API.forEach(getToolbarButtons(el), function(el) {
if (el != elButton) {
API.setWaiProperty(el, 'checked', 'false');
}
});
API.setWaiProperty(elButton, 'checked', 'true');
}
}
});
API.attachDragToToolbar(el);
</pre>
<h4>Application</h4>
<div id="apptoolbar" class="toolbar panel"><div id="apptoolbarnew" title="New (disabled)" class="commandbutton button nocaption iconic new disabled"></div><div id="apptoolbaropen" title="Open (disabled)" class="commandbutton button nocaption iconic open disabled"></div><div title="Save (disabled)" class="iconic nocaption commandbutton button save disabled"></div><div title="Cut (disabled)" class="iconic button commandbutton nocaption cut disabled separator"></div><div title="Copy (disabled)" class="iconic commandbutton button nocaption copy disabled"></div><div title="Paste (disabled)" class="iconic nocaption button commandbutton paste disabled"></div></div>
<p>What a cool application toolbar!</p>
<pre>
API.enhanceToolbar(API.getEBI('apptoolbar'), {
onclick:function(el, elButton) {
myAlert(elButton.id.slice(10), {
title:'Application',
className:'alert wrap rounded shadowed'
});
}
});
</pre>
<h4>As Tabstrip</h4>
<div class="toolbar panel tabstrip rounded" id="tabstrip">
<div title="This is a test (checked) (disabled)" class="commandbutton button disabled checked" id="testtab1a">This</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab2a">is</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab3a">a</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab4a">Test</div>
</div>
<div class="toolbar panel propertysheet">
<span id="testtab1acontent" class="highlighted">This</span> <span id="testtab2acontent">is</span> <span id="testtab3acontent">a</span> <span id="testtab4acontent">test</span>
</div>
<p>And this stunning entry was created from static markup with the Toolbar add-on. It is two toolbars stacked.</p>
<pre>
enhanceToolbar(el, {
radio: true,
onclick: function(el, elButton, elPreviousButton) {
API.forEach(API.getToolbarButtons(el), function(el) {
var elContent = API.getEBI(el.id + 'content');
if (el.id == elButton.id) {
API.addClass(elContent, 'highlighted');
API.removeClass(elContent, 'lowlighted');
} else {
API.removeClass(elContent, 'highlighted');
API.removeClass(elContent, 'lowlighted');
}
});
if (elPreviousButton) {
el = API.getEBI(elPreviousButton.id + 'content');
API.addClass(el, 'lowlighted');
}
}
});
</pre>
<h5>Advanced</h5>
<div class="toolbar panel tabstrip rounded" id="tabstrip2">
<div title="This is a test (checked) (disabled)" class="commandbutton button disabled checked" id="testtab1">This</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab2">is</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab3">a</div><div title="This is a test (disabled)" class="commandbutton button disabled" id="testtab4">Test</div>
</div>
<div class="toolbar panel propertysheet">
<div id="confirmchanges"><input type="checkbox" id="tabstripconfirm" disabled><label for="tabstripconfirm" id="tabstripconfirmlabel" class="disabled">Confirm changes</label></div><span id="testtab1content" class="highlighted">This</span> <span id="testtab2content">is</span> <span id="testtab3content">a</span> <span id="testtab4content">test</span>
</div>
<p>This example demonstrates canceling the default click action.</p>
<pre>
if (API.alert) {
myConfirm = function(text, options, cb) {
options.onpositive = cb;
options.decision = 'confirm';
API.alert(text, options);
};
} else if (API.isHostMethod(window, 'confirm')) {
myConfirm = function(text, options, cb) {
if (window.confirm(text)) {
cb();
}
};
}
enhanceToolbar(el, {
radio: true,
onclick: function(el, elButton, elPreviousButton) {
if (elButton == elPreviousButton) {
return;
}
var fn = function() {
API.forEach(API.getToolbarButtons(el), function(el) {
var elContent = API.getEBI(el.id + 'content');
API.removeClass(elContent, 'lowlighted');
if (el.id == elButton.id) {
API.addClass(elContent, 'highlighted');
} else {
API.removeClass(elContent, 'highlighted');
}
});
API.checkControl(elPreviousButton, false);
API.checkControl(elButton);
if (elPreviousButton) {
el = API.getEBI(elPreviousButton.id + 'content');
API.addClass(el, 'lowlighted');
}
};
if (API.getEBI('tabstripconfirm').checked) {
myConfirm('Changing to tab ' + elButton.id.slice(7), {
title:'Tabstrip',
effects:API.effects && API.effects.drop,
ease:API.ease && API.ease.sigmoid2,
className:'alert shadowed rounded'
}, fn);
return false;
}
fn();
}
});
</pre>
<h4>Creation</h4>
<p>Creating toolbars is fun and easy!</p>
<div id="toolbarlanding"></div>
<fieldset>
<legend>Create</legend>
<input type="button" id="createtoolbar" value="Toolbar" disabled>
<fieldset class="abrupt">
<legend><input type="button" id="createbutton" value="Button" disabled></legend>
<div class="dialognote">
Creating buttons is pretty cool too.
</div>
<label for="createbuttontext" id="createbuttontextlabel" class="disabled">Text:</label><input id="createbuttontext" value="Test" disabled>
<label for="createbuttontitle" id="createbuttontitlelabel" class="disabled">Title:</label><input id="createbuttontitle" value="This is a test" disabled>
<fieldset class="abrupt">
<legend>Class</legend>
<input type="checkbox" disabled checked id="createbuttoncommandbutton"><label for="createbuttoncommandbutton" id="createbuttoncommandbuttonlabel" class="disabled">Command</label>
<input type="checkbox" disabled id="createbuttonchecked"><label for="createbuttonchecked" id="createbuttoncheckedlabel" class="disabled">Checked</label>
<input type="checkbox" disabled id="createbuttonpressed"><label for="createbuttonpressed" id="createbuttonpressedlabel" class="disabled">Pressed</label>
<input type="checkbox" disabled id="createbuttondisabled"><label for="createbuttondisabled" id="createbuttondisabledlabel" class="disabled">Disabled</label>
<input type="checkbox" disabled id="createbuttonseparator"><label for="createbuttonseparator" id="createbuttonseparatorlabel" class="disabled">Separator</label>
<fieldset>
<legend>
<input type="checkbox" disabled id="createbuttoniconic"><label for="createbuttoniconic" id="createbuttoniconiclabel" class="disabled">Iconic</label>
</legend>
<input type="checkbox" disabled id="createbuttonskin"><label for="createbuttonskin" id="createbuttonskinlabel" class="disabled">Skin</label>
</fieldset>
</fieldset>
<input id="createbuttonremoveall" type="button" value="Remove All" disabled>
</fieldset>
</fieldset>
<pre id="codecreatetoolbar">
(Code will appear here on creation)
</pre>
<h3 id="transform">Transform</h3>
<p>The Transform add-on adds CSS3 2D transform functions to the API, as well as adding several new <a href="mylib-doc.asp#effects">effects</a> and augmenting the <a href="mylib-doc0.html#objects">object wrappers</a> when available.</p>
<p>These examples have been tested in Internet Explorer 5.5-8, Firefox 3.6, Safari 4, Chrome 3 and Opera 10.5. They were found to degrade properly in older or otherwise incompatible browsers.</p>
<p><strong>Note</strong> that the results are not <em>identical</em> in IE when compared to the others, but should be perfectly acceptable for these special effects as end-users don't often run multiple browsers side by side to compare minute rendering differences (that is the realm of Web developers). Also, the elements transformed all have static position styles, which highlights an additional difference between IE8 and the olders versions (transforms can push down the contents below). For the most consistent results (if older versions of IE are a concern), positioned elements are recommended.</p>
<p><strong>Note</strong> that off-brand multiple IE simulations will throw exceptions for some of the demos. This is the usual "library not registered" DirectX problem that exists with these setups. Tested with IETester and MultipleIEs.</p>
<h4 id="transformbasic">Basic</h4>
<p>This example demonstrates basic transforms.</p>
<div id="testtransform">
<img src="images/painting1.jpg" height="194" width="297" alt="">
<em>Birds of a Feather</em>
</div>
<fieldset id="transformfields" class="abrupt">
<legend>Transform</legend>
<label id="rotatelabel" for="rotate" class="disabled">Rotation:</label><input id="rotate" class="textinput" value="0" disabled><span id="rotatedecoration" class="disabled">°</span>
<label id="skewlabel" for="skew" class="disabled">Skew:</label><input id="skew" class="textinput" value="0" disabled><span id="skewdecoration" class="disabled">°</span>
<label id="scalelabel" for="scale" class="disabled">Scale:</label><input id="scale" class="textinput" value="100" disabled><span id="scaledecoration" class="disabled">%</span>
<fieldset class="abrupt">
<legend>Flip</legend>
<input id="flipnone" name="flipit" type="radio" checked disabled><label id="flipnonelabel" for="flipnone" class="disabled">None</label>
<input id="fliph" name="flipit" type="radio" disabled><label id="fliphlabel" for="fliph" class="disabled">Horizontal</label>
<input id="flipv" name="flipit" type="radio" disabled><label id="flipvlabel" for="flipv" class="disabled">Vertical</label>
<input id="flip" name="flipit" type="radio" disabled><label id="fliplabel" for="flip" class="disabled">Both</label>
</fieldset>
<fieldset>
<legend>Origin</legend>
<div class="dialognote"><strong>Note</strong> that the origin changes can be animated, but are not in this example.</div>
<label id="xoriginlabel" for="xorigin" class="disabled">X:</label><input id="xorigin" class="textinput" value="50%" disabled>
<label id="yoriginlabel" for="yorigin" class="disabled">Y:</label><input id="yorigin" class="textinput" value="50%" disabled>
</fieldset>
<fieldset>
<legend>Matrix</legend>
<label for="matrixa">a:</label><input id="matrixa" value="1" class="matrix flat" readonly>
<label for="matrixb">b:</label><input id="matrixb" value="0" class="matrix flat" readonly>
<label for="matrixc">c:</label><input id="matrixc" value="0" class="matrix flat" readonly>
<label for="matrixd">d:</label><input id="matrixd" value="1" class="matrix flat" readonly>
<input id="copymatrix" type="button" value="Copy to Matrix Example" disabled>
</fieldset>
<fieldset>
<legend><input id="animate" type="checkbox" disabled><label for="animate" id="animatelabel" class="disabled">Animate</label></legend>
<label for="duration" id="durationlabel" class="disabled">Duration:</label><input id="duration" class="textinput" value="1" disabled><span id="durationdecoration" class="disabled">seconds</span>
<label for="ease" id="easelabel" class="disabled">Easing:</label><select id="ease" disabled><option>[None]</option></select>
</fieldset>
<input type="button" id="apply" value="Apply" disabled><input type="button" id="reset" value="Reset" disabled>
</fieldset>
<pre id="code">(Code will appear here when the transform is applied)</pre>
<h4 id="transformbymatrix">By Matrix</h4>
<p>This example demonstrates transforming by matrix.</p>
<div id="testtransformadvanced">
<img src="images/painting2.jpg" height="194" width="297" alt="">
<em>Run Rabbit, Run</em>
</div>
<fieldset id="transformfieldsadvanced" class="abrupt">
<legend>Transform</legend>
<fieldset>
<legend>Matrix</legend>
<label id="matrixaadvancedlabel" for="matrixaadvanced" class="disabled">a:</label><input id="matrixaadvanced" class="matrix" value="1" disabled>
<label id="matrixbadvancedlabel" for="matrixbadvanced" class="disabled">b:</label><input id="matrixbadvanced" class="matrix" value="0" disabled>
<label id="matrixcadvancedlabel" for="matrixcadvanced" class="disabled">c:</label><input id="matrixcadvanced" class="matrix" value="0" disabled>
<label id="matrixdadvancedlabel" for="matrixdadvanced" class="disabled">d:</label><input id="matrixdadvanced" class="matrix" value="1" disabled>
</fieldset>
<fieldset>
<legend>Origin</legend>
<div class="dialognote"><strong>Note</strong> that the origin changes can be animated, but are not in this example.</div>
<label id="xoriginadvancedlabel" for="xoriginadvanced" class="disabled">X:</label><input id="xoriginadvanced" class="textinput" value="50%" disabled>
<label id="yoriginadvancedlabel" for="yoriginadvanced" class="disabled">Y:</label><input id="yoriginadvanced" class="textinput" value="50%" disabled>
</fieldset>
<fieldset>
<legend><input id="animateadvanced" type="checkbox" disabled><label for="animateadvanced" id="animateadvancedlabel" class="disabled">Animate</label></legend>
<label for="durationadvanced" id="durationadvancedlabel" class="disabled">Duration:</label><input id="durationadvanced" class="textinput" value="1" disabled><span id="durationadvanceddecoration" class="disabled">seconds</span>
<label for="easeadvanced" id="easeadvancedlabel" class="disabled">Easing:</label><select id="easeadvanced" disabled><option>[None]</option></select>
</fieldset>
<input type="button" id="applyadvanced" value="Apply" disabled><input type="button" id="resetadvanced" value="Reset" disabled>
</fieldset>
<pre id="codeadvanced">(Code will appear here when the matrix is applied)</pre>
<h4 id="transformreveal">Reveal</h4>
<p>This example demonstrates the basic effects added by the Transform add-on, toggling the visibility of the image. There is a more complex <code>transform</code> effect that will be the subject of a future example.</p>
<div>
<img id="imagereveal" src="images/painting1.jpg" height="194" width="297" alt="">
</div>
<fieldset id="consolereveal">
<legend>Reveal</legend>
<fieldset>
<legend><label for="animatereveal" id="animatereveallabel" class="disabled">Animate</label><select id="animatereveal" disabled><option selected>[None]</option></select></legend>
<label for="durationreveal" id="durationreveallabel" class="disabled">Duration:</label><input id="durationreveal" class="textinput" value="1" disabled><span id="durationrevealdecoration" class="disabled">seconds</span>
<label for="easereveal" id="easereveallabel" class="disabled">Easing:</label><select id="easereveal" disabled><option>[None]</option></select>
<input type="checkbox" id="addfadereveal" disabled><label for="addfadereveal" id="addfadereveallabel" class="disabled">Add Fade</label>
</fieldset>
<input type="button" id="toggle" value="Toggle" disabled>
</fieldset>
<pre id="codereveal">(Code will appear here when the element is toggled)</pre>
<h2 id="userexamples">User Examples</h2>
<p>My Library has a vibrant and growing community of authors. Here are some examples of their work. Thanks to all who contribute!</p>
<h3 id="slideshow">Slide Show</h3>
<p>This <a href="http://souagil.com.br/gabriel/myimagegallery/">slide show application</a> was created by Gabriel Gilini.</p>
<h3 id="tabbedpane">Tabbed Pane</h3>
<p>This <a href="http://code.eblackwelder.com/demos/MyWidgetsLibrary/MyTabs/index.html">tabbed pane widget</a> was created by Ethan B.</p>
<div id="logo"><a href="mylib.html" title="Home"><img src="images/mylibrarylogo.jpg" height="108" width="260" alt="My Library" title="Home"></a></div>
<p class="meta">Last Modified: 6 May 2010 22:29:00 GMT</p>
<address>By <a title="Send email to David Mark" href="mailto:[email protected]">David Mark</a></address>
<div class="legal">Copyright © 2007-2010 by <a href="mailto:[email protected]">David Mark</a>. All Rights Reserved.</div>
</div>
<script type="text/javascript" src="mylib-funpack-min.js"></script>
<!--<script type="text/javascript" src="mylib-unclip.js"></script>
<script type="text/javascript" src="mylib-fix.js"></script>
<script type="text/javascript" src="mylib-transform-min.js"></script>
<script type="text/javascript" src="mylib-widgets.js"></script>
<script type="text/javascript" src="mylib-playlist.js"></script>
<script type="text/javascript" src="mylib-alert.js"></script>
<script type="text/javascript" src="mylib-toolbar.js"></script>
<script type="text/javascript" src="mylib-sidebar.js"></script>
<script type="text/javascript" src="mylib-toast.js"></script>-->
<script type="text/javascript" src="mylib-anchorscroll-min.js"></script>
<script type="text/javascript">
var API;
if (API && API.forEach && API.attachDocumentReadyListener) {
API.attachDocumentReadyListener(function() {
var el, i, missingElement, attachListener = API.attachListener, forEach = API.forEach, map = API.map, getEBI = API.getEBI, getKeyboardKey = API.getKeyboardKey, isHostMethod = API.isHostMethod, isOwnProperty = API.isOwnProperty, addOption = API.addOption, setElementText = API.setElementText, toggleElement = API.toggleElement, canAdjustStyle = API.canAdjustStyle, showElement = API.showElement;
var testTransform, transforms = ['skew', 'scale', 'rotate', 'flip', 'flipH', 'flipV'];
var matrixEntries = ['a', 'b', 'c', 'd'];
var reOrigin = /^\d+(\.\d+)?%?$/;
var showAlertStyle = function(e) {
var el = getEBI('examplealertstyle');
if (el) {
// For backward compatibility with agents that can't compute styles
// Ensures showElement will set the display style as well as visibility
el.style.display = 'none';
showElement(el, true, {
effects: API.effects && API.effects.fade,
ease: API.ease && API.ease.sigmoid2,
duration: 700
});
el = getEBI('examplealertstyleanchor');
el.href = el.title = '';
if (API.removeAttribute) {
API.removeAttribute(el, 'href');
}
API.detachListener(el, 'click', showAlertStyle);
}
return API.cancelDefault(e);
};
// Create link to show example alert style
if (attachListener && getEBI && canAdjustStyle && showElement && canAdjustStyle('display')) {
el = getEBI('examplealertstyleanchor');
if (el) {
el.href = '#';
el.tabIndex = 0;
el.title = 'Show example style';
attachListener(el, 'click', showAlertStyle);
}
}
var myAlert, myConfirm, playEventSound = API.playEventSound;
if (API.alert) {
myAlert = function(text, options) {
var elSoundIndicator = getEBI('eventsounds');
if (elSoundIndicator && elSoundIndicator.value == 'Enable') {
options.mute = true;
}
API.alert(text, options);
};
} else if (isHostMethod(window, 'alert')) {
myAlert = function(text) {
window.alert(text);
};
} else if (API.log) {
myAlert = function(text) {
API.log(text);
};
}
if (API.alert) {
myConfirm = function(text, options, cb) {
options.onpositive = cb;
options.decision = 'confirm';
var elSoundIndicator = getEBI('eventsounds');
if (elSoundIndicator && elSoundIndicator.value == 'Enable') {
options.mute = true;
}
API.alert(text, options);
};
} else if (isHostMethod(window, 'confirm')) {
myConfirm = function(text, options, cb) {
if (window.confirm(text)) {
cb();
}
};
}
var setDisabledClass = function(el, disabled) {
el.className = disabled ? 'disabled' : '';
};
var enableFormControl = function(el, disabled) {
var id = el.id;
el.disabled = !!disabled;
if (typeof el.title == 'string' && el.title) {
el.title = el.title.replace(/ \(disabled\)$/, disabled ? ' (disabled)' : '');
}
el = getEBI(id + 'label');
if (el) {
setDisabledClass(el, disabled);
}
el = getEBI(id + 'decoration');
if (el) {
setDisabledClass(el, disabled);
}
};
var updateEffectControls = function(name, disabled) {
forEach(['duration', 'ease'], function(id) {
el = getEBI(id + name);
enableFormControl(el, disabled);
});
};
var updateEffectControlsAfterward = function(name) {
// Set timeout as some browsers (e.g. Mac IE) update the checked property after the click event fires
var el = getEBI('animate' + name);
window.setTimeout(function() {
updateEffectControls(name, el.type == 'checkbox' ? !el.checked : (el.selectedIndex < 1));
}, 1);
};
var attachFocusListener;
var focusListener = function(e) {
if (API.isAlertModal()) {
window.setTimeout(function() {
API.focusAlert();
}, 1);
return API.cancelDefault(e);
}
};
if (API.alert) {
attachFocusListener = function(el) {
attachListener(el, 'focus', focusListener);
};
}
var elEnterKeyDown, attachDocumentListener = API.attachDocumentListener, getEventTarget = API.getEventTarget;
attachDocumentListener('keydown', function(e) {
var el = getEventTarget(e);
if (getKeyboardKey(e) == 13) {
elEnterKeyDown = el;
}
});
var attachEnterListener = function(el, fn) {
attachListener(el, 'keyup', function(e) {
var key = getKeyboardKey(e);
if (key == 13) {
if (this == elEnterKeyDown) {
elEnterKeyDown = null;
fn(this);
return API.cancelDefault(e);
}
}
});
if (attachFocusListener) {
attachFocusListener(el);
}
};
var enableAndAttachEnterListener = function(el, fn) {
enableFormControl(el);
if (el.type == 'text') {
attachEnterListener(el, fn);
} else if (attachFocusListener) {
attachFocusListener(el);
}
};
var enableAndAttachEnterListeners = function(names, fn) {
forEach(names, function(name) {
var el = getEBI(name.toLowerCase());
if (el) {
enableAndAttachEnterListener(el, fn);
} else {
return false;
}
});
return true;
};
var enableOriginControls = function(names, fn) {
if (API.setElementTransformOrigin) {
return enableAndAttachEnterListeners(names, fn);
}
return true;
};
var populateEaseControl = function(name) {
var i, l, el = getEBI('ease' + name), easing = [];
for (i in API.ease) {
if (isOwnProperty(API.ease, i)) {
easing[easing.length] = i;
}
}
if (easing.sort) {
easing.sort();
}
for (i = 0, l = easing.length; i < l; i++) {
addOption(el, easing[i]);
}
};
var enableAnimationControls = function(name, fn) {
var el = getEBI('animate' + name);
if (el && getEBI('duration' + name) && getEBI('ease' + name)) {
enableFormControl(el);
attachListener(el, 'click', function() {
updateEffectControlsAfterward(name);
});
} else {
return false;
}
if ((el = getEBI('ease' + name))) {
populateEaseControl(name);
el = getEBI('duration' + name);
if (el) {
attachEnterListener(el, fn);
updateEffectControlsAfterward(name);
} else {
return false;
}
} else {
return false;
}
return true;
};
var validateOrigin = function(value) {
if (value.charAt(0) == '.') {
value = '0' + value;
}
if (reOrigin.test(value)) {
return true;
}
return false;
};
var originControlNames = function(name) {
return map(['x', 'y'], function(origin) {
return origin + 'origin' + name;
});
};
var matrixControlNames = function(name) {
return map(matrixEntries, function(entry) {
return 'matrix' + entry + name;
});
};
var originCode = function(origin) {
return "API.setElementTransformOrigin(el, ['" + origin[0] + "', '" + origin[1] + "']);\n";
};
var animationCode = function(options, easeName) {
var code = ', {\n duration: ' + options.duration;
if (options.ease) {
code += ',\n ease: API.ease.' + easeName;
}
code += '\n}';
return code;
};
var effectOptions = function(name) {
var options, el = getEBI('animate' + name);
if (el.checked) {
el = getEBI('duration' + name);
var duration = +el.value;
if (duration >= 0) {
options = { duration: duration * 1000 };
// Add easing option if applicable
el = getEBI('ease' + name);
if (el.selectedIndex > 0) {
options.ease = API.ease[el.options[el.selectedIndex].text];
}
} else {
options = null;
}
}
return options;
};
var showError = function(error, elError) {
if (isHostMethod(elError, 'blur')) {
elError.blur();
}
myAlert(error, {
duration:400,
effects:API.effects.fade,