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

📄 wizard.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 2 页
字号:
/* * $Id: wizard.js 6802 2007-03-30 08:13:07Z slip $ * The Zapatec DHTML Calendar * * Copyright (c) 2004-2006 by Zapatec, Inc. * http://www.zapatec.com * 1700 MLK Way, Berkeley, California, * 94709, U.S.A. * All rights reserved. * * * The Calendar Wizard. Collects preferences from the * user, creates a calendar, and generates the code. */var wiz_path = Zapatec.getPath();var utils = Zapatec.Utils;var format_activeField = null;var a_tabs = [];var flat_calendar;var wizard_address = document.URL;var factory_formats = [ "%A, %B %d, %Y",			"%a, %b %d, %Y",			"%B %Y",			"Day %j of year %Y (week %W)",			"%Y/%m/%d",			"%Y/%m/%d %I:%M %P",			"%d-%m-%Y %H:%M"];function initWizard() {	var i = 0, el;	while (el = document.getElementById("tooltip-" + ++i))		utils.addTooltip(el, "tooltip-" + i + "-text");	initTabs();	setSize('');	format_activeField = document.getElementById("f_prop_ifFormat");// 	var tables = document.getElementsByTagName("table"), i = 0, t;// 	while (t = tables[i++]) {// 		if (/form/i.test(t.className)) {// 			var trs = t.getElementsByTagName("tr");// 			for (var j = trs.length; --j >= 0;)// 				addHoverEvents(trs[j]);// 		}// 	}// 	var slashLoc = wizard_address.lastIndexOf('/');// 	var dotLoc = wizard_address.lastIndexOf('.');// 	if (dotLoc > slashLoc) {// 		wizard_address = wizard_address.substr(0, slashLoc);// 	}	wizard_address = wizard_address.replace(/\/wizard\/.*/, '/');	wizard_address = wizard_address.replace(/^https?:\/\/[^\/]+/, '');	document.getElementById('f_path').value = wizard_address;	flat_calendar = new Zapatec.Calendar(1, new Date(),				     function(cal) { window.status = cal.date.print(cal.dateFormat); },				     function(cal) {});	flat_calendar.noGrab = true;	flat_calendar.create();	flat_calendar.showAtElement(document.getElementById("calendar-anchor").firstChild, "Tl");	flat_calendar.onFDOW = onFDOW;	flat_calendar.onFDOW();	initFactoryFormats();};function initFactoryFormats() {	var factory = ["f_prop_ifFormat-factory", "f_prop_daFormat-factory"];	var date = new Date();	for (var i = factory.length; --i >= 0;) {		var id = factory[i];		var sel = document.getElementById(id);		while (sel.options[1])			sel.remove(1);		for (var j = 0; j < factory_formats.length; ++j) {			var format = factory_formats[j];			var o = document.createElement("option");			o.innerHTML = date.print(format);			o.value = format;			sel.appendChild(o);		}	}};function addHoverEvents(el) {	el.onmouseover = HE_onMouseOver;	el.onmouseout = HE_onMouseOut;};function HE_onMouseOver(ev) {	ev || (ev = window.event);	if (!utils.isRelated(this, ev))		utils.addClass(this, "hover");};function HE_onMouseOut(ev) {	ev || (ev = window.event);	if (!utils(this, ev))		utils.removeClass(this, "hover");};function onFDOW(fdow) {	if (typeof fdow == "undefined")		fdow = this.firstDayOfWeek;	var sel = document.getElementById("f_prop_firstDayOfWeek");	utils.selectOption(sel, fdow);};function initTabs() {	var bar = document.getElementById("tab-bar");	var tabs = document.getElementById("tabs");	tabs.style.display = 'block';	var tmp;	var current = null;	for (var i = tabs.firstChild; i; i = i.nextSibling) {		if (i.nodeType != 1)			continue;		a_tabs[a_tabs.length] = (tmp = utils.createElement("a", bar));		//tmp.id = tmp.href = "#pane-" + a_tabs.length;		tmp.href = "#";		tmp.innerHTML = "<u>" + (a_tabs.length) + "</u>. <span class='bullet'>»</span>";		tmp.accessKey = "" + (a_tabs.length);		tmp.theSpan = i.firstChild;		tmp.theSpan.action = tmp.theSpan.onclick;		tmp.theSpan.onclick = "";		tmp.appendChild(i.firstChild);		if (!/hide/.test(i.className))			(current = tmp).className = "active";		tmp.onclick = changeTab;		tmp.__msh_tab = i;		// check if it has advanced stuff		var cl = tmp.theSpan.className;		if (/([^\s]+-advanced-)(.*)/.test(cl)) {			tmp.hasAdvanced = true;			tmp.advanced_id_prefix = RegExp.$1;			tmp.advanced_id_suffix = RegExp.$2.split(/-/);			tmp.advanced = false;		} else			tmp.hasAdvanced = false;	}	if (current)		current.onclick();};function changeTab() {	var i = 0, tab;	while (tab = a_tabs[i++]) {		utils.removeClass(tab, "active");		if (tab === this)			tab.__msh_tab.style.display = "block";		else			tab.__msh_tab.style.display = "none";	}	utils.addClass(this, "active");	document.getElementById("b_prev").disabled = !this.previousSibling;	document.getElementById("b_next").disabled = !this.nextSibling;	if (typeof this.theSpan.action == "function")		this.theSpan.action();	else if (typeof this.theSpan.action == "string")		eval(this.theSpan.action);	updateAdvanced(this);	this.blur();	return false;};function getCurrentTab() {	var tab = null;	for (var i = a_tabs.length; --i >= 0;) {		tab = a_tabs[i];		if (/active/.test(tab.className))			break;	}	return tab;};function nextTab() {	var tab = getCurrentTab();	if (tab && tab.nextSibling)		tab.nextSibling.onclick();};function prevTab() {	var tab = getCurrentTab();	if (tab && tab.previousSibling)		tab.previousSibling.onclick();};function setActiveTheme(sel) {	var i = 0, o, a = sel.options, l;	while (o = a[i++]) {		l = document.getElementById("theme-" + o.value);		if (l)			l.disabled = true;	}	l = document.getElementById("theme-" + sel.value);	if (l)		l.disabled = false;};function setSize(val) {	var i = 0, el, actual = false;	if (val)		val = new RegExp("" + val + ".css$");	while (el = document.getElementById('theme-size-' + ++i)) {		el.disabled = true;		if (val && val.test(el.href))			actual = el;	}	if (actual)		actual.disabled = false;};function selectChange(sel) {	switch (sel.id) {	    case "f_theme":		setActiveTheme(sel);		break;	    case "f_language":		Zapatec.Calendar._TT = Zapatec.Calendar["_TT_" + sel.value];		Zapatec.Calendar._initSDN();		flat_calendar.refresh();		initFactoryFormats();		break;	}};function propChange(el) {	switch (el.id) {		case "f_prop_showsTime":			flat_calendar.showsTime = el.checked;		document.getElementById("timeprops1").style.visibility = el.checked ? "visible" : "hidden";		document.getElementById("timeprops2").style.visibility = el.checked ? "visible" : "hidden";		break;		case "f_prop_timeFormat":			flat_calendar.time24 = el.value == "24";		break;		case "f_prop_firstDayOfWeek":			flat_calendar.setFirstDayOfWeek(parseInt(el.value, 10));		return;		// no need to refresh		case "f_prop_weekNumbers":			flat_calendar.weekNumbers = el.checked;		break;		case "f_prop_showOthers":			flat_calendar.showsOtherMonths = el.checked;		break;		case "f_prop_yearStep":			flat_calendar.yearStep = parseInt(el.value, 10);		return;		// no need to refresh		case "f_prop_timeInterval":			flat_calendar.timeInterval = parseInt(el.value, 10) || null;		break;		//multiple months related variables		case "f_prop_numberMonths":			flat_calendar.numberMonths= parseInt(el.value, 10);			//check that controlmonth is not bigger than numberMonths			if (flat_calendar.controlMonth > flat_calendar.numberMonths) {				  //If it is, set it to last month					flat_calendar.controlMonth = flat_calendar.numberMonths;					document.getElementById("f_prop_controlMonth").value = flat_calendar.controlMonth;			}		var monthsInRow = parseInt(document.getElementById("f_prop_monthsInRow").value, 10);		if (isNaN(monthsInRow)) {//It's blank			flat_calendar.monthsInRow = flat_calendar.numberMonths;		}		if (flat_calendar.monthsInRow > flat_calendar.numberMonths) {				flat_calendar.monthsInRow = flat_calendar.numberMonths;				document.getElementById("f_prop_monthsInRow").value = flat_calendar.monthsInRow;		}		break;		case "f_prop_controlMonth":			flat_calendar.controlMonth= parseInt(el.value, 10);			//check that controlmonth is not bigger than numberMonths			if (flat_calendar.controlMonth > flat_calendar.numberMonths) {				  //If it is, set it to last month					alert("Control month can't be larger than number of months");					flat_calendar.controlMonth = flat_calendar.numberMonths;					document.getElementById("f_prop_controlMonth").value = flat_calendar.controlMonth;			}		break;		case "f_prop_monthsInRow":			var monthsInRow = parseInt(el.value, 10);		if (isNaN(monthsInRow)) {//It's blank			monthsInRow = flat_calendar.numberMonths;		}		flat_calendar.monthsInRow= monthsInRow;		if (flat_calendar.monthsInRow > flat_calendar.numberMonths) {		alert("Months In a Row can't be larger than number of months");		flat_calendar.monthsInRow = flat_calendar.numberMonths;		document.getElementById("f_prop_monthsInRow").value = flat_calendar.monthsInRow;		}		break;		case "f_prop_vertical":			flat_calendar.vertical = el.checked;		break;	}	flat_calendar.refresh();};function format_setActiveField(input) {	format_activeField = input;};function tokenClicked(link, token) {	var v = format_activeField.value;	if (/\b$/.test(v))		v += " ";	v += token;	format_activeField.value = v;	link.blur();	format_activeField.focus();	format_updateTests();	return false;};function clear_field(el) {	if (typeof el == "string")		el = document.getElementById(el);	el.value = '';	el.focus();};function radioTabChange(r) {	var tabs_id = "tab-" + r.name;	var id = r.name + "-" + r.value;	var tabs = document.getElementById(tabs_id);	for (var i = tabs.firstChild; i; i = i.nextSibling) {		if (i.nodeType != 1)			continue;		i.style.display = i.id == id ? "block" : "none";	}};function testAlign(btn) {	function H(cal) { cal.destroy(); };	var cal = new Zapatec.Calendar(1, new Date(), H, H);	cal.create();	var align = document.getElementById("f_prop_valign").value + document.getElementById("f_prop_halign").value;	cal.showAtElement(btn, align);

⌨️ 快捷键说明

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