X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=0.6.x%2Fjs%2F01_core%2F01_X.js;h=8f84e890fb2ac5bde5cdfebd0bd6e4e335ba27a4;hb=HEAD;hp=7655eeed83f271696d22ebb3fd0c0a027a198e77;hpb=57e35f063b4a70fcec59db6ec7366b43f41f0ba4;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/01_core/01_X.js b/0.6.x/js/01_core/01_X.js index 7655eee..8f84e89 100644 --- a/0.6.x/js/01_core/01_X.js +++ b/0.6.x/js/01_core/01_X.js @@ -1,41 +1,72 @@ -if( !window['console'] || ( window.parent && window.parent.log ) ) - console = { log : function(a){ - var win, elm; - //alert(a); - if( window.parent ){ - elm = parent.document.all ? parent.document.all.log : parent.log || parent.document.getElementById( 'log' ); - elm && ( elm.innerHTML = a + '
' + elm.innerHTML ); - }; - } }; +/** + *

API ドキュメントと併せて、その意図や背景を綴っていく副読本もご覧ください。 + * クラウド番外地 > ぺったんR API文書の副読本 + * + * @example // ライブラリは X という名前空間を使用します。 + * //ショートハンド + * X( func ) == X.ViewPort[ 'listenOnce' ](X.Event.XDOM_READY, func); + * X('#mydiv') == X.Doc.find('#mydiv'); + * @namespace X + */ +function X( v ){ + if( X_Type_isFunction( v ) ){ + X[ 'ViewPort' ][ 'listenOnce' ]( X_EVENT_XDOM_READY, v ); + } else + if( X_shortcutFunction ){ + return X_shortcutFunction.apply( X_shortcutContext || X, arguments ); + }; +}; + +//{+DEV +if( !window['console'] || ( window.parent && window.parent.log ) ){ + console = { + log : function(a){ + var elm; + //alert(a); + if( window.parent ){ + elm = parent.document.all ? parent.document.all.log : parent.log || parent.document.getElementById( 'log' ); + elm && ( elm.innerHTML = a + '
' + elm.innerHTML ); + }; + } + }; +}; + +if( !console.dir ) console.dir = function(){}; +//+DEV} + +//{-AUDIO +//-AUDIO} var undefined, X_EMPTY_OBJECT = {}, X_TEMP = { onSystemReady : [] }, + X_emptyFunction = new Function, X_shortcutFunction, X_shortcutContext; /** - * @namespace ライブラリは X という名前空間を使用します。X( func ) で X.ViewPort.listenOnce(X.Event.XDOM_READY, func)、 X('#mydiv') として X.Doc.find('#mydiv') のショートハンドになります。 - */ -function X( v ){ - if( X.Type.isFunction( v ) ){ - X.ViewPort.listenOnce( X.Event.XDOM_READY, v ); - } else - if( X_shortcutFunction ){ - return X_shortcutFunction.apply( X_shortcutContext || X, arguments ); - }; -}; + * バージョン文字列:"0.6.xxx" + * @type {string} */ +X[ 'VERSION' ] = '0.6.181'; -X.VERSION = '0.6.103'; - -X.bootTime = + new Date; +/** + * ブートタイム ms + * @type {number} */ +X[ 'bootTime' ] = + new Date; -X.emptyFunction = new Function; +/** + * 空の関数 + * @type {Function} */ +X[ 'emptyFunction' ] = X_emptyFunction; +/** + * このscriptはheadタグの中にあるか? + * @type {boolean} */ // TODO defer の場合もあるので、document.readyState を見る +// TODO body の有無を見ればOKではないか? // MacIE で false -X.inHead = (function( s ){ +X[ 'inHead' ] = (function( s ){ if( !s ) return false; if( !s.length ) return false; // Safari1.3 312.8 でerror s = s[ s.length - 1 ];