From 7973f3ff61f1ef5bd9732f527b175010d0c0971b Mon Sep 17 00:00:00 2001 From: itozyun Date: Wed, 1 Jul 2015 09:16:11 +0900 Subject: [PATCH] Version 0.6.168, fix X.UI.Repeater. --- 0.6.x/index.html | 2 + 0.6.x/js/01_core/02_XUA.js | 11 ++--- 0.6.x/js/01_core/04_XObject.js | 40 +++-------------- 0.6.x/js/01_core/05_XArray.js | 39 ++++++++++++++++ 0.6.x/js/01_core/13_XClass.js | 6 +-- 0.6.x/js/02_dom/03_XDomEvent.js | 2 +- 0.6.x/js/02_dom/07_XNodeList.js | 2 +- 0.6.x/js/02_dom/20_XNode.js | 8 ++-- 0.6.x/js/02_dom/22_XTreeBuilder.js | 14 +++--- 0.6.x/js/03_plugin/00_XPlugin.js | 27 +++-------- 0.6.x/js/05_util/01_XNinjaIframe.js | 15 +++---- 0.6.x/js/06_net/01_XNetXHR.js | 19 +++++--- 0.6.x/js/06_net/10_XOAuth2.js | 2 +- 0.6.x/js/07_audio/00_XAudio.js | 2 +- 0.6.x/js/07_audio/10_XAudioSprite.js | 4 +- 0.6.x/js/20_ui/02_XUI_Attr.js | 2 +- 0.6.x/js/20_ui/08_Box.js | 6 +-- 0.6.x/js/20_ui/14_ChromeBox.js | 4 +- 0.6.x/js/20_ui/16_Repeater.js | 86 ++++-------------------------------- 0.6.x/js/import.js | 4 +- 20 files changed, 112 insertions(+), 183 deletions(-) diff --git a/0.6.x/index.html b/0.6.x/index.html index eac273a..43d4c63 100644 --- a/0.6.x/index.html +++ b/0.6.x/index.html @@ -27,6 +27,8 @@ + + diff --git a/0.6.x/js/01_core/02_XUA.js b/0.6.x/js/01_core/02_XUA.js index 61230c8..b99223a 100644 --- a/0.6.x/js/01_core/02_XUA.js +++ b/0.6.x/js/01_core/02_XUA.js @@ -286,10 +286,10 @@ var X_UA = X[ 'UA' ] = {}, tridentToVer = X_UA[ 'Trident' ] ? ( X_UA[ 'Trident' ] + 4 | 0 ) : X_UA[ '_IE' ]; /** * IE10 以上の互換モードを使用している場合、そのバージョン - * @alias X.UA.IECompat + * @alias X.UA.IEHost * @type {number} */ - if( tridentToVer !== X_UA[ '_IE' ] ) X_UA[ 'IECompat' ] = tridentToVer; + if( tridentToVer !== X_UA[ '_IE' ] ) X_UA[ 'IEHost' ] = tridentToVer; /** * documentモードを考慮したIEのバージョン * @alias X.UA.IE @@ -362,7 +362,7 @@ var X_UA = X[ 'UA' ] = {}, */ if( dua.toLowerCase().indexOf( 'windows phone' ) !== -1 || 0 < dav.indexOf( 'ZuneWP' ) ) X_UA[ 'WinPhone' ] = true; // ZuneWP は IEM のデスクトップモードで登場する - console.log( '>> IE : ' + v + ' ActiveX : ' + X_UA[ 'ActiveX' ] + ' IEHost : ' + X_UA[ 'IECompat' ] ); + console.log( '>> IE : ' + v + ' ActiveX : ' + X_UA[ 'ActiveX' ] + ' IEHost : ' + X_UA[ 'IEHost' ] ); // TODO XBox360, XBox1, Modern or Desktop, Standalone return; }; @@ -682,11 +682,6 @@ if( document.getElementById ){ } else { X_UA_EVENT.DOM0 = true; }; -} else -if( document.layers ){ - -} else { - }; if( navigator.msPointerEnabled || navigator.pointerEnabled ) X_UA_HID.POINTER = true; diff --git a/0.6.x/js/01_core/04_XObject.js b/0.6.x/js/01_core/04_XObject.js index 500ca49..7e42e0c 100644 --- a/0.6.x/js/01_core/04_XObject.js +++ b/0.6.x/js/01_core/04_XObject.js @@ -29,18 +29,15 @@ var X_Object_inObject = X_UA[ 'IE' ] < 5.5 ? // TODO JScript で判定 * @alias X.Object */ X[ 'Object' ] = { - // TODO rename to copy - 'clone' : X_Object_clone, + + 'copy' : X_Object_copy, + + 'deepCopy' : X_Object_deepCopy, 'override' : X_Object_override, 'clear' : X_Object_clear, - 'deepCopy' : X_Object_deepCopy, - - // TODO rename to X.Array.copy - 'cloneArray' : X_Object_cloneArray, - 'isEmpty' : X_Object_isEmpty, 'inObject' : X_Object_inObject @@ -53,11 +50,11 @@ X[ 'Object' ] = { // ------------------------------------------------------------------------- // /** * 単純なクローンでメンバーをコピーしたオブジェクトを返します。 k in null でエラーになる Opera7- に対策済。 - * @alias X.Object.clone + * @alias X.Object.copy * @param {object|Array} src コピー元のオブジェクトです。 * @return {object|Array} */ -function X_Object_clone( src ){ +function X_Object_copy( src ){ var ret, k; if( !src || !X_Type_isObject( src ) ) return src; @@ -141,23 +138,6 @@ function X_Object_deepCopy_( src, objSrc, objCopy, n ) { }; /** - * 単純にメンバーをコピーした Array を返します。 - * @alias X.Object.cloneArray - * @param {Array} ary コピー元のオブジェクトです。 - * @return {Array} - */ -function X_Object_cloneArray( ary ){ - var ret = [], - i = ary.length; - - if( !i ) return ret; - for( ; i; ){ - ret[ --i ] = ary[ i ]; - }; - return ret; -}; - -/** * object が空か?調べます。 object でない場合、undefined が返る * @alias X.Object.isEmpty * @param {object} v @@ -172,11 +152,3 @@ function X_Object_isEmpty( v ){ return true; }; -/* -X.matchTest = function( array1, array2 ){ - var i = array2.length; - for( ; i; ){ - if( array1.indexOf( array2[ --i ] ) === -1 ) return false; - }; - return true; -}; */ diff --git a/0.6.x/js/01_core/05_XArray.js b/0.6.x/js/01_core/05_XArray.js index e69de29..2bbf616 100644 --- a/0.6.x/js/01_core/05_XArray.js +++ b/0.6.x/js/01_core/05_XArray.js @@ -0,0 +1,39 @@ +/** + * Array に関するメソッドを集めたものです。 + * @namespace X.Array + * @alias X.Array + */ +X[ 'Array' ] = { + 'copy' : X_Array_copy +}; + +// renamed +// X.Object.cloneArray -> X.Array.copy +// X.Object.clone -> X.Object.copy + +/** + * 単純にメンバーをコピーした Array を返します。 + * @alias X.Array.copy + * @param {Array} ary コピー元のオブジェクトです。 + * @return {Array} + */ +function X_Array_copy( ary ){ + var ret = [], + i = ary.length; + + if( !i ) return ret; + for( ; i; ){ + ret[ --i ] = ary[ i ]; + }; + return ret; +}; + +/* +X.matchTest = function( array1, array2 ){ + var i = array2.length; + for( ; i; ){ + if( array1.indexOf( array2[ --i ] ) === -1 ) return false; + }; + return true; +}; */ + diff --git a/0.6.x/js/01_core/13_XClass.js b/0.6.x/js/01_core/13_XClass.js index 9d92b55..ee7174d 100644 --- a/0.6.x/js/01_core/13_XClass.js +++ b/0.6.x/js/01_core/13_XClass.js @@ -204,7 +204,7 @@ X_Class_CommonMethods = case 4 : return sFunc.call( this, args[ 1 ], args[ 2 ], args[ 3 ] ); default : - args = X_Object_cloneArray( args ); + args = X_Array_copy( args ); args.shift(); return sFunc.apply( this, args ); }; @@ -336,7 +336,7 @@ X[ 'Class' ] = /** @lends X.Class */ { * ); */ function X_Class_create( /* displayName, classSetting, privateClass, props */ ){ - var args = X_Object_cloneArray( arguments ), + var args = X_Array_copy( arguments ), displayName = args[ 0 ], classSetting, opt_pool, opt_abstract, opt_final, @@ -503,7 +503,7 @@ function X_Class_subClassOf( klass ){ * @return {__ClassBase__} */ function X_Class_inherits( /* displayName, classSetting, opt_PrivateClass, props */ ){ - var args = X_Object_cloneArray( arguments ), + var args = X_Array_copy( arguments ), params = [], Super = this, superDef = X_Class_getClassDef( Super ), diff --git a/0.6.x/js/02_dom/03_XDomEvent.js b/0.6.x/js/02_dom/03_XDomEvent.js index 4ab70dd..07886c0 100644 --- a/0.6.x/js/02_dom/03_XDomEvent.js +++ b/0.6.x/js/02_dom/03_XDomEvent.js @@ -205,7 +205,7 @@ if( !X_UA[ 'IE' ] || 9 <= X_UA[ 'IE' ] ){ // http://www.programming-magic.com/20090127231544/ // Opera で button==2の場合、コンテキストメニューイベントを発火 「ツール」->「設定」->「詳細設定」->「コンテンツ」->「Javascriptオプション」で「右クリックを制御するスクリプトを許可する」 if( originalType === 'mousedown' && this[ 'button' ] === 2 && X_UA[ 'Opera' ] ){ - events = [ X_Object_clone( this ), X_Object_clone( this ) ]; + events = [ X_Object_copy( this ), X_Object_copy( this ) ]; events[ 1 ].type = 'contextmenu'; return events; }; diff --git a/0.6.x/js/02_dom/07_XNodeList.js b/0.6.x/js/02_dom/07_XNodeList.js index 50eaff9..443677c 100644 --- a/0.6.x/js/02_dom/07_XNodeList.js +++ b/0.6.x/js/02_dom/07_XNodeList.js @@ -34,7 +34,7 @@ X_NodeList.prototype[ 'each' ] = function( func /* opt_args... */ ){ i = 0, args; if( 1 < arguments.length ){ - args = X_Object_cloneArray( arguments ); + args = X_Array_copy( arguments ); for( ; i < l; ++i ){ args[ 0 ] = i; if( func.apply( this[ i ], args ) === false ) break; diff --git a/0.6.x/js/02_dom/20_XNode.js b/0.6.x/js/02_dom/20_XNode.js index 04f01e2..de76d17 100644 --- a/0.6.x/js/02_dom/20_XNode.js +++ b/0.6.x/js/02_dom/20_XNode.js @@ -505,7 +505,7 @@ function X_Node_clone( opt_clone_children ){ var xnode, xnodes, i, l; if( this[ '_tag' ] ){ X_Node_newByTag = true; - xnode = Node( this[ '_tag' ], X_Object_clone( this[ '_attrs' ] ), X_Object_clone( this[ '_css' ] ) ) + xnode = Node( this[ '_tag' ], X_Object_copy( this[ '_attrs' ] ), X_Object_copy( this[ '_css' ] ) ) [ 'attr' ]( { 'id' : this[ '_id' ] } ) [ 'className' ]( this[ '_className' ] ); if( opt_clone_children && ( xnodes = this[ '_xnodes' ] ) && ( l = xnodes.length ) ){ @@ -1182,7 +1182,7 @@ function X_Node_call( name /*, opt_args... */ ){ func = raw[ name ]; if( X_Type_isFunction( func ) ){ if( l ){ - args = X_Object_cloneArray( arguments ); + args = X_Array_copy( arguments ); args.shift(); return func.apply( raw, args ); }; @@ -1192,7 +1192,7 @@ function X_Node_call( name /*, opt_args... */ ){ // typeof func === unknown に対策 // http://la.ma.la/blog/diary_200509031529.htm if( l ){ - args = X_Object_cloneArray( arguments ); + args = X_Array_copy( arguments ); args.shift(); params = []; @@ -1216,7 +1216,7 @@ function X_Node_call( name /*, opt_args... */ ){ function X_Node_each( func /*, opt_args */ ){ var args; if( 1 < arguments.length ){ - args = X_Object_cloneArray( arguments ); + args = X_Array_copy( arguments ); args[ 0 ] = 0; func.apply( this, args ); } else { diff --git a/0.6.x/js/02_dom/22_XTreeBuilder.js b/0.6.x/js/02_dom/22_XTreeBuilder.js index 8a6c74a..72eae6b 100644 --- a/0.6.x/js/02_dom/22_XTreeBuilder.js +++ b/0.6.x/js/02_dom/22_XTreeBuilder.js @@ -124,7 +124,7 @@ X_TEMP._onPreInit = //X_UA[ 'MacIE' ] && alert( body.innerHTML ); // cleanup tree function cleanUpTree( elm, skip, head ){ - var nodes = X_Object_cloneArray( elm.childNodes ), + var nodes = X_Array_copy( elm.childNodes ), i = 0, l = nodes.length, node, tag, textNode, content; @@ -256,7 +256,7 @@ X_TEMP._handleEvent = function( e ){ }; X_TEMP.asyncCreateTree = function( parent, elems, elmProgress, async ){ - var xnodes = async ? 0 : X_Object_cloneArray( parent[ '_xnodes' ] ), + var xnodes = async ? 0 : X_Array_copy( parent[ '_xnodes' ] ), l = async ? 0 : xnodes.length, stack = async ? async.stack : [], done = async ? async.done : 0, @@ -266,7 +266,7 @@ X_TEMP.asyncCreateTree = function( parent, elems, elmProgress, async ){ xnodes : xnodes, l : l, i : 0, - elems : X_Object_cloneArray( elems ), + elems : X_Array_copy( elems ), j : 0, xtext : null, flag : 0 @@ -392,12 +392,12 @@ X_TEMP.bindElementToXnode = return { me : xnode, - xnodes : X_Object_cloneArray( xnode[ '_xnodes' ] ), + xnodes : X_Array_copy( xnode[ '_xnodes' ] ), xtext : null, flag : 0, i : 0, l : xnode[ '_xnodes' ].length, - elems : X_Object_cloneArray( elm.childNodes ), + elems : X_Array_copy( elm.childNodes ), j : 0, skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; @@ -531,12 +531,12 @@ X_TEMP.bindElementToXnode = if( xnode[ '_xnodes' ] && xnode[ '_xnodes' ].length ){ return { me : xnode, - xnodes : X_Object_cloneArray( xnode[ '_xnodes' ] ), + xnodes : X_Array_copy( xnode[ '_xnodes' ] ), xtext : null, flag : 0, i : 0, l : xnode[ '_xnodes' ].length, - elems : X_Object_cloneArray( elm.children ), + elems : X_Array_copy( elm.children ), j : 0, skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; diff --git a/0.6.x/js/03_plugin/00_XPlugin.js b/0.6.x/js/03_plugin/00_XPlugin.js index aa9daf9..7bd7e97 100644 --- a/0.6.x/js/03_plugin/00_XPlugin.js +++ b/0.6.x/js/03_plugin/00_XPlugin.js @@ -1,24 +1,3 @@ -/* - * VBS - */ - -if( false && 5 <= X_UA[ 'IE' ] && X_UA[ 'IE' ] < 11 ){ - (function(){ - - var script = document.createElement( "script" ) ; - script[ "type" ] = "text/vbscript" ; - script.text = [ - "Function vba_IEBinaryToArrayBytes()\n" , - " vba_IEBinaryToArrayBytes = 1\n" , - "End Function\n" - ].join( "" ) ; - document.getElementsByTagName("head")[ 0 ].appendChild( script ) ; - - // alert( vba_IEBinaryToArrayBytes() ); - })(); - -}; - /* * Flash Player 10 バージョン判別チェックリスト @@ -95,7 +74,11 @@ var X_Pulgin_FLASH_VERSION = navigator.mimeTypes && navigator.mimeTypes[ 'application/x-googlegears' ] && navigator.mimeTypes[ 'application/x-googlegears' ].enabledPlugin - ); + ), + + X_Pulgin_VBS_ENABLED = + X_UA[ 'Windows' ] && !X_UA[ 'WinCE' ] && X_UA[ 'IE' ] < 11; + /** * @namespace X.Pulgin diff --git a/0.6.x/js/05_util/01_XNinjaIframe.js b/0.6.x/js/05_util/01_XNinjaIframe.js index e16f550..08f7d21 100644 --- a/0.6.x/js/05_util/01_XNinjaIframe.js +++ b/0.6.x/js/05_util/01_XNinjaIframe.js @@ -50,7 +50,8 @@ X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( if( html ) this._contentHTML = html; - this[ 'appendTo' ]( X_Node_body /* X_Node_systemNode */ ); + this[ 'appendTo' ]( X_Node_body /* X_Node_systemNode */ ) + [ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, X_Util_NinjaIframe_handleEvent ); X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, X_Util_NinjaIframe_handleEvent ); }, @@ -82,13 +83,6 @@ X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( }; return this; - }, - - // TODO close -> kill - 'close' : function(){ - X_ViewPort[ 'unlisten' ]( X_EVENT_AFTER_UPDATE, this, X_Util_NinjaIframe_handleEvent ); - this.call( 'close' ); - this[ 'kill' ](); } } @@ -131,6 +125,11 @@ function X_Util_NinjaIframe_handleEvent( e ){ case 'error' : this[ 'asyncDispatch' ]( 'ninjaerror' ); break; + + case X_EVENT_KILL_INSTANCE : + X_ViewPort[ 'unlisten' ]( X_EVENT_AFTER_UPDATE, this, X_Util_NinjaIframe_handleEvent ); + this._iwin && this._iwin.close(); + break; }; return X_Callback_STOP_PROPAGATION; diff --git a/0.6.x/js/06_net/01_XNetXHR.js b/0.6.x/js/06_net/01_XNetXHR.js index 265cc79..f5db50f 100644 --- a/0.6.x/js/06_net/01_XNetXHR.js +++ b/0.6.x/js/06_net/01_XNetXHR.js @@ -110,7 +110,9 @@ X[ 'XHR' ] = { 'UPLOAD_PROGRESS' : X_Net_XHR_upload, // or gadget proxy or flash - 'CORS' : X_Net_XHR_xdr || X_Net_XHR_cors + 'CORS' : X_Net_XHR_xdr || X_Net_XHR_cors, + + 'BINARY' : X_Pulgin_VBS_ENABLED }; if( X_Net_XHR_msXMLVer ) X[ 'XHR' ][ 'MSXML_VERSION' ] = X_Net_XHR_msXMLVer; @@ -190,9 +192,8 @@ X_TEMP.X_Net_XHR_params = { // js, css raw.responseType = 'text'; break; - case 'json' : - case 'moz-json' : // firefox9- - raw.responseType = X_UA[ 'Gecko' ] ? this._dataType : ''; // Iron 37 でエラー + case 'json' : // firefox9- は moz-json + raw.responseType = X_UA[ 'Gecko' ] < 10 ? 'moz-json' : X_UA[ 'Gecko' ] ? this._dataType : ''; // Iron 37 でエラー break; case 'document' : case 'xml' : @@ -211,11 +212,15 @@ X_TEMP.X_Net_XHR_params = { // http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r_1.html if( !this._isMsXML && raw.overrideMimeType ){ - switch( X_URL_getEXT( url ) ){ + switch( X_URL_getEXT( url ) || this._dataType ){ case 'html' : + case 'htm' : case 'xml' : tmp = 'text/xml'; break; + case 'json' : + tmp = 'application/json'; // 2015.6.29 + break; case 'mp3' : tmp = 'audio/mpeg'; @@ -250,9 +255,9 @@ X_TEMP.X_Net_XHR_params = { headers[ 'Pragma' ] = 'no-cache'; headers[ 'Cache-Control' ] = 'no-cache'; headers[ 'If-Modified-Since' ] = 'Thu, 01 Jun 1970 00:00:00 GMT'; - } else */ + } */ // http://nakigao.sitemix.jp/blog/?p=2040 - // json 取得時に SafariでHTTP/412のエラー。但し相手が audio の場合、この指定があるとロードに失敗する。 iOS8.2, iOS7.1 では遭遇せず + // json 取得時に SafariでHTTP/412のエラー。但し相手が audio の場合この指定があるとロードに失敗する。 iOS8.2, iOS7.1 では遭遇せず if( this._dataType === 'json' ){ headers[ 'If-Modified-Since' ] = ( new Date ).toUTCString(); }; diff --git a/0.6.x/js/06_net/10_XOAuth2.js b/0.6.x/js/06_net/10_XOAuth2.js index 63e220d..91f7f67 100644 --- a/0.6.x/js/06_net/10_XOAuth2.js +++ b/0.6.x/js/06_net/10_XOAuth2.js @@ -54,7 +54,7 @@ X[ 'OAuth2' ] = X_EventDispatcher[ 'inherits' ]( 'Constructor' : function( obj ){ var expires_at; - obj = X_Object_clone( obj ); + obj = X_Object_copy( obj ); obj[ 'refreshMargin' ] = obj[ 'refreshMargin' ] || 300000; X_Pair_create( this, obj ); diff --git a/0.6.x/js/07_audio/00_XAudio.js b/0.6.x/js/07_audio/00_XAudio.js index c0a39d8..783e885 100644 --- a/0.6.x/js/07_audio/00_XAudio.js +++ b/0.6.x/js/07_audio/00_XAudio.js @@ -76,7 +76,7 @@ X[ 'Audio' ] = X_EventDispatcher[ 'inherits' ]( 'Constructor' : function( sourceList, opt_option ){ X_Audio_startDetectionBackend( X_Audio_BACKENDS[ 0 ], this, - X_Type_isArray( sourceList ) ? X_Object_cloneArray( sourceList ) : [ sourceList ], + X_Type_isArray( sourceList ) ? X_Array_copy( sourceList ) : [ sourceList ], opt_option || {} ); this[ 'listenOnce' ]( [ X_EVENT_BACKEND_READY, X_EVENT_BACKEND_NONE, X_EVENT_KILL_INSTANCE ], X_Audio_handleEvent ); }, diff --git a/0.6.x/js/07_audio/10_XAudioSprite.js b/0.6.x/js/07_audio/10_XAudioSprite.js index 1ff87f6..542eea1 100644 --- a/0.6.x/js/07_audio/10_XAudioSprite.js +++ b/0.6.x/js/07_audio/10_XAudioSprite.js @@ -59,7 +59,7 @@ X[ 'AudioSprite' ] = function( setting ){ for( k in setting ){ v = setting[ k ]; if( X_Type_isArray( v ) && v !== urls ){ - v = X_Object_cloneArray( v ); + v = X_Array_copy( v ); for( i = v.length; i; ){ --i; if( i !== 2 ) v[ i ] = X_AudioWrapper_timeStringToNumber( v[ i ] ); @@ -69,7 +69,7 @@ X[ 'AudioSprite' ] = function( setting ){ }; }; - X_Audio_startDetectionBackend( X_Audio_BACKENDS[ 0 ], X_Audio_Sprite_instance, X_Object_cloneArray( urls ), option ); + X_Audio_startDetectionBackend( X_Audio_BACKENDS[ 0 ], X_Audio_Sprite_instance, X_Array_copy( urls ), option ); X_Audio_Sprite_instance[ 'listenOnce' ]( [ X_EVENT_BACKEND_READY, X_EVENT_BACKEND_NONE ], X_AudioSprite_backendHandler ); X_Audio_Sprite_instance[ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, X_Audio_Sprite_handleEvent ); diff --git a/0.6.x/js/20_ui/02_XUI_Attr.js b/0.6.x/js/20_ui/02_XUI_Attr.js index 2e865f3..26b9b3c 100644 --- a/0.6.x/js/20_ui/02_XUI_Attr.js +++ b/0.6.x/js/20_ui/02_XUI_Attr.js @@ -145,7 +145,7 @@ function XUI_createChecker( str ){ }; function XUI_Attr_createAttrDef( base, defs ){ - var F = base ? X_Object_clone( base ) : {}, + var F = base ? X_Object_copy( base ) : {}, z = base ? base._last : 0, n = 1, p, def; diff --git a/0.6.x/js/20_ui/08_Box.js b/0.6.x/js/20_ui/08_Box.js index 2c66217..613400a 100644 --- a/0.6.x/js/20_ui/08_Box.js +++ b/0.6.x/js/20_ui/08_Box.js @@ -299,18 +299,18 @@ X.UI.Box = X.UI.AbstractUINode.inherits( }, add : function( /* node, node, node ... */ ){ - X_Pair_get( this ).addAt( this.numNodes() + 1, X_Object_cloneArray( arguments ) ); + X_Pair_get( this ).addAt( this.numNodes() + 1, X_Array_copy( arguments ) ); return this; }, addAt : function( index /* , node , node, node ... */ ){ var nodes; if( index < 0 ) index = 0; - nodes = X_Object_cloneArray( arguments ); + nodes = X_Array_copy( arguments ); X_Pair_get( this ).addAt( nodes.shift(), nodes ); return this; }, remove : function( /* node, node, node ... */ ){ - X_Pair_get( this )[ 'remove' ]( X_Object_cloneArray( arguments ) ); + X_Pair_get( this )[ 'remove' ]( X_Array_copy( arguments ) ); return this; }, removeAt : function( from, length ){ diff --git a/0.6.x/js/20_ui/14_ChromeBox.js b/0.6.x/js/20_ui/14_ChromeBox.js index 7053192..06ea4a5 100644 --- a/0.6.x/js/20_ui/14_ChromeBox.js +++ b/0.6.x/js/20_ui/14_ChromeBox.js @@ -52,13 +52,13 @@ X.UI.ChromeBox = X.UI.Box.inherits( X_Pair_create( this, XUI_ChromeBox( this, XUI_Layout_Canvas, arguments ) ); }, add : function( /* node, node, node ... */ ){ - X_Pair_get( this ).containerNode.addAt( this.numNodes(), X_Object_cloneArray( arguments ) ); + X_Pair_get( this ).containerNode.addAt( this.numNodes(), X_Array_copy( arguments ) ); return this; }, addAt : function( index /* , node, node, node ... */ ){ var nodes; if( index < 0 ) index = 0; - nodes = X_Object_cloneArray( arguments ); + nodes = X_Array_copy( arguments ); X_Pair_get( this ).containerNode.addAt( nodes.shift(), nodes ); return this; }, diff --git a/0.6.x/js/20_ui/16_Repeater.js b/0.6.x/js/20_ui/16_Repeater.js index e709360..6deacef 100644 --- a/0.6.x/js/20_ui/16_Repeater.js +++ b/0.6.x/js/20_ui/16_Repeater.js @@ -7,19 +7,14 @@ var XUI_Repeater = XUI_Box.inherits( '_Repeater', X_Class.NONE, { - layout : XUI_Layout_Vertical, + layout : XUI_Layout_Vertical, - dataSource : null, // Array., Array. + dataSource : null, // Array., Array. itemRenderer : null, itemNodes : null, - - startIndex : 0, - startRenderIndex : 0, - numItemsParPage : 0, - numItemsPrev : 0, - numItems : 0, + itemHeightLast : 0, itemHeightLastEM : 0, @@ -33,8 +28,6 @@ var XUI_Repeater = XUI_Box.inherits( initialize : function(){ XUI_AbstractUINode.prototype.initialize.apply( this, arguments ); - - this.parent[ 'listen' ]( XUI_Event.SCROLL_END, this ); }, /* @@ -44,9 +37,6 @@ var XUI_Repeater = XUI_Box.inherits( var dataSource = this[ 'dataSource' ]; if( allowedW + allowedH === XUI_Attr_AUTO ) return false; - - this.scrollPortWidth = allowedW; - this.scrollPortHeight = allowedH; this.preMesure( allowedW, allowedH ); @@ -67,54 +57,8 @@ var XUI_Repeater = XUI_Box.inherits( }, handleEvent : function( e ){ - var scrollBox, scrollY, dataSource, offsetY, startIndex, maxIndex, offset, itemNodes, ary, i, l; - switch( e.type ){ - case XUI_Event.SCROLL_END : - scrollBox = this.parentData; - scrollY = - scrollBox.scrollY; - dataSource = this[ 'dataSource' ]; - itemNodes = this.itemNodes; - itemH = this.itemHeightLast; - - // transition Y を 0 付近に。 - - - // startIndex の計算 - startIndex = scrollY / itemH | 0; - - /*maxIndex = dataSource.length <= this.numItems ? 0 : dataSource.length - this.numItems; - console.log( ' >>> ' + startIndex + ' ' + maxIndex ); - - startIndex = - startIndex < 0 ? 0 : - maxIndex < startIndex ? maxIndex : startIndex; */ - // アイテムの座標の修正とレンジ外のアイテムを配列内で再配置 - offset = startIndex - this.startIndex; // visible な stratIndex renderStartIndex - this.startIndex = startIndex; - - console.log( this.numItemsPrev + ' oo ' + offset ) - - if( 0 < offset ){ - itemNodes.push.apply( itemNodes, itemNodes.splice( 0, offset ) ); - } else - if( offset < - 0 ){ - itemNodes.unshift.apply( itemNodes, itemNodes.splice( itemNodes.length + offset ) ); - }; - - // 再配置されたアイテムにitemData のセット - this.updateItemRenderer( this.contentWidth, this.scrollPortHeight ); - - - - offsetY = scrollY % itemH; - offsetY = offsetY === 0 ? 0 : ( offsetY - itemH ); - offsetY += ( this.startRenderIndex - this.startIndex ) * itemH; - //console.log( ' ====> ' + this.startRenderIndex + ' -> ' + this.startIndex + ' scrollY:' + offsetY ); - //scrollBox.scrollTo( 0, - scrollY, 0, '', 0 ); // anime無し - //console.log( ' <==== ' ); - break; }; }, @@ -123,19 +67,14 @@ var XUI_Repeater = XUI_Box.inherits( attrs = this.attrObject || this.attrClass.prototype, gapY = XUI_AbstractUINode_calcValue( attrs[ this.usableAttrs.gapY.No ], _w ), dataSource = this[ 'dataSource' ], - render = this[ 'itemRenderer' ], + renderer = this[ 'itemRenderer' ], l = dataSource.length, - start = this.startIndex - this.numItemsPrev, itemH = this.itemHeightLastEM, - i, data, node, _y = 0, last, n; - - i = this.startRenderIndex = start = start < 0 ? 0 : start; - - _y = ( itemH + gapY ) * i; + i = 0, data, node, _y = 0, last, n; for( ; i < l; ++i ){ if( !( data = itemNodes[ i ] ) ){ - node = render.clone( true ); + node = renderer.clone( true ); this.addAt( i, [ node ] ); data = itemNodes[ i ] = X_Pair_get( node ); // init -> addToParent -> creationComplete @@ -146,17 +85,10 @@ var XUI_Repeater = XUI_Box.inherits( _y += ( itemH || data.boxHeight ) + gapY; // 一番最初のループ。ここでページあたりのアイテム数を計算 - if( !itemH && i === start ){ + if( !itemH && i === 0 ){ itemH = _y - gapY; this.itemHeightLastEM = itemH; - this.itemHeightLast = itemH * X_ViewPort_baseFontSize, - // scroller の miniHeight は(例えば)親の高さの300% そこにいくつのアイテムを並べることが出来るか?端数切り上げ - this.numItemsParPage = _h / itemH + 0.999 | 0; - n = this.numItems = ( _h * 3 ) / itemH + 0.999 | 0; // TODO boxHeight - this.numItemsPrev = ( this.numItems - this.numItemsParPage ) / 2 | 0; - last = i + n; - // データの最後まで、または、開始位置から 3ページ分を生成する - l = last < l ? last : l; + this.itemHeightLast = itemH * X_ViewPort_baseFontSize; }; }; @@ -165,7 +97,7 @@ var XUI_Repeater = XUI_Box.inherits( }; // TODO contentHeight は attr を無視する -> 未表示領域につくるアイテム数 GPU の有無で変わる - this.contentHeight = dataSource.length * ( itemH + gapY ) - gapY; + this.contentHeight = l * ( itemH + gapY ) - gapY; }, onPropertyChange : function( name, newValue ){ diff --git a/0.6.x/js/import.js b/0.6.x/js/import.js index 11ebfcb..e5c7745 100644 --- a/0.6.x/js/import.js +++ b/0.6.x/js/import.js @@ -55,8 +55,10 @@ document.write( [ 'js/06_net/00_XNet.js', 'js/06_net/01_XNetXHR.js', 'js/06_net/02_XNetJSONP.js', - //'js/06_net/03_XNetForm.js', + 'js/06_net/03_XNetForm.js', 'js/06_net/04_XNetImage.js', + 'js/06_net/05_XXHRGadget.js', + 'js/06_net/10_XOAuth2.js', 'js/07_audio/00_XAudio.js', 'js/07_audio/01_XWebAudio.js', -- 2.11.0