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 $('#scroller-demo').bind('pageshow', function ( e ) {
18 $page = $( e.target );
20 * many options cannot be set without subclassing since they're
21 * used in the _create method - it seems as if these are for
22 * internal use only and scrollDuration is only changable by
25 var $scroller2List = $('#scroller2').find('ul');
26 $scroller2List.scrollview( 'option','scrollDuration','10000' );
28 // only works by manipulating css
29 // the only other way is to use attribute 'scroll-method="scroll"' in html
30 $('#scroller2 .ui-scrollbar').css( 'visibility','hidden' );
33 * make toggle button switch scroll bars on and off
35 var scrollBarVisible = $('#scroller2').find('.ui-scrollbar').css('visibility') === "visible";
37 var $toggleScrollBars = $('#toggleScrollBars');
38 $toggleScrollBars.attr( "checked", scrollBarVisible ).checkboxradio("refresh");
40 /* the 'label' is the thing that is clicked, not the input element */
41 var $label = $toggleScrollBars.siblings('label').attr( 'for', '#toggleScrollBars' );
42 $label.bind("click", function () {
43 var $scrollBar = $('#scroller2').find('.ui-scrollbar');
44 var scrollBarVisible = $scrollBar.css('visibility') === "visible";
45 var newVisibility = scrollBarVisible ? "hidden" : "visible";
46 $scrollBar.css( 'visibility', scrollBarVisible ? "hidden" : "visible" );
50 $("#demo-date").bind("date-changed", function ( e, newDate ) {
51 $("#selected-date1").text( newDate.toString() );
54 $("#demo-date2").bind("date-changed", function ( e, newDate ) {
55 $("#selected-date2").text( newDate.toString() );
58 $("#demo-date3").bind("date-changed", function ( e, newDate ) {
59 $("#selected-date3").text( newDate.toString() );
62 $("#demo-date4").bind("date-changed", function ( e, newDate ) {
63 $("#selected-date4").text( newDate.toString() );
66 $('#noti-demo').bind('vmouseup', function ( e ) {
67 $('#notification').notification('open');
70 $('#noti-icon1').bind('vclick', function ( e ) {
71 $('#notification').notification('icon', './test/icon02.png');
74 $('#noti-icon2').bind('vclick', function ( e ) {
75 $('#notification').notification('icon', './test/icon01.png');
78 $('#gallery-demo').bind('pageshow', function () {
79 $('#gallery').gallery('add', './test/01.jpg');
80 $('#gallery').gallery('add', './test/02.jpg');
81 $('#gallery').gallery('add', './test/03.jpg');
82 $('#gallery').gallery('add', './test/04.jpg');
83 $('#gallery').gallery('add', './test/05.jpg');
84 $('#gallery').gallery('add', './test/06.jpg');
85 $('#gallery').gallery('add', './test/07.jpg');
86 $('#gallery').gallery('add', './test/08.jpg');
87 $('#gallery').gallery('add', './test/09.jpg');
88 $('#gallery').gallery('refresh', 3);
91 $('#gallery-demo').bind('pagebeforehide', function () {
92 $('#gallery').gallery('empty');
95 $('#gallery-add').bind('vmouseup', function ( e ) {
96 $('#gallery').gallery('add', './test/10.jpg');
97 $('#gallery').gallery('add', './test/11.jpg');
98 $('#gallery').gallery('refresh');
101 $('#gallery-del').bind('vmouseup', function ( e ) {
102 $('#gallery').gallery('remove');
105 $('#selectioninfo-demo').bind('vmouseup', function ( e ) {
106 $('#smallpopup_selectioninfo').notification( "text",
107 $("#dayselector1").find(".ui-checkbox-on").length + " items are selected" );
108 $('#smallpopup_selectioninfo').notification('open');
111 $('#groupindex-demo').bind('pageshow', function () {
112 $('#groupindex').scrolllistview();
115 $("#showVolumeButton").bind("vclick", function ( e ) {
116 $("#myVolumeControl").volumecontrol("open");
119 $("#volumecontrol_setBasicTone").bind("change", function ( e ) {
120 var basicTone = !($("#volumecontrol_setBasicTone").next('label')
121 .find(".ui-icon").hasClass("ui-icon-checkbox-on"));
124 $("#myVolumeControl").volumecontrol( "option", "basicTone", true );
125 $("#myVolumeControl").volumecontrol( "option", "title", "Basic Tone" );
127 $("#myVolumeControl").volumecontrol( "option", "basicTone", false );
128 $("#myVolumeControl").volumecontrol( "option", "title", "Volume" );
132 $("#myoptionheader").bind('collapse', function () {
133 console.log('option header was collapsed');
136 $("#myoptionheader").bind('expand', function () {
137 console.log('option header was expanded');
140 /* Gen list : Dummy DB load */
141 $(".virtuallist_demo_page").live("pagecreate", function () {
142 /* ?_=ts code for no cache mechanism */
143 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
144 $("ul").filter( function () {
145 return $( this ).data("role") == "virtuallistview";
146 }).addClass("vlLoadSuccess");
148 $(".virtuallist_demo_page").die();
149 $("ul.ui-virtual-list-container").virtuallistview("create");
153 /*Expandable list : Dummy DB load*/
154 $("#genlist_extendable_page").live("pagecreate", function ( el ) {
155 /*?_=ts code for no cache mechanism*/
156 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
157 $("ul").filter( function () {
158 return $( this ).data("role") == "extendablelist";
159 }).addClass("elLoadSuccess");
161 $("#genlist-extendable-page").die();
162 $("ul.ui-extendable-list-container").extendablelist("create");
163 // TODO: 'create' is called twice!!
168 $(document).bind( "pageinit" , function() {
169 $.mobile.tizen.enableSelection($("div:jqmData(role='page')"), 'none');
171 $(document).ready( function () {
172 // add current datetime with browser language format
173 // NOTE: Globalize.* functions must be run after docoument ready.
174 $('#current_date').html(Globalize.culture().name + " -- " +
175 Globalize.format( new Date(), "F" ));
176 $('#html_font_size').html('html font size:' + $('html').css('font-size'));