Move js code from main.js to subpages
authorPrzemyslaw Ciezkowski <p.ciezkowski@samsung.com>
Tue, 12 Mar 2013 15:41:55 +0000 (16:41 +0100)
committerYoumin Ha <youmin.ha@samsung.com>
Fri, 22 Mar 2013 11:21:33 +0000 (20:21 +0900)
Change-Id: I54a6ff7d0fc90e23f490b9b4e11bd67be3a2d68f

21 files changed:
demos/tizen-winsets/main.js
demos/tizen-winsets/webappInit.js
demos/tizen-winsets/widgets/button/buttonNolist.html
demos/tizen-winsets/widgets/button/buttonNolist.js [new file with mode: 0644]
demos/tizen-winsets/widgets/datefield.html
demos/tizen-winsets/widgets/datefield.js [new file with mode: 0644]
demos/tizen-winsets/widgets/gallery.html
demos/tizen-winsets/widgets/gallery.js [new file with mode: 0644]
demos/tizen-winsets/widgets/list/list-extendable.html
demos/tizen-winsets/widgets/list/list-extendable.js [new file with mode: 0644]
demos/tizen-winsets/widgets/list/virtuallist-normal.html
demos/tizen-winsets/widgets/list/virtuallist-normal_3_1_14.html
demos/tizen-winsets/widgets/list/virtuallist-normal_3_1_4.html
demos/tizen-winsets/widgets/list/virtuallist-normal_3_1_6.html
demos/tizen-winsets/widgets/list/virtuallist-normal_3_2_7.html
demos/tizen-winsets/widgets/list/virtuallist.js [new file with mode: 0644]
demos/tizen-winsets/widgets/noti.js [new file with mode: 0644]
demos/tizen-winsets/widgets/small-popup-interval.html
demos/tizen-winsets/widgets/small-popup.html
demos/tizen-winsets/widgets/tickernoti-interval.html
demos/tizen-winsets/widgets/tickernoti.html

index 46ecfbd..70dd50b 100644 (file)
@@ -1,116 +1,3 @@
-$( document ).bind("pagecreate", function () {
-
-       $("#demo-date").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date1").text( newDate.toString() );
-       });
-
-       $("#demo-date2").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date2").text( newDate.toString() );
-       });
-
-       $("#demo-date3").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date3").text( newDate.toString() );
-       });
-
-       $("#demo-date4").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date4").text( newDate.toString() );
-       });
-
-       $("#demo-date5").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date5").text( newDate.toString() );
-       });
-
-       $("#demo-date6").bind("date-changed", function ( e, newDate ) {
-               $("#selected-date6").text( newDate.toString() );
-       });
-
-       $('#noti-demo').bind('vmouseup', function ( e ) {
-               $('#notification').notification('open');
-       });
-
-       $('#noti-icon1').bind('vclick', function ( e ) {
-               $('#notification').notification('icon', './test/icon02.png');
-       });
-
-       $('#noti-icon2').bind('vclick', function ( e ) {
-               $('#notification').notification('icon', './test/icon01.png');
-       });
-
-       $('#gallery-demo').bind('pageshow', function () {
-               $('#gallery').gallery('add', './test/01.jpg');
-               $('#gallery').gallery('add', './test/02.jpg');
-               $('#gallery').gallery('add', './test/03.jpg');
-               $('#gallery').gallery('add', './test/04.jpg');
-               $('#gallery').gallery('add', './test/05.jpg');
-               $('#gallery').gallery('add', './test/06.jpg');
-               $('#gallery').gallery('add', './test/07.jpg');
-               $('#gallery').gallery('add', './test/08.jpg');
-               $('#gallery').gallery('add', './test/09.jpg');
-               $('#gallery').gallery('refresh', 3);
-       });
-
-       $('#gallery-demo').bind('pagebeforehide', function () {
-               $('#gallery').gallery('empty');
-       });
-
-       $('#gallery-add').bind('vmouseup', function ( e ) {
-               $('#gallery').gallery('add', './test/10.jpg');
-               $('#gallery').gallery('add', './test/11.jpg');
-               $('#gallery').gallery('refresh');
-       });
-
-       $('#gallery-del').bind('vmouseup', function ( e ) {
-               $('#gallery').gallery('remove');
-       });
-
-       /* Gen list : Dummy DB load */
-       $( document ).on( "pagecreate", ".virtuallist_demo_page", function () {
-               /* ?_=ts code for no cache mechanism */
-               $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
-                       $("ul").filter( function () {
-                               return $( this ).data("role") == "virtuallistview";
-                       }).addClass("vlLoadSuccess");
-
-                       $(".virtuallist_demo_page").die();
-                       $("ul.ui-virtual-list-container").virtuallistview("create");
-               });
-       });
-
-       /*Expandable list : Dummy DB load*/
-       $( document ).on( "pagecreate", "#genlist_extendable_page", function () {
-               /*?_=ts code for no cache mechanism*/
-               $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
-                       $("ul").filter( function () {
-                               return $( this ).data("role") == "extendablelist";
-                       }).addClass("elLoadSuccess");
-
-                       $("#genlist-extendable-page").die();
-                       $("ul.ui-extendable-list-container").extendablelist("create");
-                       // TODO: 'create' is called twice!!
-               });
-       });
-
-       // Expand all textarea height automatically
-       $( document ).on( "pagecreate", "#ButtonNolist", function ( ev ) {
-               var page = $( ev.target );
-               $( page ).bind( 'pageshow' , function ( ) {
-                       var textarea = page.find('textarea');
-                       $( textarea ).each( function ( idx, el ) {
-                               var h = Math.max( el.clientHeight, el.scrollHeight );
-                               $( el ).height( h );
-                       } );
-               } );
-       } );
-
-});
-
-$(document).bind( "pageinit" , function() {
+$( document ).on( "pageinit", function () {
        $.mobile.tizen.enableSelection( $("div:jqmData(role='page')"), 'none' );
 });
-$(document).ready( function () {
-       // add current datetime with browser language format
-       // NOTE: Globalize.* functions must be run after docoument ready.
-       $('#current_date').html(Globalize.culture().name + " -- " +
-                               Globalize.format( new Date(), "F" ));
-       $('#html_font_size').html('html font size:' + $('html').css('font-size'));
-});
index e728cb5..5f0cdd2 100644 (file)
@@ -1,9 +1,16 @@
-$(document).delegate("#main", "pageinit", function() {
+$(document).on( "pageinit", "#main" , function () {
        if ( window.tizen && window.tizen.application ) {
-               $("#main .ui-btn-back").bind("vclick", function() {
+               $( "#main .ui-btn-back" ).on( "vclick", function () {
                        window.tizen.application.getCurrentApplication().exit();
                        return false;
                });
        }
 });
 
+$(document).ready( function () {
+       // add current datetime with browser language format
+       // NOTE: Globalize.* functions must be run after docoument ready.
+       $('#current_date').html(Globalize.culture().name + " -- " +
+                               Globalize.format( new Date(), "F" ));
+       $('#html_font_size').html('html font size:' + $('html').css('font-size'));
+});
index 2f52fef..f5cb632 100644 (file)
@@ -94,6 +94,7 @@
        <div data-role="footer">
        </div>
        <link rel="stylesheet" href="styles.css" />
+       <script type="text/javascript" src="buttonNolist.js"></script>
 </div>
 </body>
 </html>
diff --git a/demos/tizen-winsets/widgets/button/buttonNolist.js b/demos/tizen-winsets/widgets/button/buttonNolist.js
new file mode 100644 (file)
index 0000000..344689d
--- /dev/null
@@ -0,0 +1,10 @@
+// Expand all textarea height automatically
+$('#ButtonNolist').one( "pagecreate", function () {
+       $( this ).on( 'pageshow' , function ( ) {
+               var textarea = $(this).find('textarea');
+               $( textarea ).each( function ( idx, el ) {
+                       var h = Math.max( el.clientHeight, el.scrollHeight );
+                       $( el ).height( h );
+               } );
+       } );
+} );
\ No newline at end of file
index bed37e4..f94ac16 100644 (file)
@@ -1,3 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8" >
+       <script src="../tizen-web-ui-fw/latest/js/jquery.min.js"></script>
+       <script src="../configure.js"></script>
+       <script src="../tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.min.js"></script>
+       <script src="../tizen-web-ui-fw/latest/js/tizen-web-ui-fw.min.js"
+                       data-framework-theme="tizen-white"
+                       data-framework-viewport-width="device-width">
+       </script>
+       <title>Tizen UI - Datefield</title>
+       <!-- for compatibility test -->
+       <meta name="apple-mobile-web-app-capable" content="yes" />
+       <meta name="apple-mobile-web-app-status-bar-style" content="black" />
+       <link rel="apple-touch-icon" href="../icon-tizen.png" />
+</head>
+<body>
 <div data-role="page" id="datetimepicker-demo" data-add-back-btn="true">
        <div data-role="header" data-position="fixed">
                <h1>Date/time picker</h1>
@@ -45,6 +63,8 @@
        </div><!-- /content -->
        <div data-role="footer">
        </div>
+       <script src="datefield.js"></script>
 </div> <!-- /page -->
-
+</body>
+</html>
 
diff --git a/demos/tizen-winsets/widgets/datefield.js b/demos/tizen-winsets/widgets/datefield.js
new file mode 100644 (file)
index 0000000..00b9a31
--- /dev/null
@@ -0,0 +1,26 @@
+$( document ).one("pagecreate", "#datetimepicker-demo", function () {
+
+       $("#demo-date").on("date-changed", function ( e, newDate ) {
+               $("#selected-date1").text( newDate.toString() );
+       });
+
+       $("#demo-date2").on("date-changed", function ( e, newDate ) {
+               $("#selected-date2").text( newDate.toString() );
+       });
+
+       $("#demo-date3").on("date-changed", function ( e, newDate ) {
+               $("#selected-date3").text( newDate.toString() );
+       });
+
+       $("#demo-date4").on("date-changed", function ( e, newDate ) {
+               $("#selected-date4").text( newDate.toString() );
+       });
+
+       $("#demo-date5").on("date-changed", function ( e, newDate ) {
+               $("#selected-date5").text( newDate.toString() );
+       });
+
+       $("#demo-date6").on("date-changed", function ( e, newDate ) {
+               $("#selected-date6").text( newDate.toString() );
+       });
+});
\ No newline at end of file
index 481d10e..a280a05 100644 (file)
@@ -1,4 +1,21 @@
 <!DOCTYPE html>
+<html>
+<head>
+       <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8" >
+       <script src="../tizen-web-ui-fw/latest/js/jquery.min.js"></script>
+       <script src="../configure.js"></script>
+       <script src="../tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.min.js"></script>
+       <script src="../tizen-web-ui-fw/latest/js/tizen-web-ui-fw.min.js"
+                       data-framework-theme="tizen-white"
+                       data-framework-viewport-width="device-width">
+       </script>
+       <title>Tizen UI - Gallery</title>
+       <!-- for compatibility test -->
+       <meta name="apple-mobile-web-app-capable" content="yes" />
+       <meta name="apple-mobile-web-app-status-bar-style" content="black" />
+       <link rel="apple-touch-icon" href="../icon-tizen.png" />
+</head>
+<body>
 <div data-role="page" id="gallery-demo" data-add-back-btn="true">
        <div data-role="header" data-position="fixed">
                <h1>Gallery</h1>
@@ -7,7 +24,7 @@
                <div data-role="gallery" id="gallery" data-vertical-align="middle">
                </div>
        </div> <!-- /content -->
-       <div data-role="footer"data-position ="fixed">
+       <div data-role="footer" data-position ="fixed">
                <div data-role="tabbar">
                        <ul>
                                <li id="gallery-add"><a href="#">Add</a></li>
@@ -15,4 +32,7 @@
                        </ul>
                </div><!-- /navbar -->
        </div>
+       <script src="gallery.js"></script>
 </div> <!-- /page -->
+</body>
+</html>
\ No newline at end of file
diff --git a/demos/tizen-winsets/widgets/gallery.js b/demos/tizen-winsets/widgets/gallery.js
new file mode 100644 (file)
index 0000000..0c87308
--- /dev/null
@@ -0,0 +1,28 @@
+$( document ).one("pagecreate", "#gallery-demo", function () {
+       $('#gallery-demo').on('pageshow', function () {
+               $('#gallery').gallery('add', './test/01.jpg');
+               $('#gallery').gallery('add', './test/02.jpg');
+               $('#gallery').gallery('add', './test/03.jpg');
+               $('#gallery').gallery('add', './test/04.jpg');
+               $('#gallery').gallery('add', './test/05.jpg');
+               $('#gallery').gallery('add', './test/06.jpg');
+               $('#gallery').gallery('add', './test/07.jpg');
+               $('#gallery').gallery('add', './test/08.jpg');
+               $('#gallery').gallery('add', './test/09.jpg');
+               $('#gallery').gallery('refresh', 3);
+       });
+
+       $('#gallery-demo').on('pagebeforehide', function () {
+               $('#gallery').gallery('empty');
+       });
+
+       $('#gallery-add').on('vmouseup', function ( e ) {
+               $('#gallery').gallery('add', './test/10.jpg');
+               $('#gallery').gallery('add', './test/11.jpg');
+               $('#gallery').gallery('refresh');
+       });
+
+       $('#gallery-del').on('vmouseup', function ( e ) {
+               $('#gallery').gallery('remove');
+       });
+});
\ No newline at end of file
index c524ec1..4489e4d 100644 (file)
@@ -17,4 +17,5 @@
        </div>
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="list-extendable.js"></script>
 </div>
diff --git a/demos/tizen-winsets/widgets/list/list-extendable.js b/demos/tizen-winsets/widgets/list/list-extendable.js
new file mode 100644 (file)
index 0000000..fea40cb
--- /dev/null
@@ -0,0 +1,10 @@
+$("#genlist_extendable_page").one("pagecreate", function ( el ) {
+       /*?_=ts code for no cache mechanism*/
+       $.getScript( "./virtuallist-db-demo.js", function ( data, textStatus ) {
+               $("ul").filter( function () {
+                       return $( this ).data("role") == "extendablelist";
+               }).addClass("elLoadSuccess");
+               $("ul.ui-extendable-list-container").extendablelist("create");
+               // TODO: 'create' is called twice!!
+       });
+});
\ No newline at end of file
index 2d7a20d..621394a 100644 (file)
@@ -23,4 +23,5 @@
        </div>
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="virtuallist.js"></script>
 </div>
index 9f0c28b..7459555 100644 (file)
@@ -26,4 +26,5 @@
        </div>
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="virtuallist.js"></script>
 </div>
index ca5b0fc..ddfd481 100644 (file)
@@ -25,4 +25,5 @@
        </div>
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="virtuallist.js"></script>
 </div>
index 0ea52dd..e79834a 100644 (file)
@@ -15,4 +15,5 @@
        </div>
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="virtuallist.js"></script>
 </div>
index d1c6831..ccba32c 100644 (file)
@@ -36,4 +36,5 @@
        </div>
        <div data-role="footer" data-add-back-btn="true">
        </div>
+       <script type="text/javascript" src="virtuallist.js"></script>
 </div>
diff --git a/demos/tizen-winsets/widgets/list/virtuallist.js b/demos/tizen-winsets/widgets/list/virtuallist.js
new file mode 100644 (file)
index 0000000..fa6c49c
--- /dev/null
@@ -0,0 +1,10 @@
+/* Gen list : Dummy DB load */
+$("div.virtuallist_demo_page").one("pagecreate", function () {
+       /* ?_=ts code for no cache mechanism */
+       $.getScript( "virtuallist-db-demo.js", function ( data, textStatus ) {
+               $("ul").filter( function () {
+                       return $( this ).data("role") == "virtuallistview";
+               }).addClass("vlLoadSuccess");
+               $("ul.ui-virtual-list-container").virtuallistview("create");
+       });
+});
\ No newline at end of file
diff --git a/demos/tizen-winsets/widgets/noti.js b/demos/tizen-winsets/widgets/noti.js
new file mode 100644 (file)
index 0000000..23203e5
--- /dev/null
@@ -0,0 +1,14 @@
+$( "div.noti-demo" ).on("pagecreate", function () {
+       $('#noti-demo').on('vmouseup', function ( e ) {
+               $('#notification').notification('open');
+       });
+
+       $('#noti-icon1').on('vclick', function ( e ) {
+               $('#notification').notification('icon', './test/icon02.png');
+       });
+
+       $('#noti-icon2').on('vclick', function ( e ) {
+               $('#notification').notification('icon', './test/icon01.png');
+       });
+
+});
\ No newline at end of file
index e0e0c5b..c7dc8ad 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<div data-role="page" data-add-back-btn="true">
+<div data-role="page" data-add-back-btn="true" class="noti-demo">
        <div data-role="notification" id="notification" data-type="popup" data-interval="3000">
                <p>Notification Demo</p>
        </div>
@@ -11,4 +11,5 @@
        </div><!-- /content -->
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="noti.js"></script>
 </div> <!-- /page -->
index 4da7a33..f5bf8aa 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<div data-role="page" data-add-back-btn="true">
+<div data-role="page" data-add-back-btn="true" class="noti-demo">
        <div data-role="notification" id="notification" data-type="popup">
                <p>Notification Demo</p>
        </div>
@@ -11,4 +11,5 @@
        </div><!-- /content -->
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="noti.js"></script>
 </div> <!-- /page -->
index 632657a..5ecec1f 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<div data-role="page" data-add-back-btn="true">
+<div data-role="page" data-add-back-btn="true" class="noti-demo">
        <div data-role="notification" id="notification" data-type="ticker" data-interval="3000">
                <img src="./test/icon02.png">
                <p>Hello World</p>
@@ -13,4 +13,5 @@
        </div><!-- /content -->
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="noti.js"></script>
 </div> <!-- /page -->
index 3cb49af..87ba67e 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<div data-role="page" data-add-back-btn="true">
+<div data-role="page" data-add-back-btn="true" class="noti-demo">
        <div data-role="notification" id="notification" data-type="ticker">
                <img src="./test/icon01.png">
                <p>Hello Tizen</p>
@@ -15,4 +15,5 @@
        </div><!-- /content -->
        <div data-role="footer">
        </div>
+       <script type="text/javascript" src="noti.js"></script>
 </div> <!-- /page -->