⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendar.js

📁 国外的人才求职招聘最新版
💻 JS
📖 第 1 页 / 共 5 页
字号:
        * Fires the event for a property using the property's current value.        * @method refireEvent        * @param {String} key The name of the property        */        refireEvent: function (key) {            key = key.toLowerCase();            var property = this.config[key];            if (property && property.event &&                !Lang.isUndefined(property.value)) {                if (this.queueInProgress) {                    this.queueProperty(key);                } else {                    this.fireEvent(key, property.value);                }            }        },        /**        * Applies a key-value Object literal to the configuration, replacing        * any existing values, and queueing the property events.        * Although the values will be set, fireQueue() must be called for their        * associated events to execute.        * @method applyConfig        * @param {Object} userConfig The configuration Object literal        * @param {Boolean} init  When set to true, the initialConfig will        * be set to the userConfig passed in, so that calling a reset will        * reset the properties to the passed values.        */        applyConfig: function (userConfig, init) {            var prop;            if (init) {                this.initialConfig = userConfig;            }            for (prop in userConfig) {                this.queueProperty(prop, userConfig[prop]);            }        },        /**        * Refires the events for all configuration properties using their        * current values.        * @method refresh        */        refresh: function () {            var prop;            for (prop in this.config) {                this.refireEvent(prop);            }        },        /**        * Fires the normalized list of queued property change events        * @method fireQueue        */        fireQueue: function () {            var i,                queueItem,                key,                value,                property;            this.queueInProgress = true;            for (i = 0;i < this.eventQueue.length; i++) {                queueItem = this.eventQueue[i];                if (queueItem) {                    key = queueItem[0];                    value = queueItem[1];                    property = this.config[key];                    property.value = value;                    this.fireEvent(key,value);                }            }            this.queueInProgress = false;            this.eventQueue = [];        },        /**        * Subscribes an external handler to the change event for any        * given property.        * @method subscribeToConfigEvent        * @param {String} key The property name        * @param {Function} handler The handler function to use subscribe to        * the property's event        * @param {Object} obj The Object to use for scoping the event handler        * (see CustomEvent documentation)        * @param {Boolean} override Optional. If true, will override "this"        * within the handler to map to the scope Object passed into the method.        * @return {Boolean} True, if the subscription was successful,        * otherwise false.        */        subscribeToConfigEvent: function (key, handler, obj, override) {            var property = this.config[key.toLowerCase()];            if (property && property.event) {                if (!Config.alreadySubscribed(property.event, handler, obj)) {                    property.event.subscribe(handler, obj, override);                }                return true;            } else {                return false;            }        },        /**        * Unsubscribes an external handler from the change event for any        * given property.        * @method unsubscribeFromConfigEvent        * @param {String} key The property name        * @param {Function} handler The handler function to use subscribe to        * the property's event        * @param {Object} obj The Object to use for scoping the event        * handler (see CustomEvent documentation)        * @return {Boolean} True, if the unsubscription was successful,        * otherwise false.        */        unsubscribeFromConfigEvent: function (key, handler, obj) {            var property = this.config[key.toLowerCase()];            if (property && property.event) {                return property.event.unsubscribe(handler, obj);            } else {                return false;            }        },        /**        * Returns a string representation of the Config object        * @method toString        * @return {String} The Config object in string format.        */        toString: function () {            var output = "Config";            if (this.owner) {                output += " [" + this.owner.toString() + "]";            }            return output;        },        /**        * Returns a string representation of the Config object's current        * CustomEvent queue        * @method outputEventQueue        * @return {String} The string list of CustomEvents currently queued        * for execution        */        outputEventQueue: function () {            var output = "",                queueItem,                q,                nQueue = this.eventQueue.length;            for (q = 0; q < nQueue; q++) {                queueItem = this.eventQueue[q];                if (queueItem) {                    output += queueItem[0] + "=" + queueItem[1] + ", ";                }            }            return output;        },        /**        * Sets all properties to null, unsubscribes all listeners from each        * property's change event and all listeners from the configChangedEvent.        * @method destroy        */        destroy: function () {            var oConfig = this.config,                sProperty,                oProperty;            for (sProperty in oConfig) {                if (Lang.hasOwnProperty(oConfig, sProperty)) {                    oProperty = oConfig[sProperty];                    oProperty.event.unsubscribeAll();                    oProperty.event = null;                }            }            this.configChangedEvent.unsubscribeAll();            this.configChangedEvent = null;            this.owner = null;            this.config = null;            this.initialConfig = null;            this.eventQueue = null;        }    };    /**    * Checks to determine if a particular function/Object pair are already    * subscribed to the specified CustomEvent    * @method YAHOO.util.Config.alreadySubscribed    * @static    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check    * the subscriptions    * @param {Function} fn The function to look for in the subscribers list    * @param {Object} obj The execution scope Object for the subscription    * @return {Boolean} true, if the function/Object pair is already subscribed    * to the CustomEvent passed in    */    Config.alreadySubscribed = function (evt, fn, obj) {        var nSubscribers = evt.subscribers.length,            subsc,            i;        if (nSubscribers > 0) {            i = nSubscribers - 1;            do {                subsc = evt.subscribers[i];                if (subsc && subsc.obj == obj && subsc.fn == fn) {                    return true;                }            }            while (i--);        }        return false;    };    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);}());/*** YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility* used for adding, subtracting, and comparing dates.* @namespace YAHOO.widget* @class DateMath*/YAHOO.widget.DateMath = {	/**	* Constant field representing Day	* @property DAY	* @static	* @final	* @type String	*/	DAY : "D",	/**	* Constant field representing Week	* @property WEEK	* @static	* @final	* @type String	*/	WEEK : "W",	/**	* Constant field representing Year	* @property YEAR	* @static	* @final	* @type String	*/	YEAR : "Y",	/**	* Constant field representing Month	* @property MONTH	* @static	* @final	* @type String	*/	MONTH : "M",	/**	* Constant field representing one day, in milliseconds	* @property ONE_DAY_MS	* @static	* @final	* @type Number	*/	ONE_DAY_MS : 1000*60*60*24,	/**	* Adds the specified amount of time to the this instance.	* @method add	* @param {Date} date	The JavaScript Date object to perform addition on	* @param {String} field	The field constant to be used for performing addition.	* @param {Number} amount	The number of units (measured in the field constant) to add to the date.	* @return {Date} The resulting Date object	*/	add : function(date, field, amount) {		var d = new Date(date.getTime());		switch (field) {			case this.MONTH:				var newMonth = date.getMonth() + amount;				var years = 0;				if (newMonth < 0) {					while (newMonth < 0) {						newMonth += 12;						years -= 1;					}				} else if (newMonth > 11) {					while (newMonth > 11) {						newMonth -= 12;						years += 1;					}				}				d.setMonth(newMonth);				d.setFullYear(date.getFullYear() + years);				break;			case this.DAY:				d.setDate(date.getDate() + amount);				break;			case this.YEAR:				d.setFullYear(date.getFullYear() + amount);				break;			case this.WEEK:				d.setDate(date.getDate() + (amount * 7));				break;		}		return d;	},	/**	* Subtracts the specified amount of time from the this instance.	* @method subtract	* @param {Date} date	The JavaScript Date object to perform subtraction on	* @param {Number} field	The this field constant to be used for performing subtraction.	* @param {Number} amount	The number of units (measured in the field constant) to subtract from the date.	* @return {Date} The resulting Date object	*/	subtract : function(date, field, amount) {		return this.add(date, field, (amount*-1));	},	/**	* Determines whether a given date is before another date on the calendar.	* @method before	* @param {Date} date		The Date object to compare with the compare argument	* @param {Date} compareTo	The Date object to use for the comparison	* @return {Boolean} true if the date occurs before the compared date; false if not.	*/	before : function(date, compareTo) {		var ms = compareTo.getTime();		if (date.getTime() < ms) {			return true;		} else {			return false;		}	},	/**	* Determines whether a given date is after another date on the calendar.	* @method after	* @param {Date} date		The Date object to compare with the compare argument	* @param {Date} compareTo	The Date object to use for the comparison	* @return {Boolean} true if the date occurs after the compared date; false if not.	*/	after : function(date, compareTo) {		var ms = compareTo.getTime();		if (date.getTime() > ms) {			return true;		} else {			return false;		}	},	/**	* Determines whether a given date is between two other dates on the calendar.	* @method between	* @param {Date} date		The date to check for	* @param {Date} dateBegin	The start of the range	* @param {Date} dateEnd		The end of the range	* @return {Boolean} true if the date occurs between the compared dates; false if not.	*/	between : function(date, dateBegin, dateEnd) {		if (this.after(date, dateBegin) && this.before(date, dateEnd)) {			return true;		} else {			return false;		}	},	/**	* Retrieves a JavaScript Date object representing January 1 of any given year.	* @method getJan1	* @param {Number} calendarYear		The calendar year for which to retrieve January 1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -