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

📄 calendar-debug.js

📁 国外的人才求职招聘最新版
💻 JS
📖 第 1 页 / 共 5 页
字号:
	* The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.	* @property id	* @type String	*/	id : null,	/**	* The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.	* @property oDomContainer	* @type HTMLElement	*/	oDomContainer : null,	/**	* A Date object representing today's date.	* @property today	* @type Date	*/	today : null,	/**	* The list of render functions, along with required parameters, used to render cells. 	* @property renderStack	* @type Array[]	*/	renderStack : null,	/**	* A copy of the initial render functions created before rendering.	* @property _renderStack	* @private	* @type Array	*/	_renderStack : null,	/**	* The private list of initially selected dates.	* @property _selectedDates	* @private	* @type Array	*/	_selectedDates : null,	/**	* A map of DOM event handlers to attach to cells associated with specific CSS class names	* @property domEventMap	* @type Object	*/	domEventMap : null};/*** Initializes the Calendar widget.* @method init* @param {String}	id			The id of the table element that will represent the calendar widget* @param {String}	containerId	The id of the container div element that will wrap the calendar table* @param {Object}	config		The configuration object containing the Calendar's arguments*/YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {	this.logger = new YAHOO.widget.LogWriter("Calendar " + id);	this.initEvents();	this.today = new Date();	YAHOO.widget.DateMath.clearTime(this.today);	this.id = id;	this.oDomContainer = document.getElementById(containerId);	if (! this.oDomContainer) { this.logger.log("No valid container present.", "error"); }	/**	* The Config object used to hold the configuration variables for the Calendar	* @property cfg	* @type YAHOO.util.Config	*/	this.cfg = new YAHOO.util.Config(this);		/**	* The local object which contains the Calendar's options	* @property Options	* @type Object	*/	this.Options = {};	/**	* The local object which contains the Calendar's locale settings	* @property Locale	* @type Object	*/	this.Locale = {};	this.initStyles();	YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);		YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);		this.cellDates = [];	this.cells = [];	this.renderStack = [];	this._renderStack = [];	this.setupConfig();		if (config) {		this.cfg.applyConfig(config, true);	}		this.cfg.fireQueue();};/*** Default Config listener for the iframe property. If the iframe config property is set to true, * renders the built-in IFRAME shim if the container is relatively or absolutely positioned.* * @method configIframe*/YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {	var useIframe = args[0];	if (!this.parent) {		if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {			if (useIframe) {				var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");								if (pos == "absolute" || pos == "relative") {										if (!YAHOO.util.Dom.inDocument(this.iframe)) {						this.iframe = document.createElement("iframe");						this.iframe.src = "javascript:false;";						YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");						if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {							YAHOO.util.Dom.addClass(this.iframe, "fixedsize");						}						this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);					}				}			} else {				if (this.iframe) {					if (this.iframe.parentNode) {						this.iframe.parentNode.removeChild(this.iframe);					}					this.iframe = null;				}			}		}	}};/*** Default handler for the "title" property* @method configTitle*/YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {	var title = args[0];	var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);		var titleDiv;	if (title && title !== "") {		titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");		titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;		titleDiv.innerHTML = title;		this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);		YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");	} else {		titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;		if (titleDiv) {			YAHOO.util.Event.purgeElement(titleDiv);			this.oDomContainer.removeChild(titleDiv);		}		if (! close) {			YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");		}	}};/*** Default handler for the "close" property* @method configClose*/YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {	var close = args[0];	var title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);		var DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";	var linkClose;	if (close === true) {		linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");		linkClose.href = "#";		linkClose.className = "link-close";		YAHOO.util.Event.addListener(linkClose, "click", function(e, cal) {cal.hide(); YAHOO.util.Event.preventDefault(e); }, this);				if (YAHOO.widget.Calendar.IMG_ROOT !== null) {			var imgClose = document.createElement("img");			imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;			imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;			linkClose.appendChild(imgClose);		} else {			linkClose.innerHTML = '<span class="' + YAHOO.widget.CalendarGroup.CSS_2UPCLOSE + ' ' + this.Style.CSS_CLOSE + '"></span>';		}				this.oDomContainer.appendChild(linkClose);		YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");	} else {		linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;		if (linkClose) {			YAHOO.util.Event.purgeElement(linkClose);			this.oDomContainer.removeChild(linkClose);		}		if (! title || title === "") {			YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");		}	}};/*** Initializes Calendar's built-in CustomEvents* @method initEvents*/YAHOO.widget.Calendar.prototype.initEvents = function() {	var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;	/**	* Fired before a selection is made	* @event beforeSelectEvent	*/	this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT); 	/**	* Fired when a selection is made	* @event selectEvent	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].	*/	this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);	/**	* Fired before a selection is made	* @event beforeDeselectEvent	*/	this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);	/**	* Fired when a selection is made	* @event deselectEvent	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].	*/	this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);	/**	* Fired when the Calendar page is changed	* @event changePageEvent	*/	this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);	/**	* Fired before the Calendar is rendered	* @event beforeRenderEvent	*/	this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);	/**	* Fired when the Calendar is rendered	* @event renderEvent	*/	this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);	/**	* Fired when the Calendar is reset	* @event resetEvent	*/	this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);	/**	* Fired when the Calendar is cleared	* @event clearEvent	*/	this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);	this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);	this.selectEvent.subscribe(this.onSelect, this, true);	this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);	this.deselectEvent.subscribe(this.onDeselect, this, true);	this.changePageEvent.subscribe(this.onChangePage, this, true);	this.renderEvent.subscribe(this.onRender, this, true);	this.resetEvent.subscribe(this.onReset, this, true);	this.clearEvent.subscribe(this.onClear, this, true);};/*** The default event function that is attached to a date link within a calendar cell* when the calendar is rendered.* @method doSelectCell* @param {DOMEvent} e	The event* @param {Calendar} cal	A reference to the calendar passed by the Event utility*/YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {	var cell,index,d,date;	var target = YAHOO.util.Event.getTarget(e);	var tagName = target.tagName.toLowerCase();	var defSelector = false;	while (tagName != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {		if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {			defSelector = true;			}		target = target.parentNode;		tagName = target.tagName.toLowerCase(); 		if (tagName == "html") {			return;		}	}	if (defSelector) {		// Stop link href navigation for default renderer		YAHOO.util.Event.preventDefault(e);	}	cell = target;	if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {		index = cell.id.split("cell")[1];		d = cal.cellDates[index];		date = new Date(d[0],d[1]-1,d[2]);			var link;		cal.logger.log("Selecting cell " + index + " via click", "info");		if (cal.Options.MULTI_SELECT) {			link = cell.getElementsByTagName("a")[0];			if (link) {				link.blur();			}			var cellDate = cal.cellDates[index];			var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);			if (cellDateIndex > -1) {					cal.deselectCell(index);			} else {				cal.selectCell(index);			}			} else {			link = cell.getElementsByTagName("a")[0];			if (link) {				link.blur();			}			cal.selectCell(index);		}	}};/*** The event that is executed when the user hovers over a cell* @method doCellMouseOver* @param {DOMEvent} e	The event* @param {Calendar} cal	A reference to the calendar passed by the Event utility*/YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {	var target;	if (e) {		target = YAHOO.util.Event.getTarget(e);	} else {		target = this;	}	while (target.tagName.toLowerCase() != "td") {		target = target.parentNode;		if (target.tagName.toLowerCase() == "html") {			return;		}	}	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {		YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);	}};/*** The event that is executed when the user moves the mouse out of a cell* @method doCellMouseOut* @param {DOMEvent} e	The event* @param {Calendar} cal	A reference to the calendar passed by the Event utility*/YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {	var target;	if (e) {		target = YAHOO.util.Event.getTarget(e);	} else {		target = this;	}	while (target.tagName.toLowerCase() != "td") {		target = target.parentNode;		if (target.tagName.toLowerCase() == "html") {			return;		}	}	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {		YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);	}};YAHOO.widget.Calendar.prototype.setupConfig = function() {	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;	/**	* The month/year representing the current visible Calendar date (mm/yyyy)

⌨️ 快捷键说明

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