\r
X.bootTime = + new Date;\r
\r
-X.getTime = new Function( Date.now ? 'return Date.now()' : 'return +new Date' );\r
+X.getTime = Date.now ? Date.now : new Function( 'return +new Date' );\r
\r
\r
X.emptyFunction = new Function;\r
endTime : 0, // iOS\r
next : 0,\r
busy : false, // for Opera7\r
- //frameBusy : false,\r
\r
REQ_FRAME_LIST : [],\r
requestID : 0,\r
\r
if( r & X.Callback.UN_LISTEN || c === 1 ){\r
list.splice( i, 1 );\r
- //f.kill && f.kill();\r
continue;\r
} else\r
if( 1 < c ) --q.count;\r
var list = X.Timer.REQ_FRAME_LIST,\r
l = list.length,\r
i = 0, q;\r
- //this.frameBusy = true;\r
+\r
time = time || X.getTime();\r
- console.log( X.getTime() + ' , ' + time );\r
+ // console.log( X.getTime() + ' , ' + time );\r
for( ; i < l; ++i ){\r
q = list[ i ];\r
\r
} else {\r
q( time );\r
};\r
- //delete f.uid;\r
- //f.kill && f.kill();\r
};\r
- //this.frameBusy = false;\r
+\r
list.splice( 0, l );\r
- if( list.length ) X.Timer.requestID = _enterFrame( X.Timer._onEnterFrame );\r
+ if( list.length ){\r
+ X.Timer.requestID = _enterFrame ? _enterFrame( X.Timer._onEnterFrame ) : X.Timer.add( 0, 1, X.Timer._onEnterFrame );\r
+ };\r
},\r
\r
add : function( time, opt_count, args1, args2, args3 ){\r
// fire 中の cancel\r
if( ( q = list[ --i ] ).uid === uid ){\r
list.splice( i, 1 );\r
- //f = q.f;\r
- //f.kill && f.kill();\r
!X.Timer.busy && ( /* q[ INDEX_COUNT ] <= next || */ l === 1 ) && X.Timer._update();\r
- //q.length = 0;\r
break;\r
};\r
};\r
// TODO\r
// fire 中の cancel\r
list.splice( i, 1 );\r
- //delete f.uid;\r
- //f.kill && f.kill();\r
l === 1 && _cancelFrame( X.Timer.requestID );\r
break;\r
};\r
if( ( f = list[ --i ] ).uid < uid ) break;\r
if( f.uid === uid ){\r
list.splice( i, 1 );\r
- //delete f.uid;\r
- //f.kill && f.kill();\r
l === 1 && X.Timer.remove( X.Timer.requestID );\r
break;\r
};\r
// axis\r
// https://w3g.jp/blog/tools/wheelevent_crossbrowser\r
// ホイール系イベント2014年版クロスブラウザ\r
+ if( e.deltaY ){\r
+ this.deltaX = e.deltaX;\r
+ this.deltaY = e.deltaY;\r
+ } else\r
if( e.wheelDeltaY !== undefined ){\r
- this.wheelDeltaX = e.wheelDeltaX / 12;\r
- this.wheelDeltaY = e.wheelDeltaY / 12;\r
+ this.deltaX = e.wheelDeltaX / 120;\r
+ this.deltaY = e.wheelDeltaY / 120;\r
} else\r
if( e.wheelDelta !== undefined ){\r
- this.wheelDeltaX = this.wheelDeltaY = e.wheelDelta / 12;\r
+ this.deltaX = 0;\r
+ this.deltaY = e.wheelDelta / 120;\r
} else\r
if( e.detail !== undefined ){\r
- this.wheelDeltaX = this.wheelDeltaY = - e.detail * 3;\r
+ this.deltaX = 0;\r
+ this.deltaY = e.type === 'MozMousePixelScroll' ? e.detail / 15 : e.detail; // 3\r
} else {\r
- this.wheelDeltaX = this.wheelDeltaY = 0;\r
+ this.deltaX = this.deltaY = 0;\r
};\r
\r
if( /* e.constructor === window.TouchEvent || */ e.touches /* for iOS3.13 */ ){\r
btn & 2 ? 3 : 0; // 左:1(click:0), 中:4, 右:2\r
};\r
this.button = this.which - 1;\r
- this.wheelDeltaX = this.wheelDeltaY = e.wheelDelta / 12;\r
+ this.deltaX = 0;\r
+ this.deltaY = e.wheelDelta / 12;\r
};\r
};\r
\r
X.Dom.Event.RenameTo = {};\r
// https://github.com/georgeadamson/jQuery.prefixfree-events/blob/master/jQuery.prefixfree-events.js\r
// https://developer.mozilla.org/en-US/docs/Web/Events/wheel\r
-// \r
-\r
-// DOMMoseScroll\r
-if( X.UA.Gecko && window.MouseScrollEvent ){\r
- if( 2 <= X.UA.Gecko || ( 1.9 < X.UA.Gecko && 1 <= X.UA.GeckoPatch ) ){ // Gecko 1.9.1+ (firefox3.5+)\r
- console.log( 'wheel <= MozMousePixelScroll' );\r
- X.Dom.Event.Rename[ 'mousewheel' ] = 'MozMousePixelScroll';\r
+//\r
+if( document.onwheel === undefined ){\r
+ // DOMMoseScroll\r
+ if( X.UA.Gecko && window.MouseScrollEvent ){\r
+ if( 2 <= X.UA.Gecko || ( 1.9 < X.UA.Gecko && 1 <= X.UA.GeckoPatch ) ){ // Gecko 1.9.1+ (firefox3.5+)\r
+ console.log( 'wheel <= MozMousePixelScroll' );\r
+ X.Dom.Event.Rename[ 'wheel' ] = 'MozMousePixelScroll';\r
+ } else\r
+ if( 0.9 < X.UA.Gecko && 7 <= X.UA.GeckoPatch ){ // Gecko 0.9.7+ (NN6.2+?)\r
+ console.log( 'wheel <= DOMMouseScroll' );\r
+ X.Dom.Event.Rename[ 'wheel' ] = 'DOMMouseScroll';\r
+ };\r
} else\r
- if( 0.9 < X.UA.Gecko && 7 <= X.UA.GeckoPatch ){ // Gecko 0.9.7+ (NN6.2+?)\r
- console.log( 'wheel <= DOMMouseScroll' );\r
- X.Dom.Event.Rename[ 'wheel' ] = 'DOMMouseScroll';\r
- };\r
-} else\r
-if( document.onmousewheel !== undefined ){\r
- X.Dom.Event.Rename[ 'wheel' ] = 'mousewheel';\r
+ if( document.onmousewheel !== undefined ){\r
+ X.Dom.Event.Rename[ 'wheel' ] = 'mousewheel';\r
+ }; \r
};\r
\r
if( window.onwebkitanimationend !== undefined && window.onanimationend === undefined ){\r
};\r
};\r
\r
+Node.prototype.clientWidth = function(){\r
+ if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
+ console.log( 'xnode.width() : no parent' );\r
+ return 0;\r
+ };\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
+ if( !this._root ){\r
+ console.log( 'xnode.width() : not belong tree.' );\r
+ return 0;\r
+ };\r
+ if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
+ if( X.Dom.DOM_W3C ){\r
+ // this.css( X.Dom.Style.Unit.px, 'width' );\r
+ return this._rawNode.clientWidth;\r
+ } else\r
+ if( X.Dom.DOM_IE4 ){\r
+ return ( this._rawNode || this._ie4getRawNode() ).clientWidth;\r
+ } else {\r
+ \r
+ };\r
+};\r
+\r
+Node.prototype.clientHeight = function(){\r
+ if( !this.parent ){\r
+ console.log( 'xnode.height() : no parent' );\r
+ return 0;\r
+ };\r
+ Node._body._updateTimerID && Node._body._startUpdate();\r
+ if( !this._root ){\r
+ console.log( 'xnode.height() : not belong tree.' );\r
+ return 0;\r
+ };\r
+ if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
+ if( X.Dom.DOM_W3C ){\r
+ // this.css( X.Dom.Style.Unit.px, 'height' );\r
+ return this._rawNode.clientHeight;\r
+ } else\r
+ if( X.Dom.DOM_IE4 ){\r
+ return ( this._rawNode || this._ie4getRawNode() ).clientHeight;\r
+ } else {\r
+ \r
+ };\r
+};\r
+\r
Node.prototype.scrollWidth = function(){\r
if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
console.log( 'xnode.width() : no parent' );\r
X.Dom.Style.VENDER_PREFIX = (function(){
var ret = {},
vendors = 'webkit,Webkit,Moz,moz,ms,Ms,O,o,khtml,Khtml'.split( ',' ),
- searches =
+ searches = (
'opacity,boxSizing,' +
'transform,transformOrigin,perspective,' +
'transisiton,transitionDelay,transitionProperty,transitionDuration,transitionTimingFunction,' +
- 'userSelect,touchAction,touchCallout,contentZooming,userDrag,tapHighlightColor'.split( ',' ),
- vendor, i, search, prop;
- //
- vendors.unshift( '' );
-
- function findVenderPrefix( prop ){
- var v, i = vendors.length;
- vendor = null;
- for( ; i; ){
- v = vendors[ --i ];
- if( testStyle[ v + prop ] !== undefined ){
- vendor = v;
- return v + prop;
- };
- };
- };
-
+ 'userSelect,touchAction,touchCallout,contentZooming,userDrag,tapHighlightColor' ).split( ',' ),
+ vendor, i, search, prop, j, v;
+
for( i = searches.length; i; ){
- search = searches[ --i ];
- prop = findVenderPrefix( search );
- if( search === 'transform' ) ret.transVender = vendor;
- if( prop ) ret[ search ] = prop;
+ search = prop = searches[ --i ];
+
+ if( testStyle[ prop ] === undefined ){
+ prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 );
+ for( j = vendors.length; j; ){
+ v = vendors[ --j ];
+ if( testStyle[ v + prop ] !== undefined ){
+ ret[ search ] = v + prop;
+ break;
+ };
+ };
+ } else {
+ ret[ search ] = prop;
+ };
};
return ret;
})();
X.Dom.Style.SPECIAL_FIX_PROP =
// ~IE8
- X.UA.IE && X.UA.IE < 9 && !X.UA.MacIE ?
+ X.UA.IE < 9 && !X.UA.MacIE ?
{
filter : 1,
opacity : 2//, uinode ChromeNode で行う
//backgroundImage : 5
} :
// IE9
- X.UA.IE && 9 <= X.UA.IE && X.UA.IE < 10 ?
+ 9 <= X.UA.IE && X.UA.IE < 10 ?
{
filter : 1//,
//textShadow : 1