roojs-core.js
[roojs1] / roojs-core-debug.js
index fdd6dd7..3d26a89 100644 (file)
@@ -64,6 +64,7 @@ Roo.apply = function(o, c, defaults){
         isLinux = (ua.indexOf("linux") != -1),
         isSecure = window.location.href.toLowerCase().indexOf("https") === 0,
         isIOS = /iphone|ipad/.test(ua),
+        isAndroid = /android/.test(ua),
         isTouch =  (function() {
             try {
                 if (ua.indexOf('chrome') != -1 && ua.indexOf('android') == -1) {
@@ -640,6 +641,8 @@ Roo.factory(conf, Roo.data);
         /** @type Boolean */
         isIOS : isIOS,
         /** @type Boolean */
+        isAndroid : isAndroid,
+        /** @type Boolean */
         isTouch : isTouch,
 
         /**
@@ -7162,6 +7165,49 @@ if(opt.anim.isAnimated()){
             var p = Roo.fly(this.dom.parentNode, '_internal');
             return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
         },
+        
+        /**
+         * Looks at  the scrollable parent element
+         */
+        findScrollableParent : function()
+        {
+            var overflowRegex = /(auto|scroll)/;
+            
+            if(this.getStyle('position') === 'fixed'){
+                return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+            }
+            
+            var excludeStaticParent = this.getStyle('position') === "absolute";
+            
+            for (var parent = this; (parent = Roo.get(parent.dom.parentNode));){
+                
+                if (excludeStaticParent && parent.getStyle('position') === "static") {
+                    continue;
+                }
+                
+                if (overflowRegex.test(parent.getStyle('overflow') + parent.getStyle('overflow-x') + parent.getStyle('overflow-y'))){
+                    return parent;
+                }
+                
+                if(parent.dom.nodeName.toLowerCase() == 'body'){
+                    return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+                }
+            }
+            
+            alert('is android : ' + Roo.isAndroid);
+            alert('is ios : ' + Roo.isIOS);
+            
+            if(Roo.isAndroid){
+                alert('Is Android');
+                return Roo.get(document.documentElement);
+            }
+            
+            if(!Roo.isAndroid){
+                alert('not android');
+            }
+            
+            return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+        },
 
         /**
          * Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
@@ -16038,7 +16084,6 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
         Roo.debug &&  Roo.log(this);
         
         var tree = this._tree ? this._tree() : this.tree();
-        var named_el = false;
 
         
         if (!el && typeof(this.parent) == 'string' && this.parent.substring(0,1) == '#') {
@@ -16046,7 +16091,6 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
             var ename = this.parent.substr(1);
             this.parent = false;
             Roo.debug && Roo.log(ename);
-            named_el = true;
             switch (ename) {
                 case 'bootstrap-body':
                     if (typeof(tree.el) != 'undefined' && tree.el == document.body)  {
@@ -16076,7 +16120,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
                          break;
                     }
                          
-                    if (typeof(Roo.bootstrap.Body) != 'undefined') {
+                    if (typeof(Roo.bootstrap.Body) != 'undefined' ) {
                         this.parent = { el :  new  Roo.bootstrap.Body() };
                         Roo.debug && Roo.log("setting el to doc body");
                          
@@ -16089,7 +16133,10 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
                     // fall through
                 default:
                     el = Roo.get(ename);
-                     
+                    if (typeof(Roo.bootstrap) != 'undefined' && tree['|xns'] == 'Roo.bootstrap') {
+                        this.parent = { el : true};
+                    }
+                    
                     break;
             }
                 
@@ -16114,7 +16161,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
         
         
         
-        if (!this.parent && is_alt && !named_el) {
+        if (!this.parent && is_alt) {
             //el = Roo.get(document.body);
             this.parent = { el : true };
         }
@@ -16134,15 +16181,15 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
                         el: el || document.body,
                     
                         center: {
-                             titlebar: false,
-                             autoScroll:false,
-                             closeOnTab: true,
-                             tabPosition: 'top',
-                              //resizeTabs: true,
-                             alwaysShowTabs: false,
-                             hideTabs: true,
-                             minTabWidth: 140,
-                             overflow: 'visible'
+                            titlebar: false,
+                            autoScroll:false,
+                            closeOnTab: true,
+                            tabPosition: 'top',
+                             //resizeTabs: true,
+                            alwaysShowTabs: false,
+                            hideTabs: true,
+                            minTabWidth: 140,
+                            overflow: 'visible'
                          }
                      })
                 };
@@ -16151,18 +16198,17 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
                 // it's a top level one..
                 this.parent =  {
                     el : new Roo.BorderLayout(el || document.body, {
-                    
-                         center: {
-                             titlebar: false,
-                             autoScroll:false,
-                             closeOnTab: true,
-                             tabPosition: 'top',
-                              //resizeTabs: true,
-                             alwaysShowTabs: el && hp? false :  true,
-                             hideTabs: el || !hp ? true :  false,
-                             minTabWidth: 140
+                        center: {
+                            titlebar: false,
+                            autoScroll:false,
+                            closeOnTab: true,
+                            tabPosition: 'top',
+                             //resizeTabs: true,
+                            alwaysShowTabs: el && hp? false :  true,
+                            hideTabs: el || !hp ? true :  false,
+                            minTabWidth: 140
                          }
-                     })
+                    })
                 };
             }
         }
@@ -16178,6 +16224,9 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
         var is_body = false;
         if (this.parent.el === true) {
             // bootstrap... - body..
+            if (el) {
+                tree.el = el;
+            }
             this.parent.el = Roo.factory(tree);
             is_body = true;
         }
@@ -16512,7 +16561,7 @@ Roo.apply(Roo.XComponent, {
                     " of " + total + 
                     (m.name ? (' - ' + m.name) : '');
                        Roo.debug && Roo.log(msg);
-            if (!this.hideProgress &&  Roo.MessageBox) { 
+            if (!_this.hideProgress &&  Roo.MessageBox) { 
                 Roo.MessageBox.updateProgress(  (total  - mods.length)/total, msg  );
             }