OSDN Git Service

Version 0.6.65, fixed TouchEvent for iOS3.13, fixed around X.Callback.
authoritozyun <itozyun@user.sourceforge.jp>
Thu, 21 Aug 2014 14:20:33 +0000 (23:20 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Thu, 21 Aug 2014 14:20:33 +0000 (23:20 +0900)
0.6.x/index.html
0.6.x/js/core/03_XCallback.js
0.6.x/js/core/05_XTimer.js
0.6.x/js/core/06_XEventDispatcher.js
0.6.x/js/dom/10_XDom.js
0.6.x/js/dom/12_XDomEvent.js
0.6.x/js/ui/05_XUI_Gesture.js
0.6.x/js/ui/06_AbstractUINode.js
0.6.x/js/ui/15_ScrollBox.js
0.6.x/logger.html

index 1c746da..eeb75c2 100644 (file)
@@ -8,8 +8,8 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">\r
 <meta http-equiv="imagetoolbar" content="no">\r
 <meta name="format-detection" content="telephone=no">\r
-<meta name="apple-mobile-web-app-capable">\r
-<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,maximum-scale=1">\r
+<meta name="apple-mobile-web-app-capable" content="yes">\r
+<meta name="viewport" id="dynamic-viewport" content="width=device-width,target-densitydpi=device-dpi,initial-scale=1,user-scalable=0,maximum-scale=1,minimum-scale=1">\r
 <link rel="stylesheet" type="text/css" media="all" href="css/xui.css">\r
 \r
 <script type="text/javascript" src="js/core/00_builtin.js"></script>\r
index 25567fa..5aad3d9 100644 (file)
@@ -19,9 +19,9 @@ X.Callback = {
        _HANDLEEVENT     : 2,\r
        _FUNC_ONLY       : 3,\r
        \r
-       create : function( arg0, arg1, arg2 /* [ listener || ( context + function ) || function ][ args... ] */ ){\r
+       create : function( arg1, arg2, arg3 /* [ listener || ( context + function ) || function ][ args... ] */ ){\r
                var live = X.Callback._LIVE_LIST,\r
-                       hash = X.Callback._checkCallbackArgs( arg0, arg1, arg2 ),\r
+                       hash = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 ),\r
                        f;\r
                \r
                if( !hash.k ) return hash;\r
@@ -61,14 +61,14 @@ X.Callback = {
                };\r
        },\r
        \r
-       _checkCallbackArgs : function( arg1, arg2, arg3, alt_context ){\r
+       _classifyCallbackArgs : function( arg1, arg2, arg3, alt_context ){\r
                var obj;\r
                \r
                if( arg1 && X.Type.isFunction( arg2 ) ){\r
                        obj  = { x : arg1, f : arg2, k : X.Callback._THIS_FUNC };\r
                } else\r
                if( arg1 && X.Type.isFunction( arg1[ 'handleEvent' ] ) ){\r
-                       obj  = { x : arg1, f : arg1[ 'handleEvent' ], k : X.Callback._HANDLEEVENT };\r
+                       obj  = { x : arg1, k : X.Callback._HANDLEEVENT };\r
                        arg3 = arg2;\r
                } else\r
                if( X.Type.isFunction( arg1 ) ){\r
@@ -80,15 +80,15 @@ X.Callback = {
                        };\r
                } else\r
                if( X.Type.isFunction( arg2 ) ){\r
-                       console.log( 'X.Callback._checkCallbackArgs : arg1 が ' + arg1 + 'です' );\r
+                       console.log( 'X.Callback._classifyCallbackArgs : arg1 が ' + arg1 + 'です' );\r
                        if( alt_context ){\r
                                obj  = { x : alt_context, f : arg2, k : X.Callback._THIS_FUNC };\r
                        } else {\r
                                obj  = { f : arg2, k : X.Callback._FUNC_ONLY };\r
                        };\r
                } else\r
-               if( alt_context && X.Type.isFunction( alt_context[ 'handleEvent' ] ) ){\r
-                       obj  = { x : alt_context, f : alt_context[ 'handleEvent' ], k : X.Callback._HANDLEEVENT };\r
+               if( alt_context ){\r
+                       obj  = { x : alt_context, k : X.Callback._HANDLEEVENT };\r
                        arg3 = arg1;\r
                } else {\r
                        console.log( '不正 ' + arg1 );\r
@@ -101,7 +101,7 @@ X.Callback = {
                };\r
                return ( obj.x || obj.s ) ? obj : arg1;\r
        },\r
-       \r
+\r
        _proxyCallback : function( xfunc ){\r
                var args    = xfunc.a || [],\r
                        thisObj = xfunc.x,\r
@@ -132,13 +132,19 @@ X.Callback = {
                                \r
                        case X.Callback._HANDLEEVENT :\r
                                temp = thisObj[ 'handleEvent' ];\r
+                               if( X.Type.isFunction( temp ) ){\r
+                                       return args.length === 0 ? thisObj[ 'handleEvent' ]() :\r
+                                                  args.length === 1 ? thisObj[ 'handleEvent' ]( args[ 0 ] ) : temp.apply( thisObj, args );\r
+                               };\r
+                               break;\r
+                               /*\r
                                if( temp !== func && X.Type.isFunction( temp ) ){\r
                                        return args.length === 0 ? thisObj[ 'handleEvent' ]() : temp.apply( thisObj, args );\r
                                } else\r
                                if( X.Type.isFunction( thisObj ) ){\r
                                        return args.length === 0 ? thisObj.call( thisObj ) : thisObj.apply( thisObj, args );\r
                                };\r
-                               return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args );\r
+                               return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args );*/\r
                                                        \r
                        case X.Callback._FUNC_ONLY :\r
                                return args.length === 0 ?\r
@@ -147,32 +153,20 @@ X.Callback = {
                                                func( args[ 0 ] ) :\r
                                                func.apply( null, args );\r
                };\r
+               return X.Callback.NONE;\r
        },\r
        \r
        _kill : function(){\r
                X.Callback._correct( this );\r
        },\r
-       _same : function( arg0, arg1, arg2 ){\r
-               var hash, kind;\r
-               \r
-               if( arg0 && arg0[ 'kill' ] === X.Callback._kill ) return this === arg0;\r
+       _same : function( arg1, arg2, arg3 ){\r
+               var hash;\r
                \r
-               hash = X.Callback._checkCallbackArgs( arg0, arg1, arg2 ),\r
-               kind = hash.k;\r
+               if( arg1 && arg1[ 'kill' ] === X.Callback._kill ) return this === arg1;\r
                \r
-               if( this.k !== kind ) return false;\r
+               hash = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 );\r
                \r
-               switch( kind ){\r
-                       case X.Callback._THIS_FUNC :\r
-                               return this.x === hash.x && this.f === hash.f && this.s === hash.s;\r
-\r
-                       case X.Callback._HANDLEEVENT :\r
-                               return this.x === hash.x && this.f === hash.f && this.s === hash.s;\r
-\r
-                       case X.Callback._FUNC_ONLY :\r
-                               return this.f === hash.f && this.s === hash.s;\r
-               };\r
-               return false;\r
+               return hash && this.k === hash.k && this.x === hash.x && this.f === hash.f && this.s === hash.s;\r
        },\r
        _correct : function( f ){\r
                var i = X.Callback._LIVE_LIST.indexOf( f );\r
index 89c0d16..e321ed4 100644 (file)
@@ -119,7 +119,9 @@ X.Timer = {
                        opt_count = 0;\r
                };\r
                \r
-               hash = X.Callback._checkCallbackArgs( args1, args2, args3 );\r
+               hash = X.Callback._classifyCallbackArgs( args1, args2, args3 );\r
+               if( !hash ) return -1; // dev only\r
+               \r
                if( !hash.k ) hash = { f : hash };\r
                hash.time  = time;\r
                hash.last  = time;\r
@@ -157,14 +159,14 @@ X.Timer = {
                        var i = X.Timer.REQ_FRAME_LIST.length,\r
                                f;\r
                        i === 0 && ( X.Timer.requestID = _enterFrame( X.Timer._onEnterFrame ) );\r
-                       f = X.Timer.REQ_FRAME_LIST[ i ] = X.Callback._checkCallbackArgs( args1, args2, args3 );\r
+                       f = X.Timer.REQ_FRAME_LIST[ i ] = X.Callback._classifyCallbackArgs( args1, args2, args3 );\r
                        return f.uid = ++X.Timer.uid;\r
                }) :\r
                (function( args1, args2, args3 ){\r
                        var i = X.Timer.REQ_FRAME_LIST.length,\r
                                f;\r
                        i === 0 && ( X.Timer.requestID = X.Timer.add( 0, 1, X.Timer._onEnterFrame ) );\r
-                       f = X.Timer.REQ_FRAME_LIST[ i ] = X.Callback._checkCallbackArgs( args1, args2, args3 );\r
+                       f = X.Timer.REQ_FRAME_LIST[ i ] = X.Callback._classifyCallbackArgs( args1, args2, args3 );\r
                        return f.uid = ++X.Timer.uid;\r
                }),\r
        \r
index 37b4815..25d7311 100644 (file)
@@ -44,13 +44,7 @@ X.EventDispatcher =
                                if( !list ) list = this._listeners = {};\r
                                if( !( list = list[ type ] ) ) list = this._listeners[ type ] = [];\r
                                \r
-                               f = X.Callback._checkCallbackArgs( arg1, arg2, arg3 );\r
-                               if( !f.k ){\r
-                                       f = X.Callback._checkCallbackArgs( this, arg1 );\r
-                               } else\r
-                               if( f.k === X.Callback._FUNC_ONLY ){\r
-                                       f = X.Callback._checkCallbackArgs( this, f.f, f.s );\r
-                               };\r
+                               f = X.Callback._classifyCallbackArgs( arg1, arg2, arg3, this );\r
                                list[ list.length ] = f;\r
                                f.once = X.EventDispatcher._once;\r
                                \r
@@ -128,13 +122,7 @@ X.EventDispatcher =
                                if( arg1.k ){\r
                                        hash = arg1;\r
                                } else {\r
-                                       hash = X.Callback._checkCallbackArgs( arg1, arg2, arg3 );\r
-                                       if( !hash.k ){\r
-                                               hash = X.Callback._checkCallbackArgs( this, arg1 );\r
-                                       } else\r
-                                       if( hash.k === X.Callback._FUNC_ONLY ){\r
-                                               hash = X.Callback._checkCallbackArgs( this, hash.f, hash.s );\r
-                                       };\r
+                                       hash = X.Callback._classifyCallbackArgs( arg1, arg2, arg3, this );\r
                                };\r
                                \r
                                if( ( unlistens = this._unlistens ) && ( unlistens = unlistens[ type ] ) ){\r
index 3b94a47..5bdaf03 100644 (file)
@@ -46,7 +46,7 @@ X.Dom = X.Class._override(
                                        console.log( '-- resize : ' + X.getTime() );\r
                                        \r
                                        !X.Dom._lock && ( X.Dom._lock = true ) && X.Timer.once( 100, X.Dom._detectFinishResizing );\r
-                                       return X.Callback.PREVENT_DEFAULT | X.Callback.STOP_PROPAGATION;\r
+                                       return X.Callback.STOP_PROPAGATION;\r
                                }),\r
                \r
                _detectFinishResizing : function (){\r
@@ -217,7 +217,6 @@ X.Dom = X.Class._override(
                _getSize :\r
                        X.UA.IE ?\r
                                new Function( 'return[X.Dom._root.clientWidth,X.Dom._root.clientHeight]' ) :\r
-\r
                                new Function( 'return[window.innerWidth,window.innerHeight]' ),\r
                \r
                getSize : function(){\r
@@ -427,6 +426,7 @@ X.Dom.getAbsolutePath = function( path ){
 if( window[ 'orientation' ] !== undefined ){\r
        X.Dom._orientationchange = function( e ){\r
                X.Dom._orientationFlag = true;\r
+               !X.UA.Android && X.Dom._resize();\r
                console.log( '-- orientationchange : ' + X.getTime() );\r
        };\r
 };\r
index 72a49ee..5ad2058 100644 (file)
@@ -57,7 +57,7 @@ if( X.Dom.EVENT_W3C ){
                        this.wheelDeltaX = this.wheelDeltaY = 0;\r
                };\r
                \r
-               if( e.constructor === window.TouchEvent ){\r
+               if( /* e.constructor === window.TouchEvent || */ e.touches /* for iOS3.13 */ ){\r
                        // TouchEvent\r
                        this.touches        = e.touches;\r
                        this.changedTouches = e.changedTouches;\r
@@ -191,6 +191,8 @@ X.Dom.Event.Rename = {};
 X.Dom.Event.RenameTo = {};\r
 // https://github.com/georgeadamson/jQuery.prefixfree-events/blob/master/jQuery.prefixfree-events.js\r
 \r
+// TODO DOMMoseScroll\r
+\r
 if( window.onwebkitanimationend !== undefined && window.onanimationend === undefined ){\r
        console.log( 'animationend <= webkitAnimationEnd' );\r
          X.Dom.Event.Rename[ 'animationend' ]             = 'webkitAnimationEnd';\r
index ba655fd..c73697f 100644 (file)
                } else\r
                if( e.touches ){\r
                        type |= TOUCH;\r
+                       //alert( 'Hammer@handleEvent ' + X.UI.Event.IdToName[ e.type ] + ' ' + e.touches.length );\r
                } else {\r
                        type |= MOUSE;\r
+                       //alert( 'Hammer@handleEvent ' + X.UI.Event.IdToName[ e.type ] + ' mouse!' );\r
                };\r
                \r
                // onmouseup, but when touchend has been fired we do nothing.\r
index dab47c0..4820dc9 100644 (file)
@@ -602,7 +602,7 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits(
                                        if( xnode._xnodes && xnode._xnodes.length ){\r
                                                if( w === X.UI.Attr.AUTO ){\r
                                                        w = this.contentWidth = xnode.css( 'width', 'auto' ).width() / xnode._getCharSize();\r
-                                                       console.log( xnode.width() + ' ' + xnode._getCharSize() + ' > ' + w );\r
+                                                       //console.log( xnode.width() + ' ' + xnode._getCharSize() + ' > ' + w );\r
                                                        \r
                                                        this.scrollWidth = w + this.contentL + this.contentR;\r
                                                        if( this.maxContentWidth < w - this.boxSizingOffsetLR ) this.contentWidth = this.maxContentWidth + this.boxSizingOffsetLR;\r
@@ -767,7 +767,7 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits(
                                                this.gesture.listen( type );\r
                                        };\r
                                } else {\r
-                                       console.log( type );\r
+                                       //console.log( type );\r
                                        root    = this.rootData;\r
                                        counter = root.eventCounter;\r
                                        if( counter[ type ] ){\r
@@ -778,7 +778,7 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits(
                                        };\r
                                };\r
                        };\r
-                       f = X.Callback._checkCallbackArgs( arg1, arg2, arg3 );\r
+                       f = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 );\r
                        if( !f.k ){\r
                                return X.EventDispatcher.prototype.listen.apply( this, [ type, this.User, f ] );\r
                        } else\r
@@ -815,7 +815,7 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits(
                                        };\r
                                };\r
                        };\r
-                       f = X.Callback._checkCallbackArgs( arg1, arg2, arg3 );\r
+                       f = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 );\r
                        if( !f.k ){\r
                                return X.EventDispatcher.prototype.unlisten.apply( this, [ type, this.User, f ] );\r
                        } else\r
index e97ddf9..5d766d4 100644 (file)
@@ -26,7 +26,7 @@ var m      = Math,
                vScrollbar      : true,\r
                fixedScrollbar  : X.UA.Android,\r
                hideScrollbar   : X.UA.iOS,\r
-               fadeScrollbar   : X.UA.iOS && has3d,\r
+               fadeScrollbar   : X.UA.iOS, //&& has3d,\r
                scrollbarClass  : '',\r
        \r
                // Zoom\r
index 7200148..43f4095 100644 (file)
@@ -14,7 +14,7 @@
        \r
        <!-- for smartphone -->\r
        <meta name="format-detection" content="telephone=no">\r
-       <meta name="apple-mobile-web-app-capable">\r
+       <meta name="apple-mobile-web-app-capable" content="yes">\r
        \r
        <!-- maximum-scale=1 初代iPod touch で必要, dynamic-viewport は operaで可能  -->\r
        <meta name="viewport" id="dynamic-viewport" content="width=device-width,target-densitydpi=device-dpi,initial-scale=1,user-scalable=0,maximum-scale=1,minimum-scale=1">\r
                -webkit-user-drag           : none;\r
                }\r
                html, body {\r
-                       padding  : 0;\r
-                       margin   : 0;\r
-                       border   : 0;\r
-                       width    : 100%;\r
-                       height   : 100%;\r
-                       overflow : hidden;\r
+                       padding    : 0;\r
+                       margin     : 0;\r
+                       border     : 0;\r
+                       width      : 100%;\r
+                       height     : 100%;\r
+                       overflow   : hidden;\r
+                       background : #FF66FF;\r
                }\r
                iframe {\r
                        display     : block;\r
@@ -51,6 +52,7 @@
                        border      : 0;\r
                        height      : 100%;\r
                        margin-left : 0;\r
+                       background  : #fff;\r
                }\r
                #log {\r
                        position   : absolute;\r
@@ -65,7 +67,7 @@
                        overflow   : auto;\r
                }\r
                #toggle {\r
-                       font-size   : 1.5em;\r
+                       font-size   : 2em;\r
                        font-family : Arial;\r
                        position    : absolute;\r
                        top         : 0;\r
@@ -76,7 +78,7 @@
                        color       : #00f;\r
                        text-align  : center;\r
                        font-weight : bold;\r
-                       z-index     : 999;\r
+                       z-index     : 999999;\r
                        cursor      : pointer;\r
                        -webkit-tap-highlight-color : rgba(0,0,0,0);\r
                }\r
                        hasEvent   = false,\r
                        toggleOpen = true,\r
                        toggleBusy = false;\r
-\r
+                       \r
+               function __load(){\r
+                       __resize();\r
+                   setTimeout(function(){scrollTo(0, 1);}, 100);\r
+                   if( window.addEventListener ){\r
+                       window.addEventListener( 'orientationchange', function(){\r
+                               setTimeout(function(){\r
+                                       //alert( window.innerWidth + 'x' + window.innerHeight );\r
+                                       __resize();\r
+                               }, 100);\r
+                               }, false\r
+                       ); // iOS\r
+                   };\r
+               };\r
                function __resize( toggleChanged ){\r
                        var body  = document.body,\r
                                log   = body.children[0],\r
                                btn   = body.children[2],\r
                                viewW = document.all ? ( document.documentElement || body ).offsetWidth || window.innerWidth /* for ie9 */ : window.innerWidth,\r
                                viewH = window.innerHeight;\r
+\r
                        if( 800 <= viewW ){\r
-                               if( document.all ){\r
-                                       ifr.style.width  = viewW - LOG_WIDTH + 'px';\r
-                               } else {\r
-                                       ifr.style.width  = viewW - LOG_WIDTH + 'px';\r
+                               ifr.style.width  = viewW - LOG_WIDTH + 'px';\r
+                               if( !document.all ){    \r
                                        ifr.style.height = viewH + 'px'; // NetFront3.4\r
                                };\r
                                body.className = 'toggle_none';\r
                        } else {\r
                                if( viewW < 240 ) log.style.width = viewW + 'px';\r
                                \r
-                               if( document.all ){\r
-                                       ifr.style.width  = viewW + 'px';\r
-                               } else {\r
-                                       ifr.style.width  = viewW + 'px';\r
+                               ifr.style.width  = viewW + 'px';\r
+                               if( !document.all ){\r
                                        ifr.style.height = viewH + 'px'; // NetFront3.4\r
                                };\r
                                if( USE_ANIME && toggleChanged ){\r
        <meta name="viewport" content="width=device-width,initial-scale=1">\r
        </noscript>\r
 </head>\r
-<body onload="__resize()" onresize="__resize()" scroll="no"><div id="log">-- console.log() --</div><iframe src="index.html" width="500" height="100%" scrolling="yes" frameborder="0"></iframe><div id="toggle" onclick="__ontoggle();"></div></body>\r
+<body onload="__load()" onresize="__resize()" scroll="no"><div id="log">-- console.log() --</div><iframe src="ui.html" width="500" height="100%" scrolling="yes" frameborder="0" allowtransparency="no"></iframe><div id="toggle" onclick="__ontoggle();"></div></body>\r
 </html>\r
 <xmp class="cleanup-target" style="display:none"><plaintext style="display:none"><!-- plainetext は nds 用 -->
\ No newline at end of file