Add JS files
This commit is contained in:
49
jssource/src_files/include/ytree/TreeView/anim/TVAnim.js
Executable file
49
jssource/src_files/include/ytree/TreeView/anim/TVAnim.js
Executable file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* A static factory class for tree view expand/collapse animations
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
YAHOO.widget.TVAnim = new function() {
|
||||
/**
|
||||
* Constant for the fade in animation
|
||||
*
|
||||
* @type string
|
||||
*/
|
||||
this.FADE_IN = "YAHOO.widget.TVFadeIn";
|
||||
|
||||
/**
|
||||
* Constant for the fade out animation
|
||||
*
|
||||
* @type string
|
||||
*/
|
||||
this.FADE_OUT = "YAHOO.widget.TVFadeOut";
|
||||
|
||||
/**
|
||||
* Returns a ygAnim instance of the given type
|
||||
*
|
||||
* @param type {string} the type of animation
|
||||
* @param el {HTMLElement} the element to element (probably the children div)
|
||||
* @param callback {function} function to invoke when the animation is done.
|
||||
* @return {YAHOO.util.Animation} the animation instance
|
||||
*/
|
||||
this.getAnim = function(type, el, callback) {
|
||||
switch (type) {
|
||||
case this.FADE_IN: return new YAHOO.widget.TVFadeIn(el, callback);
|
||||
case this.FADE_OUT: return new YAHOO.widget.TVFadeOut(el, callback);
|
||||
default: return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the specified animation class is available
|
||||
*
|
||||
* @param type {string} the type of animation
|
||||
* @return {boolean} true if valid, false if not
|
||||
*/
|
||||
this.isValid = function(type) {
|
||||
return ( "undefined" != eval("typeof " + type) );
|
||||
};
|
||||
};
|
||||
|
||||
62
jssource/src_files/include/ytree/TreeView/anim/TVFadeIn.js
Executable file
62
jssource/src_files/include/ytree/TreeView/anim/TVFadeIn.js
Executable file
@@ -0,0 +1,62 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* A 1/2 second fade-in animation.
|
||||
*
|
||||
* @constructor
|
||||
* @param el {HTMLElement} the element to animate
|
||||
* @param callback {function} function to invoke when the animation is finished
|
||||
*/
|
||||
YAHOO.widget.TVFadeIn = function(el, callback) {
|
||||
/**
|
||||
* The element to animate
|
||||
* @type HTMLElement
|
||||
*/
|
||||
this.el = el;
|
||||
|
||||
/**
|
||||
* the callback to invoke when the animation is complete
|
||||
*
|
||||
* @type function
|
||||
*/
|
||||
this.callback = callback;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.logger = new ygLogger("TVFadeIn");
|
||||
};
|
||||
|
||||
/**
|
||||
* Performs the animation
|
||||
*/
|
||||
YAHOO.widget.TVFadeIn.prototype = {
|
||||
animate: function() {
|
||||
var tvanim = this;
|
||||
|
||||
var s = this.el.style;
|
||||
s.opacity = 0.1;
|
||||
s.filter = "alpha(opacity=10)";
|
||||
s.display = "";
|
||||
|
||||
// var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
|
||||
var dur = 0.4;
|
||||
// this.logger.debug("duration: " + dur);
|
||||
// var a = new ygAnim_Fade(this.el, dur, 1);
|
||||
// a.setStart(0.1);
|
||||
// a.onComplete = function() { tvanim.onComplete(); };
|
||||
|
||||
// var a = new YAHOO.util.Anim(this.el, 'opacity', 0.1, 1);
|
||||
var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
|
||||
a.onComplete.subscribe( function() { tvanim.onComplete(); } );
|
||||
a.animate();
|
||||
},
|
||||
|
||||
/**
|
||||
* Clean up and invoke callback
|
||||
*/
|
||||
onComplete: function() {
|
||||
this.callback();
|
||||
}
|
||||
};
|
||||
|
||||
59
jssource/src_files/include/ytree/TreeView/anim/TVFadeOut.js
Executable file
59
jssource/src_files/include/ytree/TreeView/anim/TVFadeOut.js
Executable file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* A 1/2 second fade out animation.
|
||||
*
|
||||
* @constructor
|
||||
* @param el {HTMLElement} the element to animate
|
||||
* @param callback {Function} function to invoke when the animation is finished
|
||||
*/
|
||||
YAHOO.widget.TVFadeOut = function(el, callback) {
|
||||
/**
|
||||
* The element to animate
|
||||
* @type HTMLElement
|
||||
*/
|
||||
this.el = el;
|
||||
|
||||
/**
|
||||
* the callback to invoke when the animation is complete
|
||||
*
|
||||
* @type function
|
||||
*/
|
||||
this.callback = callback;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.logger = new ygLogger("TVFadeOut");
|
||||
};
|
||||
|
||||
/**
|
||||
* Performs the animation
|
||||
*/
|
||||
YAHOO.widget.TVFadeOut.prototype = {
|
||||
animate: function() {
|
||||
var tvanim = this;
|
||||
// var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
|
||||
var dur = 0.4;
|
||||
// this.logger.debug("duration: " + dur);
|
||||
// var a = new ygAnim_Fade(this.el, dur, 0.1);
|
||||
// a.onComplete = function() { tvanim.onComplete(); };
|
||||
|
||||
// var a = new YAHOO.util.Anim(this.el, 'opacity', 1, 0.1);
|
||||
var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
|
||||
a.onComplete.subscribe( function() { tvanim.onComplete(); } );
|
||||
a.animate();
|
||||
},
|
||||
|
||||
/**
|
||||
* Clean up and invoke callback
|
||||
*/
|
||||
onComplete: function() {
|
||||
var s = this.el.style;
|
||||
s.display = "none";
|
||||
// s.opacity = 1;
|
||||
s.filter = "alpha(opacity=100)";
|
||||
this.callback();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user