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

📄 dateout.js

📁 最好用的站点内容管理系统 全部源代码都有
💻 JS
📖 第 1 页 / 共 5 页
字号:
document.writeln("		}");
document.writeln("		el.calendar.tooltips.firstChild.data = el.ttip;");
document.writeln("	}");
document.writeln("	if (el.navtype != 300) {");
document.writeln("		Calendar.addClass(el, \"hilite\");");
document.writeln("		if (el.caldate) {");
document.writeln("			Calendar.addClass(el.parentNode, \"rowhilite\");");
document.writeln("		}");
document.writeln("	}");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.dayMouseOut = function(ev) {");
document.writeln("	with (Calendar) {");
document.writeln("		var el = getElement(ev);");
document.writeln("		if (isRelated(el, ev) || _C || el.disabled) {");
document.writeln("			return false;");
document.writeln("		}");
document.writeln("		removeClass(el, \"hilite\");");
document.writeln("		if (el.caldate) {");
document.writeln("			removeClass(el.parentNode, \"rowhilite\");");
document.writeln("		}");
document.writeln("		el.calendar.tooltips.firstChild.data = _TT[\"SEL_DATE\"];");
document.writeln("		return stopEvent(ev);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  A generic \"click\" handler :) handles all types of buttons defined in this");
document.writeln(" *  calendar.");
document.writeln(" *\/");
document.writeln("Calendar.cellClick = function(el) {");
document.writeln("	var cal = el.calendar;");
document.writeln("	var closing = false;");
document.writeln("	var newdate = false;");
document.writeln("	var date = null;");
document.writeln("	if (typeof el.navtype == \"undefined\") {");
document.writeln("		Calendar.removeClass(cal.currentDateEl, \"selected\");");
document.writeln("		Calendar.addClass(el, \"selected\");");
document.writeln("		closing = (cal.currentDateEl == el);");
document.writeln("		if (!closing) {");
document.writeln("			cal.currentDateEl = el;");
document.writeln("		}");
document.writeln("		cal.date.setDate(el.caldate);");
document.writeln("		date = cal.date;");
document.writeln("		newdate = true;");
document.writeln("		\/\/ a date was clicked");
document.writeln("		cal.dateClicked = true;");
document.writeln("	} else {");
document.writeln("		if (el.navtype == 200) {");
document.writeln("			Calendar.removeClass(el, \"hilite\");");
document.writeln("			cal.callCloseHandler();");
document.writeln("			return;");
document.writeln("		}");
document.writeln("		date = (el.navtype == 0) ? new Date() : new Date(cal.date);");
document.writeln("		\/\/ unless \"today\" was clicked, we assume no date was clicked so");
document.writeln("		\/\/ the selected handler will know not to close the calenar when");
document.writeln("		\/\/ in single-click mode.");
document.writeln("		cal.dateClicked = (el.navtype == 0);");
document.writeln("		var year = date.getFullYear();");
document.writeln("		var mon = date.getMonth();");
document.writeln("		function setMonth(m) {");
document.writeln("			var day = date.getDate();");
document.writeln("			var max = date.getMonthDays(m);");
document.writeln("			if (day > max) {");
document.writeln("				date.setDate(max);");
document.writeln("			}");
document.writeln("			date.setMonth(m);");
document.writeln("		};");
document.writeln("		switch (el.navtype) {");
document.writeln("		    case -2:");
document.writeln("			if (year > cal.minYear) {");
document.writeln("				date.setFullYear(year - 1);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case -1:");
document.writeln("			if (mon > 0) {");
document.writeln("				setMonth(mon - 1);");
document.writeln("			} else if (year-- > cal.minYear) {");
document.writeln("				date.setFullYear(year);");
document.writeln("				setMonth(11);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 1:");
document.writeln("			if (mon < 11) {");
document.writeln("				setMonth(mon + 1);");
document.writeln("			} else if (year < cal.maxYear) {");
document.writeln("				date.setFullYear(year + 1);");
document.writeln("				setMonth(0);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 2:");
document.writeln("			if (year < cal.maxYear) {");
document.writeln("				date.setFullYear(year + 1);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 100:");
document.writeln("			cal.setMondayFirst(!cal.mondayFirst);");
document.writeln("			return;");
document.writeln("		    case 0:");
document.writeln("			\/\/ TODAY will bring us here");
document.writeln("			if ((typeof cal.checkDisabled == \"function\") && cal.checkDisabled(date)) {");
document.writeln("				\/\/ remember, \"date\" was previously set to new");
document.writeln("				\/\/ Date() if TODAY was clicked; thus, it");
document.writeln("				\/\/ contains today date.");
document.writeln("				return false;");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		}");
document.writeln("		if (!date.equalsTo(cal.date)) {");
document.writeln("			cal.setDate(date);");
document.writeln("			newdate = true;");
document.writeln("		}");
document.writeln("	}");
document.writeln("	if (newdate) {");
document.writeln("		cal.callHandler();");
document.writeln("	}");
document.writeln("	if (closing) {");
document.writeln("		Calendar.removeClass(el, \"hilite\");");
document.writeln("		cal.callCloseHandler();");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ END: CALENDAR STATIC FUNCTIONS");
document.writeln("");
document.writeln("\/\/ BEGIN: CALENDAR OBJECT FUNCTIONS");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  This function creates the calendar inside the given parent.  If _par is");
document.writeln(" *  null than it creates a popup calendar inside the BODY element.  If _par is");
document.writeln(" *  an element, be it BODY, then it creates a non-popup calendar (still");
document.writeln(" *  hidden).  Some properties need to be set before calling this function.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.create = function (_par) {");
document.writeln("	var parent = null;");
document.writeln("	if (! _par) {");
document.writeln("		\/\/ default parent is the document body, in which case we create");
document.writeln("		\/\/ a popup calendar.");
document.writeln("		parent = document.getElementsByTagName(\"body\")[0];");
document.writeln("		this.isPopup = true;");
document.writeln("	} else {");
document.writeln("		parent = _par;");
document.writeln("		this.isPopup = false;");
document.writeln("	}");
document.writeln("	this.date = this.dateStr ? new Date(this.dateStr) : new Date();");
document.writeln("");
document.writeln("	var table = Calendar.createElement(\"table\");");
document.writeln("	this.table = table;");
document.writeln("	table.cellSpacing = 0;");
document.writeln("	table.cellPadding = 0;");
document.writeln("	table.calendar = this;");
document.writeln("	Calendar.addEvent(table, \"mousedown\", Calendar.tableMouseDown);");
document.writeln("");
document.writeln("	var div = Calendar.createElement(\"div\");");
document.writeln("	this.element = div;");
document.writeln("	div.className = \"calendar\";");
document.writeln("	if (this.isPopup) {");
document.writeln("		div.style.position = \"absolute\";");
document.writeln("		div.style.display = \"none\";");
document.writeln("	}");
document.writeln("	div.appendChild(table);");
document.writeln("");
document.writeln("	var thead = Calendar.createElement(\"thead\", table);");
document.writeln("	var cell = null;");
document.writeln("	var row = null;");
document.writeln("");
document.writeln("	var cal = this;");
document.writeln("	var hh = function (text, cs, navtype) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.colSpan = cs;");
document.writeln("		cell.className = \"button\";");
document.writeln("		Calendar._add_evs(cell);");
document.writeln("		cell.calendar = cal;");
document.writeln("		cell.navtype = navtype;");
document.writeln("		if (text.substr(0, 1) != \"&\") {");
document.writeln("			cell.appendChild(document.createTextNode(text));");
document.writeln("		}");
document.writeln("		else {");
document.writeln("			\/\/ FIXME: dirty hack for entities");
document.writeln("			cell.innerHTML = text;");
document.writeln("		}");
document.writeln("		return cell;");
document.writeln("	};");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	var title_length = 6;");
document.writeln("	(this.isPopup) && --title_length;");
document.writeln("	(this.weekNumbers) && ++title_length;");
document.writeln("");
document.writeln("	hh(\"-\", 1, 100).ttip = Calendar._TT[\"TOGGLE\"];");
document.writeln("	this.title = hh(\"\", title_length, 300);");
document.writeln("	this.title.className = \"title\";");
document.writeln("	if (this.isPopup) {");
document.writeln("		this.title.ttip = Calendar._TT[\"DRAG_TO_MOVE\"];");
document.writeln("		this.title.style.cursor = \"move\";");
document.writeln("		hh(\"&#x00d7;\", 1, 200).ttip = Calendar._TT[\"CLOSE\"];");
document.writeln("	}");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	row.className = \"headrow\";");
document.writeln("");
document.writeln("	this._nav_py = hh(\"&#x00ab;\", 1, -2);");
document.writeln("	this._nav_py.ttip = Calendar._TT[\"PREV_YEAR\"];");
document.writeln("");
document.writeln("	this._nav_pm = hh(\"&#x2039;\", 1, -1);");
document.writeln("	this._nav_pm.ttip = Calendar._TT[\"PREV_MONTH\"];");
document.writeln("");
document.writeln("	this._nav_now = hh(Calendar._TT[\"TODAY\"], this.weekNumbers ? 4 : 3, 0);");
document.writeln("	this._nav_now.ttip = Calendar._TT[\"GO_TODAY\"];");
document.writeln("");
document.writeln("	this._nav_nm = hh(\"&#x203a;\", 1, 1);");
document.writeln("	this._nav_nm.ttip = Calendar._TT[\"NEXT_MONTH\"];");
document.writeln("");
document.writeln("	this._nav_ny = hh(\"&#x00bb;\", 1, 2);");
document.writeln("	this._nav_ny.ttip = Calendar._TT[\"NEXT_YEAR\"];");
document.writeln("");
document.writeln("	\/\/ day names");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	row.className = \"daynames\";");
document.writeln("	if (this.weekNumbers) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.className = \"name wn\";");
document.writeln("		cell.appendChild(document.createTextNode(Calendar._TT[\"WK\"]));");
document.writeln("	}");
document.writeln("	for (var i = 7; i > 0; --i) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.appendChild(document.createTextNode(\"\"));");
document.writeln("		if (!i) {");
document.writeln("			cell.navtype = 100;");
document.writeln("			cell.calendar = this;");
document.writeln("			Calendar._add_evs(cell);");
document.writeln("		}");
document.writeln("	}");
document.writeln("	this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;");
document.writeln("	this._displayWeekdays();");
document.writeln("");
document.writeln("	var tbody = Calendar.createElement(\"tbody\", table);");
document.writeln("	this.tbody = tbody;");
document.writeln("");
document.writeln("	for (i = 6; i > 0; --i) {");
document.writeln("		row = Calendar.createElement(\"tr\", tbody);");
document.writeln("		if (this.weekNumbers) {");
document.writeln("			cell = Calendar.createElement(\"td\", row);");
document.writeln("			cell.appendChild(document.createTextNode(\"\"));");
document.writeln("		}");
document.writeln("		for (var j = 7; j > 0; --j) {");
document.writeln("			cell = Calendar.createElement(\"td\", row);");
document.writeln("			cell.appendChild(document.createTextNode(\"\"));");
document.writeln("			cell.calendar = this;");
document.writeln("			Calendar._add_evs(cell);");
document.writeln("		}");
document.writeln("	}");
document.writeln("");
document.writeln("	var tfoot = Calendar.createElement(\"tfoot\", table);");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", tfoot);");

⌨️ 快捷键说明

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