Refactor list dialogue edit subpage
[platform/framework/web/web-ui-fw.git] / demos / tizen-winsets / main.js
1 $( document ).bind("pagecreate", function () {
2
3         $("#demo-date").bind("date-changed", function ( e, newDate ) {
4                 $("#selected-date1").text( newDate.toString() );
5         });
6
7         $("#demo-date2").bind("date-changed", function ( e, newDate ) {
8                 $("#selected-date2").text( newDate.toString() );
9         });
10
11         $("#demo-date3").bind("date-changed", function ( e, newDate ) {
12                 $("#selected-date3").text( newDate.toString() );
13         });
14
15         $("#demo-date4").bind("date-changed", function ( e, newDate ) {
16                 $("#selected-date4").text( newDate.toString() );
17         });
18
19         $("#demo-date5").bind("date-changed", function ( e, newDate ) {
20                 $("#selected-date5").text( newDate.toString() );
21         });
22
23         $("#demo-date6").bind("date-changed", function ( e, newDate ) {
24                 $("#selected-date6").text( newDate.toString() );
25         });
26
27         $('#noti-demo').bind('vmouseup', function ( e ) {
28                 $('#notification').notification('open');
29         });
30
31         $('#noti-icon1').bind('vclick', function ( e ) {
32                 $('#notification').notification('icon', './test/icon02.png');
33         });
34
35         $('#noti-icon2').bind('vclick', function ( e ) {
36                 $('#notification').notification('icon', './test/icon01.png');
37         });
38
39         $('#gallery-demo').bind('pageshow', function () {
40                 $('#gallery').gallery('add', './test/01.jpg');
41                 $('#gallery').gallery('add', './test/02.jpg');
42                 $('#gallery').gallery('add', './test/03.jpg');
43                 $('#gallery').gallery('add', './test/04.jpg');
44                 $('#gallery').gallery('add', './test/05.jpg');
45                 $('#gallery').gallery('add', './test/06.jpg');
46                 $('#gallery').gallery('add', './test/07.jpg');
47                 $('#gallery').gallery('add', './test/08.jpg');
48                 $('#gallery').gallery('add', './test/09.jpg');
49                 $('#gallery').gallery('refresh', 3);
50         });
51
52         $('#gallery-demo').bind('pagebeforehide', function () {
53                 $('#gallery').gallery('empty');
54         });
55
56         $('#gallery-add').bind('vmouseup', function ( e ) {
57                 $('#gallery').gallery('add', './test/10.jpg');
58                 $('#gallery').gallery('add', './test/11.jpg');
59                 $('#gallery').gallery('refresh');
60         });
61
62         $('#gallery-del').bind('vmouseup', function ( e ) {
63                 $('#gallery').gallery('remove');
64         });
65
66         /* Gen list : Dummy DB load */
67         $( document ).on( "pagecreate", ".virtuallist_demo_page", function () {
68                 /* ?_=ts code for no cache mechanism */
69                 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
70                         $("ul").filter( function () {
71                                 return $( this ).data("role") == "virtuallistview";
72                         }).addClass("vlLoadSuccess");
73
74                         $(".virtuallist_demo_page").die();
75                         $("ul.ui-virtual-list-container").virtuallistview("create");
76                 });
77         });
78
79         /*Expandable list : Dummy DB load*/
80         $( document ).on( "pagecreate", "#genlist_extendable_page", function () {
81                 /*?_=ts code for no cache mechanism*/
82                 $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
83                         $("ul").filter( function () {
84                                 return $( this ).data("role") == "extendablelist";
85                         }).addClass("elLoadSuccess");
86
87                         $("#genlist-extendable-page").die();
88                         $("ul.ui-extendable-list-container").extendablelist("create");
89                         // TODO: 'create' is called twice!!
90                 });
91         });
92
93         // Expand all textarea height automatically
94         $( document ).on( "pagecreate", "#ButtonNolist", function ( ev ) {
95                 var page = $( ev.target );
96                 $( page ).bind( 'pageshow' , function ( ) {
97                         var textarea = page.find('textarea');
98                         $( textarea ).each( function ( idx, el ) {
99                                 var h = Math.max( el.clientHeight, el.scrollHeight );
100                                 $( el ).height( h );
101                         } );
102                 } );
103         } );
104
105 });
106
107 $(document).bind( "pageinit" , function() {
108         $.mobile.tizen.enableSelection( $("div:jqmData(role='page')"), 'none' );
109 });
110 $(document).ready( function () {
111         // add current datetime with browser language format
112         // NOTE: Globalize.* functions must be run after docoument ready.
113         $('#current_date').html(Globalize.culture().name + " -- " +
114                                 Globalize.format( new Date(), "F" ));
115         $('#html_font_size').html('html font size:' + $('html').css('font-size'));
116 });