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

📄 wizard.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 2 页
字号:
};function makeConfigObj() {	window.calendarConfig = {		lang              : document.getElementById("f_language").value,		theme             : document.getElementById("f_theme").value,		size              : document.getElementById("f_size").value,		// generic		firstDay          : document.getElementById("f_prop_firstDayOfWeek").value,		weekNumbers       : document.getElementById("f_prop_weekNumbers").checked,		showOthers        : document.getElementById("f_prop_showOthers").checked,		showsTime         : document.getElementById("f_prop_showsTime").checked,		timeFormat        : document.getElementById("f_prop_timeFormat").value,		step              : document.getElementById("f_prop_yearStep").value,		electric          : document.getElementById("f_prop_electric").checked,		range             : ( document.getElementById("f_prop_rangeLeft").value + '.' +				      document.getElementById("f_prop_rangeLeft_Month").value + ', ' +				      document.getElementById("f_prop_rangeRight").value + '.' +				      document.getElementById("f_prop_rangeRight_Month").value ),		ifFormat          : document.getElementById("f_prop_ifFormat").value,		daFormat          : document.getElementById("f_prop_daFormat").value,		singleClick       : !document.getElementById("f_prop_dblclick").checked,		timeInterval       : document.getElementById("f_prop_timeInterval").value,		// popup calendars		inputField        : document.getElementById("f_prop_inputField").value,		displayArea       : document.getElementById("f_prop_displayArea").value,		button            : document.getElementById("f_prop_button").value,		align             : ( document.getElementById("f_prop_valign").value +				      document.getElementById("f_prop_halign").value ),		// Multiple months		numberMonths             : document.getElementById("f_prop_numberMonths").value,		controlMonth             : document.getElementById("f_prop_controlMonth").value,		monthsInRow             : document.getElementById("f_prop_monthsInRow").value,		vertical             : document.getElementById("f_prop_vertical").checked,		// flat calendars		flat              : document.getElementById("f_prop_flat").value,		flatCallback      : document.getElementById("f_prop_flatCallback").value	};	return window.calendarConfig;}function makeCode(test) {	var c = makeConfigObj();	var html = "<html>\n";	var path = test ? wizard_address : document.getElementById('f_path').value;	path = path.replace(/\/*$/, '/');	function comment(txt) {		html += "<!-- " + txt + " -->\n";	};	html += "  <head>\n\n";	comment("UTF-8 is the recommended encoding for your pages");	html += '    <meta http-equiv="content-type" content="text/xml; charset=utf-8" />\n';	html += '    <title>Zapatec DHTML Calendar</title>\n\n';	comment("Loading Theme file(s)");	html += '    <link rel="stylesheet" href="' + path + 'themes/' + c.theme + '.css" />\n';	if (c.size)		html += '    <link rel="stylesheet" href="' + path + 'themes/layouts/' + c.size + '.css" />\n';	html += "\n";	comment("Loading Calendar JavaScript files");	html += '    <script type="text/javascript" src="' + path + '../utils/zapatec.js"></script>\n';	html += '    <script type="text/javascript" src="' + path + 'src/calendar.js"></script>\n';	comment("Loading language definition file");	html += '    <script type="text/javascript" src="' + path + 'lang/calendar-' + c.lang + '.js"></script>\n\n';	html += '  </head>\n';	html += '  <body>\n\n';	html += '<!-- CUT THIS LINE --><h1>Test your calendar</h1>\n';	html += '<!-- CUT THIS LINE --><blockquote>\n';	function beginScript() {		html += '    <script type="text/javascript">//<![CDATA[\n';	};	function endScript() {	html += '    //]]></script>\n';	html += '<noscript>\n';	html += '<br/>\n';	html += 'This page uses a <a href="http://www.zapatec.com/website/main/products/prod1/"> Javascript Calendar </a>, but\n';	html += 'your browser does not support Javascript. \n';	html += '<br/>\n';	html += 'Either enable Javascript in your Browser or upgrade to a newer version.\n';	html += '</noscript>\n';	};	function beginCommonCalendarSetup() {		beginScript();		html += '/* CUT THIS LINE */ window.onload = function() {\n';		html += '      Zapatec.Calendar.setup({\n';		if (c.firstDay != 0) { 			html += '        firstDay          : ' + c.firstDay + ',\n';		}		if (c.weekNumbers != true) { 			html += '        weekNumbers       : ' + c.weekNumbers + ',\n';		}		if (c.showOthers != false) { 			html += '        showOthers        : ' + c.showOthers + ',\n';		}		if (c.showsTime != false) { 			html += '        showsTime         : ' + c.showsTime + ',\n';		}		if (c.timeFormat != "24") { 			html += '        timeFormat        : "' + c.timeFormat + '",\n';		}		if (c.step != 2) { 			html += '        step              : ' + c.step + ',\n';		}		if (c.range != "1900.01, 2999.12") {			html += '        range             : [' + c.range + '],\n';		}	};	function endCommonCalendarSetup() {		html += '      });\n';		html += '/* CUT THIS LINE */ };\n';		endScript();		html += '<br><a href="http://www.zapatec.com/website/main/products/prod1/">Zapatec Javascript Calendar</a><br>\n';	};	if (document.getElementById("r_popup").checked) {		// generating a popup calendar		if (!c.inputField && !c.displayArea && !c.button) {			comment("ERROR: none of the input field, display area or trigger button\n" +				"properties are defined. Please go back to step 1 (“Type”)\n" +				"and define at least one of them.");		} else {			if (c.inputField)				html += '    <input type="' + (c.displayArea ? "hidden" : "text") + '"' +					' id="' + c.inputField + '" name="' + c.inputField + '" />\n';			if (c.displayArea)				if (c.button)					html += '    <div style="border: 1px solid #000; padding: 2px 5px;" id="' +						c.displayArea + '">Select date</div>\n';				else					html += '    <a href="#" id="' + c.displayArea + '">Select date</a>\n';			if (c.button)				html += '    <button id="' + c.button + '">...</button>\n';			beginCommonCalendarSetup();			if (c.electric != true) {				html += '        electric          : ' + c.electric + ',\n';			}			if (c.singleClick != true) {				html += '        singleClick       : ' + c.singleClick + ',\n';			}			if (c.inputField)				html += '        inputField        : "' + c.inputField + '",\n';			if (c.displayArea)				html += '        displayArea       : "' + c.displayArea + '",\n';			if (c.button)				html += '        button            : "' + c.button + '",\n';			if (c.ifFormat)				html += '        ifFormat          : "' + c.ifFormat + '",\n';			if (c.daFormat)				html += '        daFormat          : "' + c.daFormat + '",\n';			if (c.timeInterval !== "") {				html += '        timeInterval          : ' + c.timeInterval + ',\n';			}			//multiple months			if (c.numberMonths > 1) {				html += '        numberMonths          : ' + c.numberMonths + ',\n';				if (c.controlMonth > 1) {					html += '        controlMonth          : ' + c.controlMonth + ',\n';				}				if (c.monthsInRow != "") {					html += '        monthsInRow          : ' + c.monthsInRow + ',\n';				}				if (c.vertical != false) {					html += '        vertical          : ' + c.vertical + ',\n';				}			}			if (c.align != "Br") {				html += '        align             : "' + c.align + '"\n';			}			// trim any trailing comma with optional white space			// fixes error with empty object contents if just a trailing comma			html=html.replace(/,(\s?)+$/,"\n");			endCommonCalendarSetup();		}	} else {		// generating a flat calendar		if (!c.flat || !c.flatCallback) {			comment("ERROR: you did not specify the container ID and/or\n" +				"the flat callback function name.  Please go back to\n" +				"step 1 (“Type”) and make sure they are defined.");		} else {			comment("The following empty element is the container for the calendar.\n" +				"It has the ID that you defined at step 1 (“Type”).\n" +				"When “Calendar.setup” is called below, the calendar will be generated\n" +				"in this element.  Feel free to position it the way you want\n" +				"using CSS.  You will normally want this to be a floating element\n" +				"which is why we generated one having the style “float: right”.");			html += "\n";			html += '<div style="float: right; margin: 0 0 1em 1em" id="' + c.flat + '"></div>\n\n';			comment("The following JavaScript code defines a function that will\n" +				"get called each time the user modifies the date inside the calendar.\n" +				"To make sure that a date was actually clicked, we check the\n" +				"cal.dateClicked variable.  If a date wasn't clicked this will be\n" +				"“false” and it usually means that the date was modified using the\n" +				"month or year navigation buttons, or that only the time got modified.");			html += "\n";			// generating the flat callback function			beginScript();			html += '      function ' + c.flatCallback + '(cal) {\n';			html += '        if (cal.dateClicked) {\n';			html += '          var url = "http://www.mydomain.com/" + cal.date.print("%Y/%m/%d/");\n';			html += '          alert("Jumping to: “" + url + "” (not really).");\n';			html += '          // uncomment the following line to actually jump:\n';			html += '          // window.location = url;\n';			html += '        }\n';			html += '      };\n';			endScript();			html += "\n";			beginCommonCalendarSetup();			html += '        flat              : "' + c.flat + '",\n';			html += '        flatCallback      : ' + c.flatCallback + '\n';			endCommonCalendarSetup();		}	}	html += '<!-- CUT THIS LINE --></blockquote>\n';	html += '<!-- CUT THIS LINE --><blockquote>If you are not happy with the result, go back to the ' +		'wizard and configure more options.  Otherwise, go back to the wizard, copy the code ' +		'displayed in the “Generate” tab and insert it into your own application.</blockquote>\n';	html += '<!-- CUT THIS LINE --><p>' +		'<a href="javascript:window.close()">close this window</a></p>\n';	html += '\n  </body>\n';	html += '</html>\n';	return html;};function onGenerate() {	var ta = document.getElementById("code");	var html = makeCode(false);	ta.value = code_removeCuts(html);	setTimeout(function() {		ta.focus();		if (!ta.__msh_positioned) {			ta.style.height = ta.parentNode.parentNode.parentNode.offsetHeight - 200 + "px";			ta.__msh_positioned = true;		}	}, 100);};function selectCode() {	var ta = document.getElementById("code");	ta.focus();	ta.select();};function code_removeCuts(text) {	return text.replace(/(\/\*|<!--)\s*CUT.THIS.LINE\s*(\*\/|-->).*\n/ig, '');};function testCode() {	var		HM = 300,		WM = 400,		h = screen.height - HM,		w = screen.width - WM;	makeConfigObj();	var win = window.open(wiz_path + "test.html", "TESTCAL",			      "width="+w+",height="+h+",left="+Math.round(WM/2)+",top="+Math.round(HM/2)+",toolbar=no," +			      "menubar=no,directories=no,channelmode=no,resizable=yes,scrollbars=yes");	win.focus();};function updateAdvanced(tab) {	var ab = document.getElementById("b_advanced");	ab.style.visibility = tab.hasAdvanced ? "visible" : "hidden";	if (tab.hasAdvanced)		ab.innerHTML = tab.advanced ? "Hide advanced options" : "Show advanced options";};function advanced() {	var tab = getCurrentTab();	if (tab.hasAdvanced) {		tab.advanced =! tab.advanced;		var id = tab.advanced_id_prefix;		var a = tab.advanced_id_suffix;		var vis = tab.advanced ? "visible" : "hidden";		for (var i = a.length; --i >= 0;)			document.getElementById(id + a[i]).style.visibility = vis;		updateAdvanced(tab);	} else		alert("No advanced stuff in this tab");};function format_updateTests() {	var date = new Date();	var f1 = document.getElementById("f_prop_ifFormat");	var t1 = document.getElementById(f1.id + "-test");	var f2 = document.getElementById("f_prop_daFormat");	var t2 = document.getElementById(f2.id + "-test");	if (!f1.value)		t1.innerHTML = "[empty format]";	else		t1.innerHTML = date.print(f1.value);	if (!f2.value)		t2.innerHTML = "[empty format]";	else		t2.innerHTML = date.print(f2.value);};function format_keyPress(field) {	var factory = document.getElementById(field.id + "-factory");	if (factory)		utils.selectOption(factory, "");	setTimeout(function() {		format_updateTests();	}, 10);};function factoryFormat(sel) {	if (sel.value) {		var id = sel.id.replace(/-factory$/, '');		var field = document.getElementById(id);		field.value = sel.value;		format_updateTests();	}};function setWizardPath(newAddress) {	wizard_address = newAddress;	document.getElementById('f_path').value = newAddress;}

⌨️ 快捷键说明

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