X_ViewPort_width,
X_ViewPort_height,
X_ViewPort_baseFontSize,
+ X_ViewPort_vScrollbarSize,
+ X_ViewPort_hScrollbarSize,
- X_Dom_detectFontSize = !( X.UA.IE < 9 || X.UA.iOS ) && function(){
- var size = Node._fontSizeNode._rawObject.offsetHeight;
+ X_Dom_detectFontSize = !( X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ] ) && function(){
+ var size = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight;
if( X_ViewPort_baseFontSize !== size ){
- X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( { type : X.Event.BASE_FONT_RESIZED, fontSize : size, w : X_ViewPort_width, h : X_ViewPort_height } );
+ X_ViewPort_baseFontSize && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_BASE_FONT_RESIZED );
X_ViewPort_baseFontSize = size;
};
},
X_ViewPort_orientationFlag,
X_Dom_orientationchange = window[ 'orientation' ] !== undefined && function( e ){
X_ViewPort_orientationFlag = true;
- !X.UA.Android && X_ViewPort_resize();
+ !X_UA[ 'Android' ] && X_ViewPort_resize();
//console.log( '-- orientationchange : ' + X.ViewPort.getSize[ 0 ] + ' ' + X.ViewPort.getSize[ 1 ] );
},
- X_ViewPort_document = new X.EventDispatcher( document ),
+ X_ViewPort_document = X_EventDispatcher( document ),
-X_ViewPort = X.Class._override(
- new X.EventDispatcher( window ),
+X_ViewPort = X_Class_override(
+ X_EventDispatcher( window ),
{
- handleEvent : function( e ){
- var href;
+ 'handleEvent' : function( e ){
+ var href, i, name;
+
switch( e.type ){
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;
+ 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;
+
+ return X_ViewPort[ 'dispatch' ]( X_EVENT_BEFORE_UNLOAD );
- return X_ViewPort.dispatch( X.Event.BEFORE_UNLOAD );
case 'unload' :
- X_ViewPort.dispatch( X.Event.UNLOAD );
+ X_ViewPort[ 'dispatch' ]( X_EVENT_UNLOAD );
+ //alert('unload');
+ X_ViewPort_document[ 'kill' ]();
+ this[ 'kill' ]();
- X_ViewPort.unlisten();
- X_ViewPort_document.unlisten();
- Node._html._actualRemove( true );
+ //X_System[ 'dispatch' ]( X_EVENT_SHUT_DOWN );
break;
+
case 'visibilitychange' :
- X_ViewPort.dispatch( { type : ( X_ViewPort_active = document[ 'hidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE } );
+ X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'hidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE );
+ break;
+ case 'mozvisibilitychange' :
+ X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'mozHidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE );
break;
case 'webkitvisibilitychange' :
- X_ViewPort.dispatch( { type : ( X_ViewPort_active = document[ 'webkitHidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE } );
+ X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'webkitHidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE );
break;
+
case 'pageshow' :
case 'focus' :
- X_ViewPort_active = true;
- X_ViewPort.dispatch( X.Event.VIEW_ACTIVATE );
+ if( !X_ViewPort_active ){
+ X_ViewPort_active = true;
+ X_ViewPort[ 'dispatch' ]( X_EVENT_VIEW_ACTIVATE );
+ };
break;
+
case 'pagehide' :
case 'blur' :
- X_ViewPort_active = false;
- X_ViewPort.dispatch( X.Event.VIEW_DEACTIVATE );
+ if( X_ViewPort_active ){
+ X_ViewPort_active = false;
+ X_ViewPort[ 'dispatch' ]( X_EVENT_VIEW_DEACTIVATE );
+ };
break;
};
}
);
+/**
+ * window に相当する ViewPort 情報を提供するオブジェクト。
+ * @namespace X.ViewPort
+ * @alias X.ViewPort
+ */
X.ViewPort = {
- listen : function( type, arg1, arg2, arg3 ){
+ 'listen' : function( type, arg1, arg2, arg3 ){
if( type <= X_ViewPort_readyState ){
/*
- * X.Event.XDOM_READY 以後に listen した場合の対策
+ * X_EVENT_XDOM_READY 以後に listen した場合の対策
*/
- X_ViewPort.asyncDispatch( { type : type, w : X_ViewPort_width, h : X_ViewPort_height } );
+ X_ViewPort[ 'asyncDispatch' ]( type );
};
- type && arg1 && X_ViewPort.listen( type, arg1, arg2, arg3 );
+ // ie8-では keydown -> documentへ
+ type && arg1 && X_ViewPort[ 'listen' ]( type, arg1, arg2, arg3 );
return X.ViewPort;
},
- listenOnce : function( type, arg1, arg2, arg3 ){
+ 'listenOnce' : function( type, arg1, arg2, arg3 ){
if( type <= X_ViewPort_readyState ){
/*
* X.Event.XDOM_READY 以後に listen した場合の対策
*/
- X_ViewPort.asyncDispatch( { type : type, w : X_ViewPort_width, h : X_ViewPort_height } );
+ X_ViewPort[ 'asyncDispatch' ]( type );
};
- type && arg1 && X_ViewPort.listenOnce( type, arg1, arg2, arg3 );
+ type && arg1 && X_ViewPort[ 'listenOnce' ]( type, arg1, arg2, arg3 );
return X.ViewPort;
},
- unlisten : function( type, arg1, arg2, arg3 ){
- type && arg1 && X_ViewPort.unlisten( type, arg1, arg2, arg3 );
+ 'unlisten' : function( type, arg1, arg2, arg3 ){
+ type && arg1 && X_ViewPort[ 'unlisten' ]( type, arg1, arg2, arg3 );
return X.ViewPort;
},
- listening : function( type, arg1, arg2, arg3 ){
- return X_ViewPort.listening( type, arg1, arg2, arg3 );
+ 'listening' : function( type, arg1, arg2, arg3 ){
+ return X_ViewPort[ 'listening' ]( type, arg1, arg2, arg3 );
},
// hammer のテストファイルだけが使用
- asyncDispatch : function(){
- return X_ViewPort.asyncDispatch.apply( X_ViewPort, arguments );
+ 'asyncDispatch' : function(){
+ return X_ViewPort[ 'asyncDispatch' ].apply( X_ViewPort, arguments );
},
- getPointerPosition : function(){
+ 'getPointerPosition' : function(){
},
- /* 要素が視界に入った http://remysharp.com/2009/01/26/element-in-view-event-plugin/ */
- inView : function( elm ){
+ /* 要素が視界に入った http://remysharp.com/2009/01/26/element-in-view-event-plugin/
+ * TODO -> Node.call('inView')
+ */
+ 'inView' : function( elm ){
},
- getSize : function(){
+ 'getSize' : function(){
return [ X_ViewPort_width, X_ViewPort_height ];
},
//https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
//(((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
- getDocumentSize : function(){
+ 'getDocumentSize' : function(){
// Opera は互換モードでは document.body.scrollHeight、標準モードでは document.documentElement.scrollHeight でページの高さが取れる。と思ってたんだけど、例外があった。
// http://orera.g.hatena.ne.jp/edvakf/20100515/1273908051
//http://onozaty.hatenablog.com/entry/20060803/p1
// Safari2.0.4では標準・互換どちらも document.body
- Node._body._updateTimerID && Node._body._startUpdate();
- /*X.UA.Opera ?
+ X_Node_updateTimerID && X_Node_startUpdate();
+ /*X_UA[ 'Opera' ] ?
( document.documentElement && document.documentElement.clientWidth ?
new Function( 'return[document.documentElement.clientWidth,document.documentElement.clientHeight]' ) :
new Function( 'return[document.body.clientWidth,document.body.clientHeight]' )
];
},
- getScrollPosition :
+ 'getScrollPosition' :
window.pageXOffset !== undefined ?
( function(){
- Node._body._updateTimerID && Node._body._startUpdate();
+ X_Node_updateTimerID && X_Node_startUpdate();
return[ window.pageXOffset, window.pageYOffset ];
} ) :
window.scrollLeft !== undefined ?
( function(){
- Node._body._updateTimerID && Node._body._startUpdate();
+ X_Node_updateTimerID && X_Node_startUpdate();
return[ window.scrollLeft, window.scrollTop ];
} ) :
( function(){
- Node._body._updateTimerID && Node._body._startUpdate();
+ X_Node_updateTimerID && X_Node_startUpdate();
// body は Safari2-
return[ X_ViewPort_rootElement.scrollLeft || document.body.scrollLeft, X_ViewPort_rootElement.scrollTop || document.body.scrollTop ];
} ),
- getScrollbarSize : function(){
- return [ X.Dom.BoxModel.vScrollbarSize, X.Dom.BoxModel.hScrollbarSize ];
+ 'getScrollbarSize' : function(){
+ return [ X_ViewPort_vScrollbarSize, X_ViewPort_hScrollbarSize ];
},
- getBaseFontSize : function(){
- if( Node._body._updateTimerID ){
- Node._body._startUpdate();
- return X_ViewPort_baseFontSize = Node._fontSizeNode._rawObject.offsetHeight;
+ 'getBaseFontSize' : function(){
+ if( X_Node_updateTimerID ){
+ X_Node_startUpdate();
+ return X_ViewPort_baseFontSize = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight;
};
return X_ViewPort_baseFontSize;
}
*/
var X_ViewPort_resize =
// iOS もループで回す,,,iOS3.1.3, iOS6 で確認
- X.UA.IE < 9 || X.UA.iOS ?
+ X_UA[ 'IE' ] < 9 || X_UA[ 'iOS' ] ?
(function(){
var size;
if( !X_ViewPort_lock ){
if( X_ViewPort_width !== size[ 0 ] || X_ViewPort_height !== size[ 1 ] ){
X_ViewPort_width = size[ 0 ];
X_ViewPort_height = size[ 1 ];
- X.Timer.once( 100, X_Dom_detectFinishResizing );
+ X_Timer_once( 100, X_Dom_detectFinishResizing );
X_ViewPort_lock = true;
};
};
- size = Node._fontSizeNode._rawObject.offsetHeight;
+ size = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight;
if( X_ViewPort_baseFontSize !== size ){
- X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( { type : X.Event.BASE_FONT_RESIZED, fontSize : size, w : X_ViewPort_width, h : X_ViewPort_height } );
+ X_ViewPort_baseFontSize && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_BASE_FONT_RESIZED );
X_ViewPort_baseFontSize = size;
};
(function( e ){
console.log( '-- resize : ' + X_Timer_now() );
- !X_ViewPort_lock && ( X_ViewPort_lock = true ) && X.Timer.once( 100, X_Dom_detectFinishResizing );
- return X.Callback.PREVENT_DEFAULT | X.Callback.STOP_PROPAGATION;
+ !X_ViewPort_lock && ( X_ViewPort_lock = true ) && X_Timer_once( 100, X_Dom_detectFinishResizing );
+ return X_Callback_PREVENT_DEFAULT | X_Callback_STOP_PROPAGATION;
});
function X_Dom_detectFinishResizing(){
if( X_ViewPort_width !== size[ 0 ] || X_ViewPort_height !== size[ 1 ] ){
X_ViewPort_width = size[ 0 ];
X_ViewPort_height = size[ 1 ];
- X.Timer.once( 100, X_Dom_detectFinishResizing );
+ X_Timer_once( 100, X_Dom_detectFinishResizing );
} else {
console.log( '-- detectFinishResizing : ' + X_Timer_now() );
- X_ViewPort.asyncDispatch( { type : X.Event.VIEW_RESIZED, fontSize : X_ViewPort_baseFontSize, w : X_ViewPort_width, h : X_ViewPort_height } );
+ X_ViewPort[ 'asyncDispatch' ]( X_EVENT_VIEW_RESIZED );
X_ViewPort_lock = false;
if( X_ViewPort_orientationFlag ){
X_ViewPort_orientationFlag = false;
- X_ViewPort.asyncDispatch( 100, { type : X.Event.VIEW_TURNED, orientation : window.orientation } );
+ X_ViewPort[ 'asyncDispatch' ]( 100, { type : X_EVENT_VIEW_TURNED, orientation : window.orientation } );
};
};
};
X_TEMP.onDomContentLoaded = function(){
var s, size, elmHtml, elmHead, elmBody, html, head, body;
- if( X_TEMP.SYSTEM_EVENT_PRE_INIT <= X_ViewPort_readyState ) return X_Callback_UN_LISTEN;
- X_ViewPort_readyState = X_TEMP.SYSTEM_EVENT_PRE_INIT;
+ console.log( '> X_TEMP.onDomContentLoaded rs:' + X_ViewPort_readyState );
+
+ if( X_EVENT_PRE_INIT <= X_ViewPort_readyState ) return X_Callback_UN_LISTEN;
+ X_ViewPort_readyState = X_EVENT_PRE_INIT;
// DOMContentLoaded の無いブラウザで X_TEMP.onDomContentLoaded への参照が残り続けるのを回避
- X_TEMP.onDomContentLoaded && X_ViewPort_document.unlisten( 'DOMContentLoaded', X_TEMP.onDomContentLoaded );
+ X_TEMP.onDomContentLoaded && X_ViewPort_document[ 'unlisten' ]( 'DOMContentLoaded', X_TEMP.onDomContentLoaded );
delete X_TEMP.onDomContentLoaded;
elmHtml = document.documentElement ||
X_ViewPort_rootElement = document.compatMode !== 'CSS1Compat' ? elmBody : elmHtml || elmBody;
- html = Node._html = elmHtml && new Node( elmHtml );
-
- head = Node._head = elmHead && new Node( elmHead );
-
- body = Node._body = new Node( elmBody );
+ html = X[ 'Doc' ][ 'html' ] = X_Node_html = elmHtml && new Node( elmHtml );
+ html[ '_flags' ] |= X_Node_State.IN_TREE;
- body._root = html._root = head._root = body;// _root は html だろ
- body.parent = head.parent = html;
- html._xnodes = [ head, body ];
-
- Node.root = body; // 後方互換
+ head = X[ 'Doc' ][ 'head' ] = X_Node_head = elmHead && new Node( elmHead );
+
+ body = X[ 'Doc' ][ 'body' ] = X_Node_body = new Node( elmBody );
+
+ body[ 'parent ' ] = head[ 'parent' ] = html;
+ html[ '_xnodes' ] = [ head, body ];
- html.appendTo = html.appendToRoot = html.before = html.after = html.clone = html.remove = html.destroy = html.prevNode = html.nextNode =
- html.create = html.createText = html.createAt = html.createTextAt = html.append = html.appendAt = html.empty = html.html = html.text =
- head.appendTo = head.appendToRoot = head.before = head.after = head.clone = head.remove = head.destroy = head.prevNode = head.nextNode =
- head.empty = head.html = head.text =
- body.appendTo = body.appendToRoot = body.before = body.after = body.clone = body.remove = body.destroy = body.prevNode = body.nextNode = new Function( 'return this' );
-
- X_ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_PRE_INIT, function(){
- X_ViewPort_readyState = X_TEMP.SYSTEM_EVENT_XTREE;
+ html[ 'appendTo' ] = html[ 'before' ] = html[ 'after' ] = html[ 'clone' ] = html[ 'remove' ] = html[ 'destroy' ] = html[ 'prev' ] = html[ 'next' ] =
+ html[ 'create' ] = html[ 'createText' ] = html[ 'createAt' ] = html[ 'createTextAt' ] = html[ 'append' ] = html[ 'appendAt' ] = html[ 'empty' ] = html[ 'html' ] = html[ 'text' ] =
+ html[ 'css' ] = html[ 'cssText' ] =
+ head[ 'appendTo' ] = head[ 'before' ] = head[ 'after' ] = head[ 'clone' ] = head[ 'remove' ] = head[ 'destroy' ] =
+ head[ 'createText' ] = head[ 'createTextAt' ] = head[ 'empty' ] = head[ 'html' ] = head[ 'text' ] = head[ 'css' ] = head[ 'cssText' ] =
+ body[ 'appendTo' ] = body[ 'before' ] = body[ 'after' ] = body[ 'clone' ] = body[ 'remove' ] = body[ 'destroy' ] = new Function( 'return this' );
+
+ X_ViewPort[ 'listenOnce' ]( X_EVENT_PRE_INIT, function(){
+ X_ViewPort_readyState = X_EVENT_XTREE_READY;
if( X_TEMP.X_Dom_useBuilder ) X_TEMP.X_Dom_useBuilder = !!document.body.children.length;
- !X_TEMP.X_Dom_useBuilder && X_ViewPort.asyncDispatch( X_TEMP.SYSTEM_EVENT_XTREE );
+ !X_TEMP.X_Dom_useBuilder && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_XTREE_READY );
} );
- X_ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_XTREE, function(){
- X_ViewPort_readyState = X_TEMP.SYSTEM_EVENT_INIT;
- //X.UA.Opera7 && alert( 'bc' );
- Node._body.appendAt( 0,
- Node._systemNode = Node.create( 'div', { 'class' : 'hidden-system-node' } ),
- Node._fontSizeNode = Node.create( 'div', { 'class' : 'hidden-system-node' } ).cssText( 'line-height:1;height:1em;' ).text( 'X' )
- )._startUpdate();
-
- X_ViewPort.asyncDispatch( X_TEMP.SYSTEM_EVENT_INIT );
+ X_ViewPort[ 'listenOnce' ]( X_EVENT_XTREE_READY, function(){
+ X_ViewPort_readyState = X_EVENT_INIT;
+ //X_UA[ 'Opera7' ] && alert( 'bc' );
+ X_Node_body[ 'appendAt' ]( 0,
+ X_Node_systemNode = X_Doc_create( 'div', { 'class' : 'hidden-system-node' } ),
+ X_Node_fontSizeNode = X_Doc_create( 'div', { 'class' : 'hidden-system-node' } )[ 'cssText' ]( 'line-height:1;height:1em;' )[ 'text' ]( 'X' )
+ );
+ X_Node_startUpdate();
+
+ X_ViewPort[ 'asyncDispatch' ]( X_EVENT_INIT );
} );
- X_ViewPort.listenOnce( X_TEMP.SYSTEM_EVENT_INIT, function(){
- var size = X_ViewPort_getWindowSize();
+ X_ViewPort[ 'listenOnce' ]( X_EVENT_INIT, function(){
+ var size = X_ViewPort_getWindowSize(),
+ // http://jsdo.it/imaya/kTYg
+ body = document.body,
+ defaultOverflow = document.body.style.overflow,
+ w, h;
+
+ body.style.overflow = 'hidden';
+ w = body.clientWidth;
+ h = body.clientHeight;
+
+ body.style.overflow = 'scroll';
+ w -= body.clientWidth;
+ h -= body.clientHeight;
+
+ if( !w ) w = body.offsetWidth - body.clientWidth;
+ if( !h ) h = body.offsetHeight - body.clientHeight;
+ body.style.overflow = defaultOverflow;
+
+ X_ViewPort_vScrollbarSize = w;
+ X_ViewPort_hScrollbarSize = h;
+ if( h <= 0 ){ // ie6, ie11, firefox で 負の値が返る
+ console.log( 'invalid hScrollbarSize: ' + h );
+ X_ViewPort_hScrollbarSize = w;
+ };
+
+ //
if( X_Dom_orientationchange ){
- X_ViewPort.listen( 'orientationchange', X_Dom_orientationchange );
+ X_EventDispatcher_systemListen( X_ViewPort, 'orientationchange', X_Dom_orientationchange );
};
if( X_Dom_detectFontSize ){
- X_ViewPort.listen( 'resize', X_ViewPort_resize );
- X.Timer.add( 333, X_Dom_detectFontSize );
+ X_EventDispatcher_systemListen( X_ViewPort, 'resize', X_ViewPort_resize );
+ X_Timer_add( 333, X_Dom_detectFontSize );
} else {
- X.Timer.add( 333, X_ViewPort_resize );
+ X_Timer_add( 333, X_ViewPort_resize );
};
- X_ViewPort_baseFontSize = Node._fontSizeNode._rawObject.offsetHeight;
+ X_ViewPort_baseFontSize = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight;
- X_ViewPort_readyState = X.Event.XDOM_READY;
- X_ViewPort.asyncDispatch( { type : X.Event.XDOM_READY, w : X_ViewPort_width = size[ 0 ], h : X_ViewPort_height = size[ 1 ] } );
+ X_ViewPort_readyState = X_EVENT_XDOM_READY;
+ X_ViewPort[ 'asyncDispatch' ]( { type : X_EVENT_XDOM_READY, w : X_ViewPort_width = size[ 0 ], h : X_ViewPort_height = size[ 1 ] } );
} );
- console.log( X_ViewPort.asyncDispatch( X_TEMP.SYSTEM_EVENT_PRE_INIT ) );
+ X_ViewPort[ 'asyncDispatch' ]( X_EVENT_PRE_INIT );
+
- X_ViewPort
- .listen( 'beforeunload', X_ViewPort )
- .listenOnce( 'unload', X_ViewPort );
+ X_EventDispatcher_systemListen( X_ViewPort, [ 'beforeunload', 'unload' ] );
//ブラウザの戻るボタンで戻ったときに呼ばれるイベントとかキャッシュとかそこらへんのこと
//http://d.hatena.ne.jp/koumiya/20080916/1221580149
- if( document[ 'hidden' ] !== undefined ) {// iOS 7+
- X_ViewPort_document.listen( 'visibilitychange', X_ViewPort );
+ if( document[ 'hidden' ] !== undefined ){// iOS 7+
+ X_EventDispatcher_systemListen( X_ViewPort_document, 'visibilitychange', X_ViewPort );
+ } else
+ if( document[ 'mozHidden' ] !== undefined ){
+ X_EventDispatcher_systemListen( X_ViewPort_document, 'mozvisibilitychange', X_ViewPort );
} else
- if( document[ 'webkitHidden' ] !== undefined ) {
- X_ViewPort_document.listen( 'webkitvisibilitychange', X_ViewPort );
+ if( document[ 'webkitHidden' ] !== undefined ){
+ X_EventDispatcher_systemListen( X_ViewPort_document, 'webkitvisibilitychange', X_ViewPort );
} else
- if( X.UA.iOS && window[ 'onpageshow' ] !== undefined ) {
- X_ViewPort.listen( 'pageshow', X_ViewPort )
- .listen( 'pagehide', X_ViewPort );
+ if( X_UA[ 'iOS' ] && window[ 'onpageshow' ] !== undefined ){
+ X_EventDispatcher_systemListen( X_ViewPort, [ 'pageshow', 'pagehide' ] );
} else {
- X_ViewPort.listen( 'focus', X_ViewPort )
- .listen( 'blur', X_ViewPort );
+ X_EventDispatcher_systemListen( X_ViewPort, [ 'focus', 'blur' ] );
};
return X_Callback_UN_LISTEN;
};
function X_ViewPort_getWindowSize(){
- return X.UA.IE ?
+ return X_UA[ 'IE' ] ?
[ X_ViewPort_rootElement.clientWidth, X_ViewPort_rootElement.clientHeight ] :
[ window.innerWidth, window.innerHeight ];
};
/* for ie9+/Mozilla/Opera9 */
if( X_UA_EVENT.W3C ){
- X_ViewPort_document.listenOnce( 'DOMContentLoaded', X_TEMP.onDomContentLoaded );
+ X_ViewPort_document[ 'listenOnce' ]( 'DOMContentLoaded', X_TEMP.onDomContentLoaded );
} else
-if( 6 <= X.UA.IE && X.inHead ){
+if( 6 <= X_UA[ 'IE' ] && X.inHead ){
// if this script in Head
document.write( "<script id=__ie_onload defer src=javascript:void(0)><\/script>" );
X_TEMP._script = document.getElementById( "__ie_onload" );
X_TEMP._script.onreadystatechange = function(){
var s = X_TEMP._script;
if( s && s.readyState === 'complete' ){
- s.onreadystatechange = X.emptyFunction;
+ s.onreadystatechange = X_emptyFunction;
s.onreadystatechange = null;
s.parentNode.removeChild( s );
delete X_TEMP._script;
};
// Re: onLoad doesn't work with Safari?
// 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_UA[ 'WebKit' ] || X_UA[ 'Safari' ] < 3 ){ // sniff
+ X_Timer_add( 16, function(){
if( !X_TEMP.onDomContentLoaded ) return X_Callback_UN_LISTEN;
if( document.readyState === 'loaded' || document.readyState === 'complete' ) return X_TEMP.onDomContentLoaded();
});
};
/* for other browsers */
-X_ViewPort.listenOnce( 'load', X_TEMP.onDomContentLoaded );
+X_ViewPort[ 'listenOnce' ]( 'load', X_TEMP.onDomContentLoaded );