From: itozyun Date: Wed, 15 Jul 2015 16:42:20 +0000 (+0900) Subject: Version 0.6.169, add doc comment. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=3d352d8bf476ab57cc333e8d02d0e6ea5efa69b7 Version 0.6.169, add doc comment. --- diff --git a/0.6.x/js/01_core/04_XObject.js b/0.6.x/js/01_core/04_XObject.js index 7e42e0c..5791535 100644 --- a/0.6.x/js/01_core/04_XObject.js +++ b/0.6.x/js/01_core/04_XObject.js @@ -16,7 +16,7 @@ var X_Object_inObject = X_UA[ 'IE' ] < 5.5 ? // TODO JScript で判定 }; return false; }) : - new Function( 'a,b', 'return a in b' ); + new Function( 'a,b', 'return (""+a) in b' ); // ------------------------------------------------------------------------- // @@ -24,7 +24,7 @@ var X_Object_inObject = X_UA[ 'IE' ] < 5.5 ? // TODO JScript で判定 // ------------------------------------------------------------------------- // /** - * Object に関するメソッドを集めたものです。 + * Object に関する関数を集めたものです。 * @namespace X.Object * @alias X.Object */ @@ -109,7 +109,7 @@ function X_Object_deepCopy( src ){ return X_Object_deepCopy_( src, [], [], -1 ); }; -function X_Object_deepCopy_( src, objSrc, objCopy, n ) { +function X_Object_deepCopy_( src, objSrc, objCopy, n ){ var ret, i, k; if( !src ){ // 0, "", null, undefined, NaN, false diff --git a/0.6.x/js/01_core/05_XArray.js b/0.6.x/js/01_core/05_XArray.js index 2bbf616..4154c56 100644 --- a/0.6.x/js/01_core/05_XArray.js +++ b/0.6.x/js/01_core/05_XArray.js @@ -1,5 +1,5 @@ /** - * Array に関するメソッドを集めたものです。 + * Array に関する関数を集めたものです。 * @namespace X.Array * @alias X.Array */ diff --git a/0.6.x/js/01_core/06_XString.js b/0.6.x/js/01_core/06_XString.js index 58ec770..828db90 100644 --- a/0.6.x/js/01_core/06_XString.js +++ b/0.6.x/js/01_core/06_XString.js @@ -9,6 +9,7 @@ var X_String_CRLF = String.fromCharCode( 13 ) + String.fromCharCode( 10 ); // ------------------------------------------------------------------------- // /** + * 文字列に関する関数を集めたものです。 * @namespace X.String * @alias X.String */ @@ -32,6 +33,12 @@ X[ 'String' ] = { // ------------------------------------------------------------------------- // // --- implements ---------------------------------------------------------- // // ------------------------------------------------------------------------- // +/** + * 文字列を数値、NaN,Infinity,-Infinity,bool値、null,undefinedに変換します。1e3等には未対応です。 + * @alias X.String.parse + * @param {string} + * @return {*} + */ function X_String_parse( v ){ var _v, n; if( X_Type_isString( v ) ){ @@ -55,7 +62,14 @@ function X_String_parse( v ){ }; return v; }; - + +/** + *

空白文字を半角スペースに変換します。\n\r,\t,\r,\n,\f,\b + *

2つ以上の連続する半角スペースを一つの半角スペースにします。 + * @alias X.String.cleanupWhiteSpace + * @param {string} + * @return {string} + */ function X_String_cleanupWhiteSpace( text ){ var _ = ' ', __ = ' ', CRLF = X_String_CRLF; //text.indexOf( CRLF ) !== -1 && ( text = text.split( CRLF ).join( _ ) ); @@ -65,12 +79,23 @@ function X_String_cleanupWhiteSpace( text ){ text.indexOf( '\n' ) !== -1 && ( text = text.split( '\n' ).join( _ ) ); text.indexOf( '\f' ) !== -1 && ( text = text.split( '\f' ).join( _ ) ); text.indexOf( '\b' ) !== -1 && ( text = text.split( '\b' ).join( _ ) ); - while( text.indexOf( __ ) !== -1 ){ - text = text.split( __ ).join( _ ); + //while( text.indexOf( __ ) !== -1 ){ + // text = text.split( __ ).join( _ ); + //}; + //return text; + while( true ){ + text = text.split( __ ); + if( text.length < 2 ) return text.join( _ ); + text = text.join( _ ); }; - return text; }; +/** + * 空白文字列を <br> に変換します。タブを &nbsp; 4つに変換します。 + * @alias X.String.whiteSpaceToTag + * @param {string} + * @return {string} html文字列 + */ function X_String_whiteSpaceToTag( text ){ if( text == null ) return ''; return text.toString() @@ -85,6 +110,12 @@ function X_String_whiteSpaceToTag( text ){ .split( '\b' ).join( '' ); }; +/** + * 一部の文字実体参照をデコードします。", &, <, >,   + * @alias X.String.chrReferanceTo + * @param {string} + * @return {string} html文字列 + */ function X_String_chrReferanceTo( str ){ if( str == null ) return ''; return str.toString() @@ -95,6 +126,12 @@ function X_String_chrReferanceTo( str ){ .split( ' ' ).join( ' ' ); }; +/** + * htmlタグで使われる文字を文字実体参照に変換します。", &, <, >,   + * @alias X.String.chrReferanceTo + * @param {string} + * @return {string} + */ function X_String_toChrReferance( str ){ if( str == null ) return ''; str += ''; @@ -106,30 +143,43 @@ function X_String_toChrReferance( str ){ .split( ' ' ).join( ' ' ); }; +/** + * htmlタグで使われる文字を文字実体参照に変換します。", &, <, >,   + * @alias X.String.isNumberString + * @param {string} + * @return {boolean} + */ function X_String_isNumberString( v ){ var n = v - 0; return '' + n === v || '' + n === '0' + v; }; -// https://github.com/jquery/jquery/blob/master/src/serialize.js +/** + * postdata のために object を文字列に変換します。 + * https://github.com/jquery/jquery/blob/master/src/serialize.js + * @alias X.String.serialize + * @param {object} + * @param {boolean} [traditional=] + * @return {string} + */ function X_String_serialize( a, traditional ) { var prefix, list = []; // If an array was passed in, assume that it is an array of form elements. - if ( X_Type_isArray( a ) && false ) { + //if ( X_Type_isArray( a ) && false ) { // Serialize the form elements //jQuery.each( a, function() { // X_String_serialize_addParam( list, this.name, this.value ); //}); - } else { + //} else { // If traditional, encode the 'old' way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { - X_String_serialize_buildParams( list, prefix, a[ prefix ], traditional ); + X_String_serialize_buildParams( list, prefix, a[ prefix ], !!traditional ); } - } + //} // Return the resulting serialization return list.join( '&' ).split( '%20' ).join( '+' ); @@ -176,9 +226,3 @@ function X_String_serialize_buildParams( list, prefix, obj, traditional ) { }; }; -/* - * 信頼できる文字列だけに対して json 文字列のパースを行います - */ -function X_String_parseTrustedJsonString( jsonString ){ - return window.JSON ? JSON.parse( jsonString ) : eval( '(' + jsonString + ')' ); -}; diff --git a/0.6.x/js/01_core/08_XURL.js b/0.6.x/js/01_core/08_XURL.js index a75aaaf..0eaccab 100644 --- a/0.6.x/js/01_core/08_XURL.js +++ b/0.6.x/js/01_core/08_XURL.js @@ -15,7 +15,7 @@ var X_URL_BASE_URL = ( function( parts ){ X_URL_IS_LOCAL = X_URL_IS_FILE || location.hostname === 'localhost' || location.hostname === '127.0.0.1', - X_URL_PARAMS = X_URL_ParamToObj( location.search.slice( 1 ) ); + X_URL_PARAMS = X_URL_paramToObj( location.search.slice( 1 ) ); // ------------------------------------------------------------------------- // // --- interface ----------------------------------------------------------- // @@ -26,19 +26,37 @@ var X_URL_BASE_URL = ( function( parts ){ * @alias X.URL */ X[ 'URL' ] = { - + /** + * ベースurl + * @alias X.URL.BASE_URL + * @type {string} + */ 'BASE_URL' : X_URL_BASE_URL, - + /** + * ファイルプロトコルである。 + * @alias X.URL.IS_FILE + * @type {boolean} + */ 'IS_FILE' : X_URL_IS_FILE, - + /** + * ローカルホストである。 + * @alias X.URL.IS_LOCAL + * @type {boolean} + */ 'IS_LOCAL' : X_URL_IS_LOCAL, - + /** + * url パラメータを object に格納したもの。 + * @alias X.URL.PARAMS + * @type {object} + */ 'PARAMS' : X_URL_PARAMS, - + 'create' : X_URL_create, 'toAbsolutePath' : X_URL_toAbsolutePath, + 'objToParam' : X_URL_objToParam, + 'isSameDomain' : X_URL_isSameDomain, 'isSameProtocol' : X_URL_isSameProtocol, @@ -53,10 +71,12 @@ X[ 'URL' ] = { // ------------------------------------------------------------------------- // // --- implements ---------------------------------------------------------- // // ------------------------------------------------------------------------- // -/* - * original - * AS3で相対パスを絶対パスに変換する - * http://www.shin-go.net/motionlab/?p=449 +/** + *

絶対 url にして返します。 + *

original AS3で相対パスを絶対パスに変換する http://www.shin-go.net/motionlab/?p=449 + * @alias X.URL.toAbsolutePath + * @param {string} + * @return {string} url */ function X_URL_toAbsolutePath( path ){ var s = '/', @@ -81,29 +101,59 @@ function X_URL_toAbsolutePath( path ){ }; return [ _ary[ 0 ], ss, ary.join( s ), s, path ].join( '' ); }; - +/** + * 同一ドメインか? + * @alias X.URL.isSameDomain + * @param {string} + * @return {boolean} + */ function X_URL_isSameDomain( path ){ path = X_URL_cleanup( X_URL_toAbsolutePath( path ) ); return path === X_URL_BASE_URL || path.indexOf( X_URL_BASE_URL + '/' ) === 0; }; - +/** + * 同一プロトコルか? + * @alias X.URL.isSameProtocol + * @param {string} + * @return {boolean} + */ function X_URL_isSameProtocol( path ){ return X_URL_toAbsolutePath( path ).indexOf( location.protocol ) === 0; }; - +/** + * ローカルリソースへのアクセスか? + * @alias X.URL.isLocal + * @param {string} + * @return {boolean} + */ function X_URL_isLocal( path ){ return X_URL_toAbsolutePath( path ).indexOf( 'file:' ) === 0; }; - +/** + * url パラメータとハッシュフラグメントを削除します。 + * @alias X.URL.cleanup + * @param {string} + * @return {boolean} + */ function X_URL_cleanup( path ){ return path.split( '?' )[ 0 ].split( '#' )[ 0 ]; }; - +/** + * 拡張子を返します。 + * @alias X.URL.getEXT + * @param {string} + * @return {string} + */ function X_URL_getEXT( path ){ path = X_URL_cleanup( path ).split( '.' ); return path.length ? path.pop() : ''; }; - +/** + * object を url パラメータにします。値が object の場合、データは失われます。 + * @alias X.URL.objToParam + * @param {object} + * @return {string} + */ function X_URL_objToParam( data ){ var result = [], k, n = -1; for( k in data ){ @@ -114,14 +164,20 @@ function X_URL_objToParam( data ){ } return result.join( '' ); }; - +/** + * url にパラメータを加えた url を返します。 + * @alias X.URL.create + * @param {string} + * @param {object} + * @return {string} + */ function X_URL_create( url, params ){ if( !X_Type_isObject( params ) || !( params = X_URL_objToParam( params ) ) ) return url; return url + ( url.indexOf( '?' ) !== -1 ? '&' : '?' ) + params; }; -function X_URL_ParamToObj( str ){ +function X_URL_paramToObj( str ){ var i = 0, obj = {}, parts, l, pair, p; diff --git a/0.6.x/js/01_core/10_XPair.js b/0.6.x/js/01_core/10_XPair.js index c0c3cd8..df36d92 100644 --- a/0.6.x/js/01_core/10_XPair.js +++ b/0.6.x/js/01_core/10_XPair.js @@ -102,3 +102,4 @@ function X_Pair_release( key, opt_pair ){ }; return false; }; + diff --git a/0.6.x/js/01_core/12_XCallback.js b/0.6.x/js/01_core/11_Callback.js similarity index 100% rename from 0.6.x/js/01_core/12_XCallback.js rename to 0.6.x/js/01_core/11_Callback.js diff --git a/0.6.x/js/01_core/11_XClosure.js b/0.6.x/js/01_core/12_Closure.js similarity index 100% rename from 0.6.x/js/01_core/11_XClosure.js rename to 0.6.x/js/01_core/12_Closure.js diff --git a/0.6.x/js/01_core/13_XClass.js b/0.6.x/js/01_core/13_XClass.js index ee7174d..45747b1 100644 --- a/0.6.x/js/01_core/13_XClass.js +++ b/0.6.x/js/01_core/13_XClass.js @@ -58,7 +58,7 @@ X_Class_CommonMethods = if( listeners && !listeners[ X_LISTENERS_KILL_RESERVED ] && listeners[ X_EVENT_BEFORE_KILL_INSTANCE ] ){ X_Class_SEAL_KILLING[ X_Class_SEAL_KILLING.length ] = this; - if( this[ 'dispatch' ]( X_EVENT_BEFORE_KILL_INSTANCE ) & X_Callback_PREVENT_DEFAULT ){ + if( this[ 'dispatch' ]( X_EVENT_BEFORE_KILL_INSTANCE ) & X_CALLBACK_PREVENT_DEFAULT ){ this[ 'dispatch' ]( X_EVENT_KILL_INSTANCE_CANCELED ); // BEFORE_KILL_INSTANCE, KILL_INSTANCE_CANCELED 内で kill() しても PREVENT_DEFAULT の場合はこれを無視する。 flag = true; @@ -382,7 +382,7 @@ X[ 'Class' ] = /** @lends X.Class */ { classDef.Constructor = props[ 'Constructor' ]; }; - klass = X_Callback_actualClosure( cbHash ); // TODO callbackHash を class定義の置き場所にしてしまう!なるほど… + klass = X_Closure_actualClosure( cbHash ); // TODO callbackHash を class定義の置き場所にしてしまう!なるほど… cbHash.klass = klass; klass[ 'superClassOf' ] = X_Class_superClassOf; klass[ 'subClassOf' ] = X_Class_subClassOf; @@ -498,11 +498,10 @@ function X_Class_subClassOf( klass ){ * @example var SubClass = SuperClass.inherits( 'Sub', X_Class.FINAL, { ... } ); * @param {string} [displayName] クラスの名前 * @param {number} [classSetting=0] X_Class.POOL_OBJECT | X_Class.FINAL など - * @param {__ClassBase__=} [privateClass] このクラスとペアで動作するシャドウクラス * @param {object} [props={}] このクラスのメンバと関数。コンストラクタは Constructor と書くこと * @return {__ClassBase__} */ -function X_Class_inherits( /* displayName, classSetting, opt_PrivateClass, props */ ){ +function X_Class_inherits( /* displayName, classSetting, props */ ){ var args = X_Array_copy( arguments ), params = [], Super = this, diff --git a/0.6.x/js/01_core/14_XEvent.js b/0.6.x/js/01_core/14_XEvent.js index 522959b..e54199b 100644 --- a/0.6.x/js/01_core/14_XEvent.js +++ b/0.6.x/js/01_core/14_XEvent.js @@ -13,7 +13,7 @@ var X_Event_Rename = {}, var raw = this[ '_rawObject' ]; return raw.readyState === 'complete' || raw.readyState === 'loaded' ? - this[ 'dispatch' ]( 'load' ) : X_Callback_PREVENT_DEFAULT, X_Callback_STOP_PROPAGATION; + this[ 'dispatch' ]( 'load' ) : X_CALLBACK_PREVENT_DEFAULT, X_CALLBACK_STOP_PROPAGATION; }, // X_UA[ 'Opera' ] @@ -22,7 +22,7 @@ var X_Event_Rename = {}, }, contextmenu_proxy : function( e ){ - return e.button === 2 ? this[ 'dispatch' ]( 'contextmenu' ) : X_Callback_NONE; + return e.button === 2 ? this[ 'dispatch' ]( 'contextmenu' ) : X_CALLBACK_NONE; } }, @@ -54,7 +54,6 @@ var // 内部イベント X_EVENT_INIT = 7, // 公開イベント - /* @const */ X_EVENT_XDOM_READY = 8, X_EVENT_COMPLETE = 9, @@ -66,11 +65,8 @@ var // 内部イベント X_EVENT_CANCELED = 15, X_EVENT_TIMEOUT = 16, - /* @const */ X_EVENT_BEFORE_KILL_INSTANCE = 17, - /* @const */ X_EVENT_KILL_INSTANCE_CANCELED = 18, - /* @const */ X_EVENT_KILL_INSTANCE = 19, X_EVENT_VIEW_ACTIVATE = 20, @@ -116,13 +112,16 @@ var // 内部イベント X_Event_last = 49; +// in_page_jump +// on_screen_keyboard_show +// on_screen_keyboard_hide + /** * フレームワーク内で定義されたイベント。 * @namespace X.Event - * @alias X.Event - * @enum {number} */ -X[ 'Event' ] = { +X[ 'Event' ] = /** @lends X.Event */ +{ /** * X.ViewPort で発生する。DomContentLoaded に相当。document.body.innerHTML の内容から X.Node ツリーの作成が完了した。 * このイベント以降、X.Doc.create(), X.Doc.find() 等が可能になる。 @@ -172,10 +171,6 @@ X[ 'Event' ] = { */ 'BASE_FONT_RESIZED' : X_EVENT_BASE_FONT_RESIZED, -// in_page_jump -// on_screen_keyboard_show -// on_screen_keyboard_hide - /** * X_System で発生する。このイベントで要素のサイズを取得すると無限ループに! */ diff --git a/0.6.x/js/01_core/15_XEventDispatcher.js b/0.6.x/js/01_core/15_XEventDispatcher.js index aceaca5..5a5b17d 100644 --- a/0.6.x/js/01_core/15_XEventDispatcher.js +++ b/0.6.x/js/01_core/15_XEventDispatcher.js @@ -26,15 +26,10 @@ */ var X_Listeners_; -var /** @const */ - X_LISTENERS_ACTUAL_HANDLER = 0, - /** @const */ +var X_LISTENERS_ACTUAL_HANDLER = 0, X_LISTENERS_DISPATCHING = 1, - /** @const */ X_LISTENERS_RESERVES = 2, - /** @const */ X_LISTENERS_UNLISTENS = 3, - /** @const */ X_LISTENERS_KILL_RESERVED = 4; // X.Event で、イベントIDを 5 から始めているので注意。 @@ -185,7 +180,7 @@ var X_EventDispatcher = X[ 'EventDispatcher' ] = if( opt_arg1.kind ){ cbHash = opt_arg1; } else { - cbHash = X_Callback_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); + cbHash = X_Closure_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); }; if( ( unlistens = listeners[ X_LISTENERS_UNLISTENS ] ) && ( unlistens = unlistens[ opt_type ] ) ){ @@ -242,11 +237,11 @@ var X_EventDispatcher = X[ 'EventDispatcher' ] = */ function X_EventDispatcher_dispatch( e ){ var listeners = this[ '_listeners' ], - ret = X_Callback_NONE, + ret = X_CALLBACK_NONE, type = e[ 'type' ], list, unlistens, i, l, args, f, r, sysOnly, timerID, k; - if( !listeners || !( list = listeners[ type || e ] ) ) return X_Callback_NONE; + if( !listeners || !( list = listeners[ type || e ] ) ) return X_CALLBACK_NONE; // 数値, 文字が渡された場合 if( !type ){ @@ -273,9 +268,9 @@ function X_EventDispatcher_dispatch( e ){ }; if( unlistens && unlistens.indexOf( f ) !== -1 ) continue; - r = X_Callback_proxyCallback( f, args || ( args = [ e ] ) ) || 0; + r = X_Closure_proxyCallback( f, args || ( args = [ e ] ) ) || 0; - if( f.once || r & X_Callback_UN_LISTEN ){ + if( f.once || r & X_CALLBACK_UN_LISTEN ){ // dispatch 中に unlisten が作られることがある if( !unlistens ){ unlistens = listeners[ X_LISTENERS_UNLISTENS ] || ( listeners[ X_LISTENERS_UNLISTENS ] = {} ); @@ -285,7 +280,7 @@ function X_EventDispatcher_dispatch( e ){ }; ret |= X_Type_isFinite( r ) ? r : 0; - if( ( r & X_Callback_STOP_NOW ) === X_Callback_STOP_NOW ){ // iOS では ( & ) 括弧が無いと判定を誤る + if( ( r & X_CALLBACK_STOP_NOW ) === X_CALLBACK_STOP_NOW ){ // iOS では ( & ) 括弧が無いと判定を誤る sysOnly = true; break; }; @@ -400,7 +395,7 @@ function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){ add && X_EventDispatcher_actualAddEvent( this, type, raw, list ); - f = X_Callback_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); + f = X_Closure_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); list[ list.length ] = f; f.once = X_EventDispatcher_once; f.lock = X_EventDispatcher_lock; @@ -535,14 +530,14 @@ function X_EventDispatcher_actualAddEvent( that, type, raw, list ){ if( X_UA_EVENT.W3C ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : - list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Closure_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw[ 'AddEventListener' ]( type, list.slcallback ); break; case X_EventDispatcher_EVENT_TARGET_XHR : if( X_UA[ 'Opera' ] < 12 ){ // Opera11- の XHR は event オブジェクトが返らないため, eventType 毎に callback を指定する addEventListener もない - raw[ 'on' + type ] = X_Callback_create( that, X_EventDispatcher_dispatch, [ type ] ); + raw[ 'on' + type ] = X_Closure_create( that, X_EventDispatcher_dispatch, [ type ] ); break; }; @@ -556,7 +551,7 @@ function X_EventDispatcher_actualAddEvent( that, type, raw, list ){ type === 'animationiteration' || type === 'webkitAnimationIteration' ) ){ raw.addEventListener( type, X_EventDispatcher_iOSTransitionEndDispatch, false ); } else { - f = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); + f = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Closure_create( that, X_EventDispatcher_actualHandleEvent ) ); if( raw.addEventListener ){ raw.addEventListener( type, f, false ); @@ -570,18 +565,18 @@ function X_EventDispatcher_actualAddEvent( that, type, raw, list ){ if( X_UA_EVENT.IE ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : - list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Closure_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw[ 'AddEventListener' ]( type, list.slcallback ); break; case X_EventDispatcher_EVENT_TARGET_XHR : console.log( 'XHR addEvent ' + type ); // ie8- の XHR は window.event が更新されないため, eventType 毎に callback を指定する - raw[ 'on' + type ] = X_Callback_create( that, X_EventDispatcher_dispatch, [ type ] ); + raw[ 'on' + type ] = X_Closure_create( that, X_EventDispatcher_dispatch, [ type ] ); break; default : - f = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); + f = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Closure_create( that, X_EventDispatcher_actualHandleEvent ) ); if( raw.attachEvent ){ raw.attachEvent( 'on' + type, f ); @@ -594,17 +589,17 @@ function X_EventDispatcher_actualAddEvent( that, type, raw, list ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : // DOM0 で Silverlight ってあるの -> ie4 mobile? - list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Closure_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw[ 'AddEventListener' ]( type, list.slcallback ); break; case X_EventDispatcher_EVENT_TARGET_XHR : // ie4 mobile は XHR をサポート! - raw[ 'on' + type ] = X_Callback_create( that, X_EventDispatcher_dispatch, [ type ] ); + raw[ 'on' + type ] = X_Closure_create( that, X_EventDispatcher_dispatch, [ type ] ); break; default : - raw[ 'on' + type ] = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); + raw[ 'on' + type ] = that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] || ( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] = X_Closure_create( that, X_EventDispatcher_actualHandleEvent ) ); break; }; } @@ -614,7 +609,7 @@ function X_EventDispatcher_actualAddEvent( that, type, raw, list ){ /* * iOS の webkitTransitionEnd が連続して起こる場合、 - * コールバックの(that[ X_LISTENERS_ACTUAL_HANDLER ])クロージャ内の実際のコールバック(X_Callback_actualClosure:obj._)が + * コールバックの(that[ X_LISTENERS_ACTUAL_HANDLER ])クロージャ内の実際のコールバック(X_Closure_actualClosure:obj._)が * 参照できていない問題に遭遇、、、iOS3.1.3 & iOS6.1.5 で確認 * animation も怪しい、、、 */ @@ -643,7 +638,7 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : raw[ 'RemoveEventListener' ]( type, list.sltoken ); // token - X_Callback_correct( list.slcallback ); + X_Closure_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; break; @@ -651,7 +646,7 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ case X_EventDispatcher_EVENT_TARGET_XHR : if( X_UA[ 'Opera' ] < 12 ){ // Opera11- の XHR は event オブジェクトが返らないため, eventType 毎に callback を指定する addEventListener もない - X_Callback_correct( raw[ 'on' + type ] ); + X_Closure_correct( raw[ 'on' + type ] ); raw[ 'on' + type ] = ''; break; }; @@ -671,7 +666,7 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ }; if( !skip && that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ){ - X_Callback_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); + X_Closure_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); delete that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ]; }; }; @@ -680,13 +675,13 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : raw[ 'RemoveEventListener' ]( type, list.sltoken ); // token - X_Callback_correct( list.slcallback ); + X_Closure_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; break; case X_EventDispatcher_EVENT_TARGET_XHR : - X_Callback_correct( raw[ 'on' + type ] ); + X_Closure_correct( raw[ 'on' + type ] ); raw[ 'on' + type ] = X_emptyFunction; raw[ 'on' + type ] = ''; console.log( 'XHR rmEvent ' + type ); @@ -702,7 +697,7 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ }; if( !skip ){ - X_Callback_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); + X_Closure_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); delete that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ]; }; }; @@ -710,13 +705,13 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ switch( that[ '_rawType' ] ){ case X_EventDispatcher_EVENT_TARGET_SILVER_LIGHT : raw[ 'RemoveEventListener' ]( type, list.sltoken ); // token - X_Callback_correct( list.slcallback ); + X_Closure_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; break; case X_EventDispatcher_EVENT_TARGET_XHR : - X_Callback_correct( raw[ 'on' + type ] ); + X_Closure_correct( raw[ 'on' + type ] ); raw[ 'on' + type ] = X_emptyFunction; raw[ 'on' + type ] = ''; break; @@ -726,7 +721,7 @@ function X_EventDispatcher_actualRemoveEvent( that, type, raw, list, skip ){ raw[ 'on' + type ] = ''; if( !skip ){ - X_Callback_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); + X_Closure_correct( that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ] ); delete that[ '_listeners' ][ X_LISTENERS_ACTUAL_HANDLER ]; }; }; @@ -747,10 +742,10 @@ var X_EventDispatcher_actualHandleEvent = ret = this[ 'dispatch' ]( new X_DomEvent( e, this, this[ '_rawObject' ] ) ); - if( ret & X_Callback_STOP_PROPAGATION ){ + if( ret & X_CALLBACK_STOP_PROPAGATION ){ e.cancelBubble = true; }; - if( ret & X_Callback_PREVENT_DEFAULT ){ + if( ret & X_CALLBACK_PREVENT_DEFAULT ){ this[ '_tag' ] === 'A' && this[ '_rawObject' ].blur(); return e.returnValue = false; }; @@ -758,14 +753,14 @@ var X_EventDispatcher_actualHandleEvent = //X_UA_EVENT.W3C || X_UA_EVENT.DOM0 (function( e ){ var ev = new X_DomEvent( e, this ), - ret = X_Callback_NONE, + ret = X_CALLBACK_NONE, i, l; //console.log( '>>>>>>>>>> ' + e.type ); // touch event -> pointer if( X_Type_isArray( ev ) ){ if( ev.length === 0 ){ // TouchEvent の後に発生した MouseEvent のキャンセル - ret = X_Callback_STOP_PROPAGATION | X_Callback_PREVENT_DEFAULT; + ret = X_CALLBACK_STOP_PROPAGATION | X_CALLBACK_PREVENT_DEFAULT; } else { for( i = 0, l = ev.length; i < l; ++i ){ //console.log( 'handleEvent ' + ev[ i ].type ); @@ -776,10 +771,10 @@ var X_EventDispatcher_actualHandleEvent = ret = this[ 'dispatch' ]( ev ); }; - if( ret & X_Callback_STOP_PROPAGATION ){ + if( ret & X_CALLBACK_STOP_PROPAGATION ){ e.stopPropagation(); }; - if( ret & X_Callback_PREVENT_DEFAULT ){ + if( ret & X_CALLBACK_PREVENT_DEFAULT ){ this[ '_tag' ] === 'A' && this[ '_rawObject' ].blur(); e.preventDefault(); if( X_UA[ 'WebKit' ] < 525.13 ){ // Safari3- diff --git a/0.6.x/js/01_core/16_XTimer.js b/0.6.x/js/01_core/16_XTimer.js index de15c13..4df6372 100644 --- a/0.6.x/js/01_core/16_XTimer.js +++ b/0.6.x/js/01_core/16_XTimer.js @@ -95,7 +95,7 @@ var var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X_Timer_REQ_ANIME_FRAME( X_Timer_onEnterFrame ) ); - f = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + f = X_Closure_classifyCallbackArgs( args1, args2, args3 ); if( !f.kind ) f = { func : f }; X_Timer_REQ_FRAME_LIST[ i ] = f; return f.uid = ++X_Timer_uid; @@ -104,7 +104,7 @@ var var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X_Timer_add( 0, 1, X_Timer_onEnterFrame ) ); - f = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + f = X_Closure_classifyCallbackArgs( args1, args2, args3 ); if( !f.kind ) f = { func : f }; X_Timer_REQ_FRAME_LIST[ i ] = f; return f.uid = ++X_Timer_uid; @@ -224,7 +224,7 @@ X[ 'Timer' ] = { opt_count = 0; }; - hash = X_Callback_classifyCallbackArgs( args1, args2, args3 ); + hash = X_Closure_classifyCallbackArgs( args1, args2, args3 ); if( !hash ) return -1; // dev only if( !hash.kind ) hash = { func : hash }; @@ -325,7 +325,7 @@ function X_Timer_onTimeout(){ X_Timer_currentUID = q.uid; if( q.kind ){ - r = X_Callback_proxyCallback( q, [] ); + r = X_Closure_proxyCallback( q, [] ); } else { r = q.func(); }; @@ -338,7 +338,7 @@ function X_Timer_onTimeout(){ heavy = true; }; - if( r & X_Callback_UN_LISTEN || c === 1 ){ + if( r & X_CALLBACK_UN_LISTEN || c === 1 ){ list.splice( i, 1 ); --i; --l; @@ -427,7 +427,7 @@ function X_Timer_onEnterFrame( time ){ if( X_Timer_removal && X_Timer_removal[ q.uid ] ) continue; if( q.kind ){ - X_Callback_proxyCallback( q, args || ( args = [ time ] ) ); + X_Closure_proxyCallback( q, args || ( args = [ time ] ) ); } else { q.func( time ); }; diff --git a/0.6.x/js/01_core/20_XSystem.js b/0.6.x/js/01_core/20_XSystem.js index 3b0e9df..3289140 100644 --- a/0.6.x/js/01_core/20_XSystem.js +++ b/0.6.x/js/01_core/20_XSystem.js @@ -41,7 +41,7 @@ var }; console.log( e.origin + ' ' + X.URL.BASE_URL ); - return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION; + return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; }; } } diff --git a/0.6.x/js/01_core/21_XViewPort.js b/0.6.x/js/01_core/21_XViewPort.js index 2fe61fa..b4f53b8 100644 --- a/0.6.x/js/01_core/21_XViewPort.js +++ b/0.6.x/js/01_core/21_XViewPort.js @@ -41,7 +41,7 @@ X_ViewPort = X_Class_override( case 'beforeunload' : // ie では a href='javascript' な要素でも beforeunload が起こる href = e.target && e.target[ 'attr' ] && e.target[ 'attr' ]( 'href' ); - if( href && href.indexOf && href.indexOf( 'javascript:' ) === 0 ) return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION; + if( href && href.indexOf && href.indexOf( 'javascript:' ) === 0 ) return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; return X_ViewPort[ 'dispatch' ]( X_EVENT_BEFORE_UNLOAD ); @@ -101,7 +101,10 @@ function X_ViewPort_changeFocus(){ * @alias X.ViewPort */ X[ 'ViewPort' ] = { - + /** + * + * @alias X.ViewPort.listen + */ 'listen' : function( type, arg1, arg2, arg3 ){ if( type <= X_ViewPort_readyState ){ /* @@ -114,7 +117,10 @@ X[ 'ViewPort' ] = { return X[ 'ViewPort' ]; }, - + /** + * + * @alias X.ViewPort.listenOnce + */ 'listenOnce' : function( type, arg1, arg2, arg3 ){ if( type <= X_ViewPort_readyState ){ /* @@ -126,16 +132,27 @@ X[ 'ViewPort' ] = { return X[ 'ViewPort' ]; }, + /** + * + * @alias X.ViewPort.unlisten + */ 'unlisten' : function( type, arg1, arg2, arg3 ){ type && arg1 && X_ViewPort[ 'unlisten' ]( type, arg1, arg2, arg3 ); return X[ 'ViewPort' ]; }, + /** + * + * @alias X.ViewPort.listening + */ 'listening' : function( type, arg1, arg2, arg3 ){ return X_ViewPort[ 'listening' ]( type, arg1, arg2, arg3 ); }, - - // hammer のテストファイルだけが使用 + + /** + * hammer のテストファイルだけが使用 + * @alias X.ViewPort.asyncDispatch + */ 'asyncDispatch' : function(){ return X_ViewPort[ 'asyncDispatch' ].apply( X_ViewPort, arguments ); }, @@ -151,6 +168,10 @@ X[ 'ViewPort' ] = { }, + /** + * + * @alias X.ViewPort.getSize + */ 'getSize' : function(){ return [ X_ViewPort_width, X_ViewPort_height ]; }, @@ -159,6 +180,10 @@ X[ 'ViewPort' ] = { //(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollLeft == 'number' ? t : document.body).ScrollLeft; //(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop + /** + * + * @alias X.ViewPort.getDocumentSize + */ 'getDocumentSize' : function(){ // Opera は互換モードでは document.body.scrollHeight、標準モードでは document.documentElement.scrollHeight でページの高さが取れる。と思ってたんだけど、例外があった。 // http://orera.g.hatena.ne.jp/edvakf/20100515/1273908051 @@ -177,6 +202,10 @@ X[ 'ViewPort' ] = { ]; }, + /** + * + * @alias X.ViewPort.getScrollPosition + */ 'getScrollPosition' : window.pageXOffset !== undefined ? ( function(){ @@ -194,10 +223,18 @@ X[ 'ViewPort' ] = { return[ X_ViewPort_scrollX = X_ViewPort_rootElement.scrollLeft || document.body.scrollLeft, X_ViewPort_scrollY = X_ViewPort_rootElement.scrollTop || document.body.scrollTop ]; } ), + /** + * + * @alias X.ViewPort.getScrollbarSize + */ 'getScrollbarSize' : function(){ return [ X_ViewPort_vScrollbarSize, X_ViewPort_hScrollbarSize ]; }, + /** + * + * @alias X.ViewPort.getBaseFontSize + */ 'getBaseFontSize' : function(){ if( X_Node_updateTimerID ){ X_Node_startUpdate(); @@ -261,7 +298,7 @@ X[ 'ViewPort' ] = { console.log( '-- resize : ' + X_Timer_now() ); !X_ViewPort_lock && ( X_ViewPort_lock = true ) && X_Timer_once( 100, X_ViewPort_detectFinishResizing ); - return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION; + return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; }); function X_ViewPort_detectFinishResizing(){ @@ -287,7 +324,7 @@ X[ 'ViewPort' ] = { console.log( '> X_TEMP.onDomContentLoaded rs:' + X_ViewPort_readyState ); - if( X_EVENT_PRE_INIT <= X_ViewPort_readyState ) return X_Callback_UN_LISTEN; + if( X_EVENT_PRE_INIT <= X_ViewPort_readyState ) return X_CALLBACK_UN_LISTEN; X_ViewPort_readyState = X_EVENT_PRE_INIT; // DOMContentLoaded の無いブラウザで X_TEMP.onDomContentLoaded への参照が残り続けるのを回避 @@ -430,7 +467,7 @@ X[ 'ViewPort' ] = { X_EventDispatcher_systemListen( X_ViewPort, [ 'focus', 'blur' ] ); }; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; function X_ViewPort_getWindowSize(){ @@ -481,7 +518,7 @@ if( 6 <= X_UA[ 'IE' ] && X[ 'inHead' ] ){ // http://lists.apple.com/archives/web-dev/2003/Oct/msg00036.html if( X_UA[ 'WebKit' ] || X_UA[ 'Safari' ] < 3 ){ // sniff X_Timer_add( 16, function(){ - if( !X_TEMP.onDomContentLoaded ) return X_Callback_UN_LISTEN; + if( !X_TEMP.onDomContentLoaded ) return X_CALLBACK_UN_LISTEN; if( document.readyState === 'loaded' || document.readyState === 'complete' ) return X_TEMP.onDomContentLoaded(); }); }; diff --git a/0.6.x/js/02_dom/07_XNodeList.js b/0.6.x/js/02_dom/07_XNodeList.js index 443677c..be45a3b 100644 --- a/0.6.x/js/02_dom/07_XNodeList.js +++ b/0.6.x/js/02_dom/07_XNodeList.js @@ -23,7 +23,7 @@ function X_NodeList( v ){ }; if( !skip ){ this[ n ] = xnode; - n = ++this.length; + n = ++this.length; }; }; }; diff --git a/0.6.x/js/02_dom/10_XNodeAnime.js b/0.6.x/js/02_dom/10_XNodeAnime.js index 04709bf..003b89c 100644 --- a/0.6.x/js/02_dom/10_XNodeAnime.js +++ b/0.6.x/js/02_dom/10_XNodeAnime.js @@ -446,7 +446,7 @@ function X_Node_Anime_onTransitionEnd( e ){ if( !this[ '_anime' ] || this[ '_anime' ].phase !== 2 ){ // ここで return してしまうと、view の更新イベント待ちの場合、アニメが止まる X_Node_Anime_reserved && !X_Node_Anime_updateTimerID && !X_Node_updateTimerID && X_Node_Anime_reserveUpdate( X_Node_Anime_reserved = false ); - return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION; + return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; }; this[ '_anime' ].phase = 3; @@ -462,7 +462,7 @@ function X_Node_Anime_onTransitionEnd( e ){ // win+Gecko は不可 X_Node_Anime_updateAnimations( 0, X_Node_updateOnTransitionEnd ); - return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION; + return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; }; function X_Node_Anime_releaseGPULayer(){ diff --git a/0.6.x/js/05_util/00_XUtil.js b/0.6.x/js/05_util/00_XUtil.js index 7a70e86..68c1a20 100644 --- a/0.6.x/js/05_util/00_XUtil.js +++ b/0.6.x/js/05_util/00_XUtil.js @@ -1 +1,5 @@ +/** + * ユーティリティ関数とユーティリティクラス + * @namespace X.Util + */ X[ 'Util' ] = {}; diff --git a/0.6.x/js/05_util/01_XNinjaIframe.js b/0.6.x/js/05_util/01_XNinjaIframe.js index 08f7d21..9964d58 100644 --- a/0.6.x/js/05_util/01_XNinjaIframe.js +++ b/0.6.x/js/05_util/01_XNinjaIframe.js @@ -1,13 +1,17 @@ -/* +/** * http://msdn.microsoft.com/ja-jp/library/ie/hh180174%28v=vs.85%29.aspx * 孤立するとウィンドウ オブジェクトのプロパティが消去される * * http://qiita.com/sou/items/3380d4fa9b08b27bb387 * モバイルブラウザでの iframe の挙動(Mobile Safari, Chrome for Android) + * + * @alias X.Util.NinjaIframe + * @class 隠し iframe 機能を提供します。 + * @constructor + * @constructs NinjaIframe + * @extends {Node} */ - -// TODO Node.inherits -X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( +var X_NinjaIframe = X[ 'Util' ][ 'NinjaIframe' ] = Node[ 'inherits' ]( 'NinjaIframe', { autoRefresh : 0, @@ -132,7 +136,7 @@ function X_Util_NinjaIframe_handleEvent( e ){ break; }; - return X_Callback_STOP_PROPAGATION; + return X_CALLBACK_STOP_PROPAGATION; }; function X_Util_NinjaIframe_writeToIframe( that ){ diff --git a/0.6.x/js/05_util/02_XJSON.js b/0.6.x/js/05_util/02_XJSON.js index 2046288..a99aa0e 100644 --- a/0.6.x/js/05_util/02_XJSON.js +++ b/0.6.x/js/05_util/02_XJSON.js @@ -1,5 +1,7 @@ - - +/** + * ユーティリティ関数とユーティリティクラス + * @namespace X.JSON + */ var X_JSON = X[ 'JSON' ] = // TODO ie8 は子フレームには JSON がいない…アクセス可能な親を探索 @@ -18,14 +20,18 @@ X_UA[ 'IE8' ] ? { 'parse' : JSON.parse } : -window.JSON || { +window.JSON || +{ 'stringify' : X_JSON_stringify, - 'parse' : X_String_parseTrustedJsonString + 'parse' : X_JSON_parseTrustableString }; - +/** + * + * @alias X.JSON.stringify + */ function X_JSON_stringify( obj ){ var json = '', k, v; for( k in obj ){ @@ -36,4 +42,14 @@ function X_JSON_stringify( obj ){ }; //console.log( json ); return '{' + json + '}'; -}; \ No newline at end of file +}; + +/** + *

JSON を持たないブラウザでは、eval を使用します。よって、信頼できる文字列だけに対してパースを行います。 + *

url パラメータや window.name に対して使用する際は最新の注意を払います。 + * @alias X.JSON.parse + */ +function X_JSON_parseTrustableString( jsonString ){ + return window.JSON ? JSON.parse( jsonString ) : eval( '(' + jsonString + ')' ); +}; + diff --git a/0.6.x/js/05_util/03_XUtilImage.js b/0.6.x/js/05_util/03_XUtilImage.js index 958a0e7..3047cae 100644 --- a/0.6.x/js/05_util/03_XUtilImage.js +++ b/0.6.x/js/05_util/03_XUtilImage.js @@ -1,6 +1,10 @@ var X_Util_Image_actualSize = {}; +/** + * ユーティリティ関数とユーティリティクラス + * @namespace X.Util.Image + */ X[ 'Util' ][ 'Image' ] = { 'getActualDimension' : X_Util_Image_getActualDimension @@ -11,10 +15,14 @@ X[ 'Util' ][ 'Image' ] = { * Opacity不可 NetFront3.4 */ -/* - * original - * LICENSE: MIT - * AUTHOR: uupaa.js@gmail.com +/** + *

画像の実際のサイズを返します。 + *

original + *

LICENSE: MIT + *

AUTHOR: uupaa.js@gmail.com + * @alias X.Util.Image.getActualDimension + * @param {Node|ImageElement|string} + * @return {array.} */ function X_Util_Image_getActualDimension( XnodeOrImageElemOrSrc ){ var xnode, img, remove, ret, run, memW, memH, w, h; diff --git a/0.6.x/js/05_util/04_XXML.js b/0.6.x/js/05_util/04_XXML.js index 18a71f2..6ef1908 100644 --- a/0.6.x/js/05_util/04_XXML.js +++ b/0.6.x/js/05_util/04_XXML.js @@ -10,6 +10,13 @@ X[ 'XML' ] = XMLWrapper; +/** + * XML 探索用のラッパークラスです + * @alias X.XML + * @class XML 探索用のラッパークラスです + * @constructor + * @param {xml} + */ function XMLWrapper( xml ){ this._rawXML = xml; }; @@ -36,7 +43,7 @@ function XMLWrapper_get( index ){ }; function XMLWrapper_val( queryString, type ){ - var attr_textContent = X.UA.IE < 9 || X.UA.Opera ? 'innerText' : X.UA.IE9 ? 'text' : 'textContent', + var attr_textContent = X_UA[ 'IE' ] < 9 || X_UA[ 'Opera' ] ? 'innerText' : X_UA[ 'IE9' ] ? 'text' : 'textContent', wrapper, xml, v; switch( queryString ){ diff --git a/0.6.x/js/06_net/00_XNet.js b/0.6.x/js/06_net/00_XNet.js index 2dc4432..d69d68a 100644 --- a/0.6.x/js/06_net/00_XNet.js +++ b/0.6.x/js/06_net/00_XNet.js @@ -328,7 +328,7 @@ function X_NET_shiftQueue(){ case 0 : case 1 : case 2 : - if( !( auth[ 'dispatch' ]( X_EVENT_NEED_AUTH ) & X_Callback_PREVENT_DEFAULT ) ){ + if( !( auth[ 'dispatch' ]( X_EVENT_NEED_AUTH ) & X_CALLBACK_PREVENT_DEFAULT ) ){ authSettings.lazyRequests = authSettings.lazyRequests || []; authSettings.lazyRequests.indexOf( X_NET_currentQueue ) === -1 && authSettings.lazyRequests.push( X_NET_currentQueue ); }; diff --git a/0.6.x/js/06_net/01_XNetXHR.js b/0.6.x/js/06_net/01_XNetXHR.js index f5db50f..0531a29 100644 --- a/0.6.x/js/06_net/01_XNetXHR.js +++ b/0.6.x/js/06_net/01_XNetXHR.js @@ -31,6 +31,7 @@ http://d.hatena.ne.jp/sshi/20060904/p1 itozyun 2014-10-30 20:55:41 basic 認証のかかったhtml を表示して、そのjsが xhr をすると Android1.6 では 401 error が返る。Android 2.3 では解決している。 Android1.6- の XHR で 401 エラーが返った場合は、iframe に xml を表示させてその内容を取ればサーバ側の対応無しでいけるかも? +Android2 にも xdomain な GET が一回しかできない問題 gears 使えない? IE9 で 画像バイナリの取得 VBA をかましている http://web.archive.org/web/20130808105151/http://gurimmer.lolipop.jp/daihakken/2012/05/22/javascriptajaxxmlhttprequest%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9Fajax%E3%81%AE%E3%82%A8%E3%83%B3%E3%82%B3%E3%83%BC%E3%83%89 @@ -255,7 +256,8 @@ 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'; - } */ + } */ + // http://nakigao.sitemix.jp/blog/?p=2040 // json 取得時に SafariでHTTP/412のエラー。但し相手が audio の場合この指定があるとロードに失敗する。 iOS8.2, iOS7.1 では遭遇せず if( this._dataType === 'json' ){ @@ -454,7 +456,7 @@ X_TEMP.X_Net_XHR_params = { // eval() を使っているけど JSON の無いブラウザは XDomain な XHR はできないのでよしとする。 // XDomain な XHR の際は Flash 等で代替し、その中に Json parser も組み込む。 // http://d.hatena.ne.jp/sshi/20060904/p1 - if( !X_Type_isObject( data ) ) data = X_String_parseTrustedJsonString( data ); + if( !X_Type_isObject( data ) ) data = X_JSON_parseTrustableString( data ); break; case 'document' : case 'xml' : diff --git a/0.6.x/js/06_net/02_XNetJSONP.js b/0.6.x/js/06_net/02_XNetJSONP.js index 3fbcf77..efff27d 100644 --- a/0.6.x/js/06_net/02_XNetJSONP.js +++ b/0.6.x/js/06_net/02_XNetJSONP.js @@ -5,8 +5,7 @@ * http://developer.cybozu.co.jp/takesako/2007/06/opera_img-jsonp.html * * iframe を使った jsonp の読み込みエラー判定の記事、 - * JSONPのエラーを判断する は web archive でも観れない - * http://d.hatena.ne.jp/yuushimizu/20090128/1233146321 + * https://web.archive.org/web/20120917100043/http://d.hatena.ne.jp/yuushimizu/20090128/1233146321 * TODO JSONPの動的取得+エラー処理 * http://d.hatena.ne.jp/NeoCat/20110206/1296934235 * @@ -25,8 +24,7 @@ // TODO iframe useful or not. TODO check dynamicIframe // TODO file: では http: は使えない -X[ 'Net' ][ 'JSONP' ] = { - 'cb' : function( accessKey, jsonString, time, opt_json2FileSize ){ +X_TEMP.X_NET_JSONP_cb = function( accessKey, jsonString, time, opt_json2FileSize ){ if( accessKey !== X_NET_JSONP_ACCESS_KEY || !X_NET_JSONPWrapper._busy ) return; X_NET_JSONPWrapper._busy = false; @@ -34,14 +32,13 @@ X[ 'Net' ][ 'JSONP' ] = { X_NET_JSONPWrapper [ 'asyncDispatch' ]( { type : jsonString ? X_EVENT_SUCCESS : X_EVENT_ERROR, - response : X_String_parseTrustedJsonString( jsonString ) + response : X_JSON_parseTrustableString( jsonString ) } ); X_Net_JSONP_errorTimerID && X_Timer_remove( X_Net_JSONP_errorTimerID ); console.log( 'ms : ' + time + ' speed : ' + ( ( jsonString.length + ( opt_json2FileSize || 0 ) ) / time * 1000 ) + ' バイト/秒.' ); - } -}; + }; var X_NET_JSONP_ACCESS_KEY = Math.random(), @@ -52,8 +49,11 @@ var X_NET_JSONP_ACCESS_KEY = Math.random(), X_Net_JSONP_errorTimerID; X_TEMP.X_NET_JSONP_init = function(){ - X_NET_JSONPWrapper = X_Class_override( X[ 'Util' ][ 'NinjaIframe' ](), X_TEMP.X_NET_JSONP_params ); + X[ 'Net' ][ '__json_cb__' ] = X_TEMP.X_NET_JSONP_cb; + + X_NET_JSONPWrapper = X_Class_override( X_NinjaIframe(), X_TEMP.X_NET_JSONP_params ); + delete X_TEMP.X_NET_JSONP_cb; delete X_TEMP.X_NET_JSONP_init; delete X_TEMP.X_NET_JSONP_params; @@ -77,7 +77,7 @@ X_TEMP.X_NET_JSONP_params = { url = X_URL_create( url, params ); - if( !callback && !( callback = X_URL_ParamToObj( url.split( '?' )[ 1 ] )[ 'callback' ] ) ){ + if( !callback && !( callback = X_URL_paramToObj( url.split( '?' )[ 1 ] )[ 'callback' ] ) ){ url += '&callback=cb'; callback = 'cb'; }; @@ -95,7 +95,7 @@ X_TEMP.X_NET_JSONP_params = { '', '', '' @@ -108,7 +108,7 @@ X_TEMP.X_NET_JSONP_params = { '', '' */ ]; @@ -127,7 +127,7 @@ X_TEMP.X_NET_JSONP_params = { '', '' @@ -138,7 +138,7 @@ X_TEMP.X_NET_JSONP_params = { html = [ '', '' @@ -151,7 +151,7 @@ X_TEMP.X_NET_JSONP_params = { '', '', '', '', @@ -219,5 +219,5 @@ function X_NET_JSONP_iframeListener( e ){ X_NET_JSONPWrapper[ 'asyncDispatch' ]( X_EVENT_ERROR ); break; }; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; diff --git a/0.6.x/js/06_net/03_XNetForm.js b/0.6.x/js/06_net/03_XNetForm.js index 71f65cc..ce5021a 100644 --- a/0.6.x/js/06_net/03_XNetForm.js +++ b/0.6.x/js/06_net/03_XNetForm.js @@ -1,13 +1,9 @@ //{+netform"

によるGETとPOST"(動的に生成したフォームによるGETとPOST。)[+net,+ninjaiframe] -X[ 'Net' ][ 'Form' ] = { - // 隠し iframe 使用の可否 -}; - var X_NET_Form_errorTimerID, X_Net_Form_onloadCount = 0; X_TEMP.X_NET_Form_init = function(){ - X_NET_FormWrapper = X_Class_override( X[ 'Util' ][ 'NinjaIframe' ](), X_TEMP.X_NET_Form_params ); + X_NET_FormWrapper = X_Class_override( X_NinjaIframe(), X_TEMP.X_NET_Form_params ); delete X_TEMP.X_NET_Form_init; delete X_TEMP.X_NET_Form_params; @@ -100,7 +96,7 @@ function X_NET_Form_iframeListener( e ){ X_NET_FormWrapper[ 'asyncDispatch' ]( X_EVENT_ERROR ); break; }; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; //}+netform \ No newline at end of file diff --git a/0.6.x/js/06_net/05_XXHRGadget.js b/0.6.x/js/06_net/05_XXHRGadget.js index 7a9d4d2..16d83be 100644 --- a/0.6.x/js/06_net/05_XXHRGadget.js +++ b/0.6.x/js/06_net/05_XXHRGadget.js @@ -89,12 +89,12 @@ function X_NET_GIMR_detectImageOverIframe(){ iwin.location.href = X_NET_GIMR_GADGET_URL + '#_recived_' + X_NET_GIMR_isReceiveBatches; // speedup X_NET_GIMR_timerID = X_Timer_add( 16, 0, this, X_NET_GIMR_detectImageOverIframe ); - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; } else { X_NET_GIMR_receivedString = X_Net_GIMR_decodeLocationHash( ret ); }; - X_NET_GIMRWrapper[ 'asyncDispatch' ]( X_String_parseTrustedJsonString( X_NET_GIMR_receivedString ) ); + X_NET_GIMRWrapper[ 'asyncDispatch' ]( X_JSON_parseTrustableString( X_NET_GIMR_receivedString ) ); X_NET_GIMR_receivedString = ''; //console.dir( e ); @@ -104,7 +104,7 @@ function X_NET_GIMR_detectImageOverIframe(){ X_NET_GIMR_lastHashString = ''; iwin.location.href = X_NET_GIMR_GADGET_URL + '#_recived_'; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; ++X_NET_GIMR_phase; }; diff --git a/0.6.x/js/06_net/10_XOAuth2.js b/0.6.x/js/06_net/10_XOAuth2.js index 91f7f67..86d1584 100644 --- a/0.6.x/js/06_net/10_XOAuth2.js +++ b/0.6.x/js/06_net/10_XOAuth2.js @@ -238,7 +238,7 @@ function X_Net_OAuth2_detectAuthPopup(){ } else if( search = X_NET_OAUTH2_detection( X_NET_OAUTH2_authorizationWindow ) ){ pair = X_Pair_get( this ); - pair.code = X_URL_ParamToObj( search.slice( 1 ) )[ 'code' ]; + pair.code = X_URL_paramToObj( search.slice( 1 ) )[ 'code' ]; if( 9 < X_UA[ 'IEHost' ] ){ X_NET_OAUTH2_authorizationWindow.close(); @@ -257,7 +257,7 @@ function X_Net_OAuth2_detectAuthPopup(){ X_NET_OAUTH2_authorizationWindow = null; X_NET_OAUTH2_authorizationTimerID = 0; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; }; diff --git a/0.6.x/js/07_audio/01_XWebAudio.js b/0.6.x/js/07_audio/01_XWebAudio.js index db538e4..e8fd81b 100644 --- a/0.6.x/js/07_audio/01_XWebAudio.js +++ b/0.6.x/js/07_audio/01_XWebAudio.js @@ -53,8 +53,8 @@ if( X_Audio_WebAudio_context ){ } else if( X_Audio_WebAudio_context.decodeAudioData ){ X_Audio_WebAudio_context.decodeAudioData( e.response, - this.onDecodeSuccess = X_Callback_create( this, this._onDecodeSuccess ), - this.onDecodeError = X_Callback_create( this, this._onDecodeError ) ); + this.onDecodeSuccess = X_Closure_create( this, this._onDecodeSuccess ), + this.onDecodeError = X_Closure_create( this, this._onDecodeError ) ); } else { this._onDecodeSuccess( X_Audio_WebAudio_context.createBuffer( e.response, false ) ); }; @@ -95,9 +95,9 @@ if( X_Audio_WebAudio_context ){ }, _onDecodeComplete : function(){ - X_Callback_correct( this.onDecodeSuccess ); + X_Closure_correct( this.onDecodeSuccess ); delete this.onDecodeSuccess; - X_Callback_correct( this.onDecodeError ); + X_Closure_correct( this.onDecodeError ); delete this.onDecodeError; }, @@ -174,7 +174,7 @@ if( X_Audio_WebAudio_context ){ this.playing && this.actualPause(); this.source && this._sourceDispose(); - this._onended && X_Callback_correct( this._onended ); + this._onended && X_Closure_correct( this._onended ); this.gainNode && this.gainNode.disconnect(); }, @@ -235,7 +235,7 @@ if( X_Audio_WebAudio_context ){ // 破棄された X.Callback が呼ばれて、obj.proxy() でエラーになる。Firefox では、onended は使わない if( false && this.source.onended !== undefined ){ //console.log( '> use onended' ); - this.source.onended = this._onended || ( this._onended = X_Callback_create( this, this._onEnded ) ); + this.source.onended = this._onended || ( this._onended = X_Closure_create( this, this._onEnded ) ); } else { this._timerID && X_Timer_remove( this._timerID ); this._timerID = X_Timer_once( end - begin, this, this._onEnded ); @@ -263,7 +263,7 @@ if( X_Audio_WebAudio_context ){ _onInterval : function(){ if( !this.playing ){ delete this._interval; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; this.target[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING ); }, @@ -288,7 +288,7 @@ if( X_Audio_WebAudio_context ){ }; if( this.autoLoop ){ - if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_Callback_PREVENT_DEFAULT ) ){ + if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ this.looped = true; this.target[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); this.actualPlay(); diff --git a/0.6.x/js/07_audio/02_XHTMLAudio.js b/0.6.x/js/07_audio/02_XHTMLAudio.js index b15b064..7206221 100644 --- a/0.6.x/js/07_audio/02_XHTMLAudio.js +++ b/0.6.x/js/07_audio/02_XHTMLAudio.js @@ -229,7 +229,7 @@ if( X_Audio_constructor && !X_Audio_HTMLAudioWrapper_badOperaAndroid ){ case 'ended' : if( !this._closed && this.autoLoop ){ - if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_Callback_PREVENT_DEFAULT ) ){ + if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ this.looped = true; this.target[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); this.actualPlay(); @@ -271,7 +271,7 @@ if( X_Audio_constructor && !X_Audio_HTMLAudioWrapper_badOperaAndroid ){ console.log( end + ' / ' + now ); if( 0 + end <= 0 + now ){ // なぜか iem9 で必要,,, if( this.autoLoop ){ - if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_Callback_PREVENT_DEFAULT ) ){ + if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ this.looped = true; this.target[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); this.actualPlay(); diff --git a/0.6.x/js/07_audio/03_XSilverlightAudio.js b/0.6.x/js/07_audio/03_XSilverlightAudio.js index 501326d..c716a9a 100644 --- a/0.6.x/js/07_audio/03_XSilverlightAudio.js +++ b/0.6.x/js/07_audio/03_XSilverlightAudio.js @@ -59,7 +59,7 @@ if( X[ 'Pulgin' ][ 'SilverlightEnabled' ] ){ this._source = source; // X.Audio._slOnload_ は不可 this._onload = 'XAudioSilverlightOnLoad' + ( ++X_Audio_SLAudio_uid ); - this._callback = window[ this._onload ] = X_Callback_create( this, this.onSLReady ); + this._callback = window[ this._onload ] = X_Closure_create( this, this.onSLReady ); this.xnodeObject = X_Node_body [ 'create' ]( 'object', { type : 'application/x-silverlight-2', @@ -86,7 +86,7 @@ if( X[ 'Pulgin' ][ 'SilverlightEnabled' ] ){ window[ this._onload ] = null; delete this._onload; - X_Callback_correct( this._callback ); + X_Closure_correct( this._callback ); delete this._callback; sender[ 'children' ][ 'add' ]( @@ -232,7 +232,7 @@ if( X[ 'Pulgin' ][ 'SilverlightEnabled' ] ){ // window への delete に ie5 は対応しないが、そもそも ie5 は Silverlight に非対応 window[ this._onload ] = null; delete this._onload; - X_Callback_correct( this._callback ); + X_Closure_correct( this._callback ); }; this.xnodeObject[ 'kill' ](); break; @@ -290,7 +290,7 @@ if( X[ 'Pulgin' ][ 'SilverlightEnabled' ] ){ _onInterval : function(){ if( !this.playing ){ delete this._interval; - return X_Callback_UN_LISTEN; + return X_CALLBACK_UN_LISTEN; }; this.target[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING ); }, @@ -326,7 +326,7 @@ if( X[ 'Pulgin' ][ 'SilverlightEnabled' ] ){ if( this.autoLoop ){ console.log( '========= loop?' ); - if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_Callback_PREVENT_DEFAULT ) ){ + if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ console.log( '========== loopした' ); this.looped = true; this.target[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); diff --git a/0.6.x/js/07_audio/10_XAudioSprite.js b/0.6.x/js/07_audio/10_XAudioSprite.js index 542eea1..8c86151 100644 --- a/0.6.x/js/07_audio/10_XAudioSprite.js +++ b/0.6.x/js/07_audio/10_XAudioSprite.js @@ -47,9 +47,7 @@ X[ 'AudioSprite' ] = function( setting ){ }, k, i, v, track; - if( X_Audio_Sprite_instance ){ - X_Audio_Sprite_instance[ 'kill' ](); - } else { + if( !X_Audio_Sprite_instance ){ X_Audio_Sprite_instance = X_Class_override( X_EventDispatcher(), X_Audio_Sprite_members ); X_ViewPort[ 'listen' ]( [ X_EVENT_VIEW_ACTIVATE, X_EVENT_VIEW_DEACTIVATE ], X_Audio_Sprite_instance, X_Audio_Sprite_handleEvent ); }; @@ -338,12 +336,12 @@ function X_AudioSprite_backendHandler( e ){ }; }; - return X_Callback_STOP_NOW; + return X_CALLBACK_STOP_NOW; case X_EVENT_BACKEND_NONE : this[ 'unlisten' ]( X_EVENT_BACKEND_READY, this, X_AudioSprite_backendHandler ) [ 'asyncDispatch' ]( X_EVENT_BACKEND_NONE ); - return X_Callback_STOP_NOW; + return X_CALLBACK_STOP_NOW; case X_EVENT_READY : console.log( 'X.AudioSprite - Ready!' ); diff --git a/0.6.x/js/20_ui/05_XUI_Gesture.js b/0.6.x/js/20_ui/05_XUI_Gesture.js index 37d0af2..ed6bfec 100644 --- a/0.6.x/js/20_ui/05_XUI_Gesture.js +++ b/0.6.x/js/20_ui/05_XUI_Gesture.js @@ -57,7 +57,7 @@ // onmouseup, but when touchend has been fired we do nothing. // this is for touchdevices which also fire a mouseup on touchend if( type & MOUSE && touch_triggered ){ - return X_Callback_STOP_NOW | X_Callback_PREVENT_DEFAULT; + return X_CALLBACK_STOP_NOW | X_CALLBACK_PREVENT_DEFAULT; } else // mousebutton must be down or a touch event if( type & TOUCH || //sourceEventType.match(/touch/) || // touch events are always on screen @@ -193,7 +193,7 @@ // only when the instance options have enabled this gesture active[ gesture.name ] && // if a handler returns false, we stop with the detection - ( ret |= ( gesture.handler( e, hammer ) || X_Callback_NONE ) ); + ( ret |= ( gesture.handler( e, hammer ) || X_CALLBACK_NONE ) ); }; // endevent, but not the last touch, so dont stop diff --git a/0.6.x/js/20_ui/06_AbstractUINode.js b/0.6.x/js/20_ui/06_AbstractUINode.js index 87cea63..5e0dce7 100644 --- a/0.6.x/js/20_ui/06_AbstractUINode.js +++ b/0.6.x/js/20_ui/06_AbstractUINode.js @@ -740,11 +740,11 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; }; - arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) ); + arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) ); if( !f.kind ){ return X_EventDispatcher_listen.call( this, type, this.User, f ); } else - if( f.kind === X_Callback_FUNC_ONLY ){ + if( f.kind === X_CLOSURE_FUNC_ONLY ){ return X_EventDispatcher_listen.call( this, type, this.User, f.func, f.supplement ); }; return X_EventDispatcher_listen.apply( this, arguments ); @@ -777,11 +777,11 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; }; }; - arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) ); + arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) ); if( !f.kind ){ return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f ] ); } else - if( f.kind === X_Callback_FUNC_ONLY ){ + if( f.kind === X_CLOSURE_FUNC_ONLY ){ return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f.func, f.supplement ] ); }; return X_EventDispatcher_unlisten.apply( this, arguments ); @@ -794,12 +794,12 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ]( type = e.type || e; // TODO captureEvent PointerEvent - if( ret & X_Callback_CAPTURE_POINTER && !this.hitChildData && XUI_Event._POINTER_MOVE === type ){ + if( ret & X_CALLBACK_CAPTURE_POINTER && !this.hitChildData && XUI_Event._POINTER_MOVE === type ){ this.rootData.monopolyNodeData = this; return ret; }; this.rootData.monopolyNodeData = null; - if( xve._START_BUBLEUP < type && this.parentData && !( ret & X_Callback_STOP_PROPAGATION ) && !( ret & X_Callback_STOP_NOW ) ) return this.parentData[ 'dispatch' ]( e ); + if( xve._START_BUBLEUP < type && this.parentData && !( ret & X_CALLBACK_STOP_PROPAGATION ) && !( ret & X_CALLBACK_STOP_NOW ) ) return this.parentData[ 'dispatch' ]( e ); return ret; }, @@ -1073,14 +1073,14 @@ X.UI.AbstractUINode = X_Class_create( for( i = 0, l = list.length; i < l; ++i ){ f = list[ i ]; switch( f.kind ){ - case X_Callback_THIS_FUNC : + case X_CLOSURE_THIS_FUNC : if( f.lock ){ X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.func, f.supplement ); } else { newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.func, f.supplement ); }; break; - case X_Callback_HANDLEEVENT : + case X_CLOSURE_HANDLEEVENT : if( f.lock ){ X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.supplement ); } else { @@ -1088,7 +1088,7 @@ X.UI.AbstractUINode = X_Class_create( }; break; /* - case X_Callback_FUNC_ONLY : + case X_CLOSURE_FUNC_ONLY : if( f.lock ){ X_EventDispatcher_systemListen( newNode, type, f.func, f.supplement ); } else { diff --git a/0.6.x/js/20_ui/15_ScrollBox.js b/0.6.x/js/20_ui/15_ScrollBox.js index 170dfe4..5e49890 100644 --- a/0.6.x/js/20_ui/15_ScrollBox.js +++ b/0.6.x/js/20_ui/15_ScrollBox.js @@ -132,13 +132,13 @@ var XUI_ScrollBox = XUI_ChromeBox.inherits( function X_UI_ScrollBox_onLayoutBefore( e ){ if( e[ 'cancelable' ] && this.isInTransition && X_Node_Anime_translateZ ){ this[ 'listenOnce' ]( XUI_Event.SCROLL_END, X_UI_rootData, X_UI_rootData.calculate ); - return X_Callback_PREVENT_DEFAULT; + return X_CALLBACK_PREVENT_DEFAULT; }; this.scrollXRatio = this.scrollX ? this.scrollXMax / this.scrollX : 0; this.scrollYRatio = this.scrollY ? this.scrollYMax / this.scrollY : 0; this.xnodeSlider.stop(); this.isInTransition = false; - return X_Callback_NONE; + return X_CALLBACK_NONE; }; function X_UI_ScrollBox_onLayoutComplete( e ){ @@ -222,7 +222,7 @@ function X_UI_ScrollBox_onLayoutComplete( e ){ }; function X_UI_ScrollBox_onStart( e ){ - var ret = X_Callback_NONE; + var ret = X_CALLBACK_NONE; // React to left mouse button only if( e.pointerType === 'mouse' && e.button !== 0 ){ @@ -262,11 +262,11 @@ function X_UI_ScrollBox_onStart( e ){ this[ 'listen' ]( XUI_Event._POINTER_MOVE, this, X_UI_ScrollBox_onMove ); this[ 'listen' ]( [ XUI_Event._POINTER_UP, XUI_Event._POINTER_CANCEL ], this, X_UI_ScrollBox_onEnd ); - return ret | X_Callback_PREVENT_DEFAULT; + return ret | X_CALLBACK_PREVENT_DEFAULT; }; function X_UI_ScrollBox_onMove( e ){ - var ret = X_Callback_NONE, + var ret = X_CALLBACK_NONE, deltaX, deltaY, timestamp, newX, newY, absDistX, absDistY; @@ -363,11 +363,11 @@ function X_UI_ScrollBox_onMove( e ){ this.startY = this.scrollY; }; // イベントの拘束 - return ret | X_Callback_PREVENT_DEFAULT | X_Callback_CAPTURE_POINTER; + return ret | X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_CAPTURE_POINTER; }; function X_UI_ScrollBox_onEnd( e ){ - var ret = X_Callback_NONE, + var ret = X_CALLBACK_NONE, time = 0, easing = '', newX, newY, @@ -472,13 +472,13 @@ function X_UI_ScrollBox_resetPosition( that, time ){ function X_UI_ScrollBox_onAnimeEnd( e ){ if( e.target !== this.xnodeSlider || !this.isInTransition ){ - return X_Callback_NONE; + return X_CALLBACK_NONE; }; if( !X_UI_ScrollBox_resetPosition( this, this.bounceTime ) ){ this.isInTransition = false; this[ 'dispatch' ]( XUI_Event.SCROLL_END ); }; - return X_Callback_NONE; + return X_CALLBACK_NONE; }; function X_UI_ScrollBox_momentum( current, start, time, lowerMargin, wrapperSize, deceleration ){ diff --git a/0.6.x/js/20_ui/20_PageRoot.js b/0.6.x/js/20_ui/20_PageRoot.js index e4d2ab4..09ca3c5 100644 --- a/0.6.x/js/20_ui/20_PageRoot.js +++ b/0.6.x/js/20_ui/20_PageRoot.js @@ -9,7 +9,7 @@ function X_UI_eventRellay( e ){ i = 0, data = X_UI_rootData, sysOnly = false, - ret = X_Callback_NONE, + ret = X_CALLBACK_NONE, list, parent, _ret; // mouseup で alert を出すと mouseleave が発生、ということでイベント中のイベント発火を禁止 @@ -22,9 +22,9 @@ function X_UI_eventRellay( e ){ e.type = type; - if( data && ( data = data.monopolyNodeData ) && ( ret = data[ 'dispatch' ]( e ) ) & X_Callback_CAPTURE_POINTER ){ + if( data && ( data = data.monopolyNodeData ) && ( ret = data[ 'dispatch' ]( e ) ) & X_CALLBACK_CAPTURE_POINTER ){ X_UI_eventBusy = false; - return ret | X_Callback_PREVENT_DEFAULT; + return ret | X_CALLBACK_PREVENT_DEFAULT; }; list = X_UI_rootData.hoverList; @@ -36,7 +36,7 @@ function X_UI_eventRellay( e ){ while( data ){ _ret = data[ 'dispatch' ]( e, sysOnly ); ret |= _ret; - if( _ret & X_Callback_CAPTURE_POINTER || _ret & X_Callback_STOP_PROPAGATION || _ret & X_Callback_STOP_NOW ) break; // sysOnly = true; + if( _ret & X_CALLBACK_CAPTURE_POINTER || _ret & X_CALLBACK_STOP_PROPAGATION || _ret & X_CALLBACK_STOP_NOW ) break; // sysOnly = true; data = data.parentData; }; @@ -59,7 +59,7 @@ function X_UI_eventRellay( e ){ }; }; X_UI_eventBusy = false; - return ret | X_Callback_PREVENT_DEFAULT; + return ret | X_CALLBACK_PREVENT_DEFAULT; }; /* @@ -140,8 +140,8 @@ var XUI_PageRoot = XUI_Box.inherits( var cancelable = !e || ( e.type !== X_EVENT_VIEW_RESIZED && e.type !== X_EVENT_BASE_FONT_RESIZED ), size, font, w, h; - if( this[ 'dispatch' ]( { type : XUI_Event.LAYOUT_BEFORE, 'cancelable' : cancelable } ) & X_Callback_PREVENT_DEFAULT && cancelable ){ - return X_Callback_NONE; + if( this[ 'dispatch' ]( { type : XUI_Event.LAYOUT_BEFORE, 'cancelable' : cancelable } ) & X_CALLBACK_PREVENT_DEFAULT && cancelable ){ + return X_CALLBACK_NONE; }; size = X[ 'ViewPort' ][ 'getSize' ](); @@ -153,7 +153,7 @@ var XUI_PageRoot = XUI_Box.inherits( X_ViewPort[ 'listenOnce' ]( X_EVENT_AFTER_UPDATE, this, XUI_PageRoot_onViewUpdate ); - return X_Callback_NONE; + return X_CALLBACK_NONE; }, updateCoursor : function( cursor ){ diff --git a/0.6.x/js/import.js b/0.6.x/js/import.js index e5c7745..7d9dd92 100644 --- a/0.6.x/js/import.js +++ b/0.6.x/js/import.js @@ -16,9 +16,9 @@ document.write( [ 'js/01_core/06_XString.js', 'js/01_core/08_XURL.js', - 'js/01_core/10_XPair.js', - 'js/01_core/11_XClosure.js', - 'js/01_core/12_XCallback.js', + 'js/01_core/10_XPair.js', + 'js/01_core/11_XCallback.js', + 'js/01_core/12_XClosure.js', 'js/01_core/13_XClass.js', 'js/01_core/14_XEvent.js', 'js/01_core/15_XEventDispatcher.js',