Naviframe : hide backbutton in case SIP up(remove backbutton makes problem in binding...
[platform/framework/web/web-ui-fw.git] / src / js / widgets / jquery.mobile.tizen.pagelayout.js
index 0e2980e..49bc11f 100644 (file)
@@ -43,7 +43,6 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                        tapToggleBlacklist: "a, input, select, textarea, .ui-header-fixed, .ui-footer-fixed",
                        hideDuringFocus: "input, textarea, select",
                        updatePagePadding: true,
-                       trackPersistentToolbars: true,
                        // Browser detection! Weeee, here we go...
                        // Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
                        // Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
@@ -240,37 +239,27 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                                        if ( o.updatePagePadding ) {
                                                $( window ).unbind( "throttledresize." + self.widgetName );
                                        }
+                               });
 
-                                       if ( o.trackPersistentToolbars ) {
-                                               var thisFooter = $( ".ui-footer-fixed:jqmData(id)", this ),
-                                                       thisHeader = $( ".ui-header-fixed:jqmData(id)", this ),
-                                                       nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ),
-                                                       nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage );
-
-                                               nextFooter = nextFooter || $();
-
-                                               if ( nextFooter.length || nextHeader.length ) {
+                       window.addEventListener( "softkeyboardchange", function ( e ) {
+                               var $elDownBtn = $( "<div class='ui-btn-footer-down'></div>" ),
+                                       $elPage = $( ".ui-page-active" ),
+                                       backBtnPosition = "footer";
 
-                                                       nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer );
+                               if ( $elPage.data( "addBackBtn" ) ) {
+                                       $elPage.data( "addBackBtn" ) == "header" ? backBtnPosition = "header" : backBtnPosition = "footer";
 
-                                                       ui.nextPage.one( "pageshow", function () {
-                                                               nextFooter.add( nextHeader ).appendTo( this );
-                                                       });
+                                       if ( e.state == "on" ) {
+                                               if ( !$elPage.find( ".ui-" + backBtnPosition + " .ui-btn-footer-down" ).length ) {
+                                                       $elDownBtn.buttonMarkup( { icon: "down" } ).appendTo( $elPage.find( ".ui-" + backBtnPosition ) );
                                                }
+                                               $( ".ui-page-active .ui-btn-back" ).hide();
+                                       } else if ( e.state == "off" ) {
+                                               $( ".ui-page-active .ui-btn-back" ).show();
+                                               $( ".ui-btn-footer-down" ).remove();
                                        }
-                               });
-
-                       window.addEventListener( "softkeyboardchange", function ( e ) {
-                               var thisPage = $( ".ui-page-active" );
-
-                               if ( e.state == "on" ) {
-                                       $elCurrentFooter = $( ".ui-page-active .ui-footer" );
-                                       $elCurrentFooter.hide();
-                               } else if (e.state == "off") {
-                                       $elCurrentFooter.show();
                                }
-                               self.updatePagePadding( thisPage );
-                               self.updatePageLayout( thisPage, true );
+
                        });
                },
 
@@ -290,9 +279,16 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                                $elHeader = $elPage.find( ":jqmData(role='header')" ),
                                $elFooter = $elPage.find( ":jqmData(role='footer')" ),
                                $elContent = $elPage.find( ":jqmData(role='content')" ),
-                               resultMinHeight;
+                               resultMinHeight,
+                               dpr = 1,
+                               layoutInnerHeight = window.innerHeight;
 
-                       resultMinHeight = window.innerHeight - $elHeader.height() - $elFooter.height();
+                        if ( !$.support.scrollview ) {
+                                dpr = window.outerWidth / window.innerWidth;
+                                layoutInnerHeight = Math.floor( window.outerHeight / dpr );
+                        }
+
+                       resultMinHeight = layoutInnerHeight - $elHeader.height() - $elFooter.height();
 
                        $elContent.css( "min-height", resultMinHeight - parseFloat( $elContent.css("padding-top") ) - parseFloat( $elContent.css("padding-bottom") ) + "px" );
                },
@@ -338,7 +334,9 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                                $elContent = $elPage.find( ":jqmData(role='content')" ),
                                resultContentHeight = 0,
                                resultFooterHeight = 0,
-                               resultHeaderHeight = 0;
+                               resultHeaderHeight = 0,
+                               layoutInnerHeight = window.innerHeight,
+                               dpr = 1;
 
                        if ( $elPage.length ) {
                                $elFooter = $elPage.find( ":jqmData(role='footer')" );
@@ -354,7 +352,12 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                                $elFooter.css( "bottom", 0 );
                        }
 
-                       resultContentHeight = window.innerHeight - resultFooterHeight - resultHeaderHeight;
+                       if ( !$.support.scrollview ) {
+                               dpr = window.outerWidth / window.innerWidth;
+                               layoutInnerHeight = Math.floor( window.outerHeight / dpr );
+                       }
+
+                       resultContentHeight = layoutInnerHeight - resultFooterHeight - resultHeaderHeight;
 
                        if ( $.support.scrollview ) {
                                $elContent.height( resultContentHeight -
@@ -386,6 +389,12 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) {
                destroy: function () {
                        this.element.removeClass( "ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden" );
                        this.element.closest( ".ui-page" ).removeClass( "ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen" );
+               },
+
+               refresh: function () {
+                       var $elPage = $( ".ui-page-active" );
+                       this.setHeaderFooter( $elPage );
+                       this._updateHeaderArea( $elPage );
                }
        });