1 $(document).delegate("#main", "pageinit", function() {
2 $("#main .ui-btn-back").bind("vclick", function() {
3 tizen.application.getCurrentApplication().exit();
8 $( document ).bind("pagecreate", function () {
9 /* Color widget demo */
10 $("input[type='checkbox'][data-widget-type-list]").bind("change", function() {
11 var ls = $( this ).attr("data-widget-type-list").split(","),
12 page = $( this ).closest(":jqmData(role='page')"),
13 disabled = $( this ).is(":checked");
15 $.each(ls, function( idx, widgetType ) {
16 var ar = widgetType.split("-");
18 if ( ar.length === 2 ) {
19 page.find(":" + widgetType)[ar[1]]( "option", "disabled", disabled );
24 $('#scroller-demo').bind('pageshow', function ( e ) {
25 $page = $( e.target );
27 * many options cannot be set without subclassing since they're
28 * used in the _create method - it seems as if these are for
29 * internal use only and scrollDuration is only changable by
32 var $scroller2List = $('#scroller2').find('ul');
33 $scroller2List.scrollview( 'option','scrollDuration','10000' );
35 // only works by manipulating css
36 // the only other way is to use attribute 'scroll-method="scroll"' in html
37 $('#scroller2 .ui-scrollbar').css( 'visibility','hidden' );
40 * make toggle button switch scroll bars on and off
42 var scrollBarVisible = $('#scroller2').find('.ui-scrollbar').css('visibility') === "visible";
44 var $toggleScrollBars = $('#toggleScrollBars');
45 $toggleScrollBars.attr( "checked", scrollBarVisible ).checkboxradio("refresh");
47 /* the 'label' is the thing that is clicked, not the input element */
48 var $label = $toggleScrollBars.siblings('label').attr( 'for', '#toggleScrollBars' );
49 $label.bind("click", function () {
50 var $scrollBar = $('#scroller2').find('.ui-scrollbar');
51 var scrollBarVisible = $scrollBar.css('visibility') === "visible";
52 var newVisibility = scrollBarVisible ? "hidden" : "visible";
53 $scrollBar.css( 'visibility', scrollBarVisible ? "hidden" : "visible" );
57 $("#demo-date").bind("date-changed", function ( e, newDate ) {
58 $("#selected-date1").text( newDate.toString() );
61 $("#demo-date2").bind("date-changed", function ( e, newDate ) {
62 $("#selected-date2").text( newDate.toString() );
65 $("#demo-date3").bind("date-changed", function ( e, newDate ) {
66 $("#selected-date3").text( newDate.toString() );
69 $("#demo-date4").bind("date-changed", function ( e, newDate ) {
70 $("#selected-date4").text( newDate.toString() );
73 $('#noti-demo').bind('vmouseup', function ( e ) {
74 $('#notification').notification('open');
77 $('#noti-icon1').bind('vclick', function ( e ) {
78 $('#notification').notification('icon', './test/icon02.png');
81 $('#noti-icon2').bind('vclick', function ( e ) {
82 $('#notification').notification('icon', './test/icon01.png');
85 $('#gallery-demo').bind('pageshow', function () {
86 $('#gallery').gallery('add', './test/01.jpg');
87 $('#gallery').gallery('add', './test/02.jpg');
88 $('#gallery').gallery('add', './test/03.jpg');
89 $('#gallery').gallery('add', './test/04.jpg');
90 $('#gallery').gallery('add', './test/05.jpg');
91 $('#gallery').gallery('add', './test/06.jpg');
92 $('#gallery').gallery('add', './test/07.jpg');
93 $('#gallery').gallery('add', './test/08.jpg');
94 $('#gallery').gallery('add', './test/09.jpg');
95 $('#gallery').gallery('refresh', 3);
98 $('#gallery-demo').bind('pagebeforehide', function () {
99 $('#gallery').gallery('empty');
102 $('#gallery-add').bind('vmouseup', function ( e ) {
103 $('#gallery').gallery('add', './test/10.jpg');
104 $('#gallery').gallery('add', './test/11.jpg');
105 $('#gallery').gallery('refresh');
108 $('#gallery-del').bind('vmouseup', function ( e ) {
109 $('#gallery').gallery('remove');
112 $('#selectioninfo-demo').bind('vmouseup', function ( e ) {
113 $('#smallpopup_selectioninfo').notification( "text",
114 $("#dayselector1").find(".ui-checkbox-on").length + " items are selected" );
115 $('#smallpopup_selectioninfo').notification('open');
118 $('#groupindex-demo').bind('pageshow', function () {
119 $('#groupindex').scrolllistview();
122 $("#showVolumeButton").bind("vclick", function ( e ) {
123 $("#myVolumeControl").volumecontrol("open");
126 $("#volumecontrol_setBasicTone").bind("change", function ( e ) {
127 var basicTone = !($("#volumecontrol_setBasicTone").next('label')
128 .find(".ui-icon").hasClass("ui-icon-checkbox-on"));
131 $("#myVolumeControl").volumecontrol( "option", "basicTone", true );
132 $("#myVolumeControl").volumecontrol( "option", "title", "Basic Tone" );
134 $("#myVolumeControl").volumecontrol( "option", "basicTone", false );
135 $("#myVolumeControl").volumecontrol( "option", "title", "Volume" );
139 $("#myoptionheader").bind('collapse', function () {
140 console.log('option header was collapsed');
143 $("#myoptionheader").bind('expand', function () {
144 console.log('option header was expanded');
147 /* Gen list : Dummy DB load */
148 $(".virtuallist_demo_page").live("pagecreate", function () {
149 /* ?_=ts code for no cache mechanism */
150 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
151 $("ul").filter( function () {
152 return $( this ).data("role") == "virtuallistview";
153 }).addClass("vlLoadSuccess");
155 $(".virtuallist_demo_page").die();
156 $("ul.ui-virtual-list-container").virtuallistview("create");
160 /*Expandable list : Dummy DB load*/
161 $("#genlist_extendable_page").live("pagecreate", function ( el ) {
162 /*?_=ts code for no cache mechanism*/
163 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
164 $("ul").filter( function () {
165 return $( this ).data("role") == "extendablelist";
166 }).addClass("elLoadSuccess");
168 $("#genlist-extendable-page").die();
169 $("ul.ui-extendable-list-container").extendablelist("create");
170 // TODO: 'create' is called twice!!
174 // Expand all textarea height automatically
175 $('#ButtonNolist').live( "pagecreate", function ( ev ) {
176 var page = $( ev.target );
177 $( page ).bind( 'pageshow' , function ( ) {
178 var textarea = page.find('textarea');
179 $( textarea ).each( function ( idx, el ) {
180 var h = Math.max( el.clientHeight, el.scrollHeight );
189 $(document).bind( "pageinit" , function() {
190 $.mobile.tizen.enableSelection( $("div:jqmData(role='page')"), 'none');
192 $(document).ready( function () {
193 // add current datetime with browser language format
194 // NOTE: Globalize.* functions must be run after docoument ready.
195 $('#current_date').html(Globalize.culture().name + " -- " +
196 Globalize.format( new Date(), "F" ));
197 $('#html_font_size').html('html font size:' + $('html').css('font-size'));