1 $( document ).bind("pagecreate", function () {
2 /* Color widget demo */
3 $("input[type='checkbox'][data-widget-type-list]").bind("change", function() {
4 var ls = $( this ).attr("data-widget-type-list").split(","),
5 page = $( this ).closest(":jqmData(role='page')"),
6 disabled = $( this ).is(":checked");
8 $.each(ls, function( idx, widgetType ) {
9 var ar = widgetType.split("-");
11 if ( ar.length === 2 ) {
12 page.find(":" + widgetType)[ar[1]]( "option", "disabled", disabled );
17 $("#checkHideInput").bind("change", function (e) {
18 $("#colorpickerbutton").colorpickerbutton("option", "hideInput", $("#checkHideInput").is(":checked"));
21 $('#scroller-demo').bind('pageshow', function ( e ) {
22 $page = $( e.target );
24 * many options cannot be set without subclassing since they're
25 * used in the _create method - it seems as if these are for
26 * internal use only and scrollDuration is only changable by
29 var $scroller2List = $('#scroller2').find('ul');
30 $scroller2List.scrollview( 'option','scrollDuration','10000' );
32 // only works by manipulating css
33 // the only other way is to use attribute 'scroll-method="scroll"' in html
34 $('#scroller2 .ui-scrollbar').css( 'visibility','hidden' );
37 * make toggle button switch scroll bars on and off
39 var scrollBarVisible = $('#scroller2').find('.ui-scrollbar').css('visibility') === "visible";
41 var $toggleScrollBars = $('#toggleScrollBars');
42 $toggleScrollBars.attr( "checked", scrollBarVisible ).checkboxradio("refresh");
44 /* the 'label' is the thing that is clicked, not the input element */
45 var $label = $toggleScrollBars.siblings('label').attr( 'for', '#toggleScrollBars' );
46 $label.bind("click", function () {
47 var $scrollBar = $('#scroller2').find('.ui-scrollbar');
48 var scrollBarVisible = $scrollBar.css('visibility') === "visible";
49 var newVisibility = scrollBarVisible ? "hidden" : "visible";
50 $scrollBar.css( 'visibility', scrollBarVisible ? "hidden" : "visible" );
54 $("#demo-date").bind("date-changed", function ( e, newDate ) {
55 $("#selected-date1").text( newDate.toString() );
58 $("#demo-date2").bind("date-changed", function ( e, newDate ) {
59 $("#selected-date2").text( newDate.toString() );
62 $("#demo-date3").bind("date-changed", function ( e, newDate ) {
63 $("#selected-date3").text( newDate.toString() );
66 $("#demo-date4").bind("date-changed", function ( e, newDate ) {
67 $("#selected-date4").text( newDate.toString() );
70 $('#noti-demo').bind('vmouseup', function ( e ) {
71 $('#notification').notification('open');
74 $('#noti-icon1').bind('vclick', function ( e ) {
75 $('#notification').notification('icon', './test/icon02.png');
78 $('#noti-icon2').bind('vclick', function ( e ) {
79 $('#notification').notification('icon', './test/icon01.png');
82 $('#imageslider-add').bind('vmouseup', function ( e ) {
83 $('#imageslider').imageslider('add', './test/10.jpg');
84 $('#imageslider').imageslider('add', './test/11.jpg');
85 $('#imageslider').imageslider('refresh');
88 $('#imageslider-del').bind('vmouseup', function ( e ) {
89 $('#imageslider').imageslider('remove');
92 $('#selectioninfo-demo').bind('vmouseup', function ( e ) {
93 $('#smallpopup_selectioninfo').notification( "text",
94 $("#dayselector1").find(".ui-checkbox-on").length + " items are selected" );
95 $('#smallpopup_selectioninfo').notification('open');
98 $('#groupindex-demo').bind('pageshow', function () {
99 $('#groupindex').scrolllistview();
102 $("#showVolumeButton").bind("vclick", function ( e ) {
103 $("#myVolumeControl").volumecontrol("open");
106 $("#volumecontrol_setBasicTone").bind("change", function ( e ) {
107 var basicTone = !($("#volumecontrol_setBasicTone").next('label')
108 .find(".ui-icon").hasClass("ui-icon-checkbox-on"));
111 $("#myVolumeControl").volumecontrol( "option", "basicTone", true );
112 $("#myVolumeControl").volumecontrol( "option", "title", "Basic Tone" );
114 $("#myVolumeControl").volumecontrol( "option", "basicTone", false );
115 $("#myVolumeControl").volumecontrol( "option", "title", "Volume" );
119 $("#myoptionheader").bind('collapse', function () {
120 console.log('option header was collapsed');
123 $("#myoptionheader").bind('expand', function () {
124 console.log('option header was expanded');
127 //day-selector codes...
128 $("#day-selector-check-all").live('vclick', function () {
129 $("#dayselector1").dayselector('selectAll');
132 $("#day-selector-get-days").live('vclick', function () {
133 var valuesStr = $("#dayselector1").dayselector('value').join(', ');
134 $(".selectedDay").text( valuesStr );
137 /* Gen list : Dummy DB load */
138 $(".virtuallist_demo_page").live("pagecreate", function () {
139 /* ?_=ts code for no cache mechanism */
140 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
141 $("ul").filter( function () {
142 return $( this ).data("role") == "virtuallistview";
143 }).addClass("vlLoadSuccess");
145 $(".virtuallist_demo_page").die();
146 $("ul.ui-virtual-list-container").virtuallistview("create");
150 /*Expandable list : Dummy DB load*/
151 $("#genlist_extendable_page").live("pagecreate", function ( el ) {
152 /*?_=ts code for no cache mechanism*/
153 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
154 $("ul").filter( function () {
155 return $( this ).data("role") == "extendablelist";
156 }).addClass("elLoadSuccess");
158 $("#genlist-extendable-page").die();
159 $("ul.ui-extendable-list-container").extendablelist("create");
160 // TODO: 'create' is called twice!!
164 /* Color widget demo */
165 var clrWidgetsAreInit = false;
166 $("#colorwidgets-demo").bind("pageshow", function () {
167 if ( clrWidgetsAreInit ) {
171 $("#colorpicker").bind("colorchanged", function ( e, clr ) {
172 $("#colorpickerbutton").colorpickerbutton( "option", "color", clr );
173 $("#colorpickerbutton-noform").colorpickerbutton( "option", "color", clr );
174 $("#hsvpicker").hsvpicker( "option", "color", clr );
175 $("#colortitle").colortitle( "option", "color", clr );
176 $("#colorpalette").colorpalette( "option", "color", clr );
179 $("#colorpickerbutton").bind("colorchanged", function ( e, clr ) {
180 $("#colorpicker").colorpicker( "option", "color", clr );
181 $("#colorpickerbutton-noform").colorpickerbutton( "option", "color", clr );
182 $("#hsvpicker").hsvpicker( "option", "color", clr );
183 $("#colortitle").colortitle( "option", "color", clr );
184 $("#colorpalette").colorpalette( "option", "color", clr );
187 $("#colorpickerbutton-noform").bind("colorchanged", function ( e, clr ) {
188 $("#colorpicker").colorpicker( "option", "color", clr );
189 $("#colorpickerbutton").colorpickerbutton( "option", "color", clr );
190 $("#hsvpicker").hsvpicker( "option", "color", clr );
191 $("#colortitle").colortitle( "option", "color", clr );
192 $("#colorpalette").colorpalette( "option", "color", clr );
195 $("#hsvpicker").bind("colorchanged", function ( e, clr ) {
196 $("#colorpicker").colorpicker( "option", "color", clr );
197 $("#colorpickerbutton").colorpickerbutton( "option", "color", clr );
198 $("#colorpickerbutton-noform").colorpickerbutton( "option", "color", clr );
199 $("#colortitle").colortitle( "option", "color", clr );
200 $("#colorpalette").colorpalette( "option", "color", clr );
203 $("#colortitle").bind("colorchanged", function ( e, clr ) {
204 $("#colorpicker").colorpicker( "option", "color", clr );
205 $("#colorpickerbutton").colorpickerbutton( "option", "color", clr );
206 $("#colorpickerbutton-noform").colorpickerbutton( "option", "color", clr );
207 $("#hsvpicker").hsvpicker( "option", "color", clr );
208 $("#colorpalette").colorpalette( "option", "color", clr );
211 $("#colorpalette").bind("colorchanged", function ( e, clr ) {
212 $("#colorpicker").colorpicker( "option", "color", clr );
213 $("#colorpickerbutton").colorpickerbutton( "option", "color", clr );
214 $("#colorpickerbutton-noform").colorpickerbutton( "option", "color", clr );
215 $("#hsvpicker").hsvpicker( "option", "color", clr );
216 $("#colortitle").colortitle( "option", "color", clr );
219 $("#colorpalette").colorpalette("option", "color", "#45cc98");
221 clrWidgetsAreInit = true;
225 $(document).ready( function () {
226 // add current datetime with browser language format
227 // NOTE: Globalize.* functions must be run after docoument ready.
228 $('#current_date').html(Globalize.culture().name + " -- " +
229 Globalize.format( new Date(), "F" ));
230 $('#html_font_size').html('html font size:' + $('html').css('font-size'));