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

📄 icalendar.js

📁 dojo与json创建无限级树的时候,当在父结点下添加了一个新结点,我怎么让父亲结点重新调用json加载一下子结点内容.
💻 JS
📖 第 1 页 / 共 2 页
字号:
					switch(freq) {						case "yearly":							var nextDate = new Date(dtstart);							set.push(nextDate);							while(nextDate < tmpUntil) {								nextDate.setYear(nextDate.getFullYear()+interval);								tmpDate = new Date(nextDate);								if(tmpDate < tmpUntil) {									set.push(tmpDate);								}							}							break;						case "monthly":							nextDate = new Date(dtstart);							set.push(nextDate);							while(nextDate < tmpUntil) {								nextDate.setMonth(nextDate.getMonth()+interval);								var tmpDate = new Date(nextDate);								if (tmpDate < tmpUntil) {									set.push(tmpDate);								}							}							break;						case "weekly":							nextDate = new Date(dtstart);							set.push(nextDate);							while(nextDate < tmpUntil) {								nextDate.setDate(nextDate.getDate()+(7*interval));								var tmpDate = new Date(nextDate);								if (tmpDate < tmpUntil) {									set.push(tmpDate);								}							}							break;							case "daily":							nextDate = new Date(dtstart);							set.push(nextDate);							while(nextDate < tmpUntil) {								nextDate.setDate(nextDate.getDate()+interval);								var tmpDate = new Date(nextDate);								if (tmpDate < tmpUntil) {									set.push(tmpDate);								}							}							break;						}					if ((rrule["bymonth"]) && (order["bymonth"]<freqInt))	{						for (var z=0; z<rrule["bymonth"].length; z++) {							if (z==0) {								for (var zz=0; zz < set.length; zz++) {									set[zz].setMonth(rrule["bymonth"][z]-1);								}							} else {								var subset=[];								for (var zz=0; zz < set.length; zz++) {									var newDate = new Date(set[zz]);									newDate.setMonth(rrule[z]);									subset.push(newDate);								}								tmp = set.concat(subset);								set = tmp;							}						}					}										// while the spec doesn't prohibit it, it makes no sense to have a bymonth and a byweekno at the same time					// and if i'm wrong then i don't know how to apply that rule.  This is also documented elsewhere on the web					if (rrule["byweekno"] && !rrule["bymonth"]) {							dojo.debug("TODO: no support for byweekno yet");					}					// while the spec doesn't prohibit it, it makes no sense to have a bymonth and a byweekno at the same time					// and if i'm wrong then i don't know how to apply that rule.  This is also documented elsewhere on the web					if (rrule["byyearday"] && !rrule["bymonth"] && !rrule["byweekno"] ) {							if (rrule["byyearday"].length > 1) {							var regex = "([+-]?)([0-9]{1,3})";							for (var z=1; x<rrule["byyearday"].length; z++) {								var regexResult = rrule["byyearday"][z].match(regex);								if (z==1) {									for (var zz=0; zz < set.length; zz++) {										if (regexResult[1] == "-") {											dojo.date.setDayOfYear(set[zz],366-regexResult[2]);										} else {											dojo.date.setDayOfYear(set[zz],regexResult[2]);										}									}								}	else {									var subset=[];									for (var zz=0; zz < set.length; zz++) {										var newDate = new Date(set[zz]);										if (regexResult[1] == "-") {											dojo.date.setDayOfYear(newDate,366-regexResult[2]);										} else {											dojo.date.setDayOfYear(newDate,regexResult[2]);										}										subset.push(newDate);									}									tmp = set.concat(subset);									set = tmp;								}							}						}					}					if (rrule["bymonthday"]  && (order["bymonthday"]<freqInt)) {							if (rrule["bymonthday"].length > 0) {							var regex = "([+-]?)([0-9]{1,3})";							for (var z=0; z<rrule["bymonthday"].length; z++) {								var regexResult = rrule["bymonthday"][z].match(regex);								if (z==0) {									for (var zz=0; zz < set.length; zz++) {										if (regexResult[1] == "-") {											if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {												set[zz].setDate(dojo.date.getDaysInMonth(set[zz]) - regexResult[2]);											}										} else {											if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {												set[zz].setDate(regexResult[2]);											}										}									}								}	else {									var subset=[];									for (var zz=0; zz < set.length; zz++) {										var newDate = new Date(set[zz]);										if (regexResult[1] == "-") {											if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {												newDate.setDate(dojo.date.getDaysInMonth(set[zz]) - regexResult[2]);											}										} else {											if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {												newDate.setDate(regexResult[2]);											}										}										subset.push(newDate);									}									tmp = set.concat(subset);									set = tmp;								}							}						}					}					if (rrule["byday"]  && (order["byday"]<freqInt)) {							if (rrule["bymonth"]) {							if (rrule["byday"].length > 0) {								var regex = "([+-]?)([0-9]{0,1}?)([A-Za-z]{1,2})";								for (var z=0; z<rrule["byday"].length; z++) {									var regexResult = rrule["byday"][z].match(regex);									var occurance = regexResult[2];									var day = regexResult[3].toLowerCase();									if (z==0) {										for (var zz=0; zz < set.length; zz++) {											if (regexResult[1] == "-") {												//find the nth to last occurance of date 												var numDaysFound = 0;												var lastDayOfMonth = dojo.date.getDaysInMonth(set[zz]);												var daysToSubtract = 1;												set[zz].setDate(lastDayOfMonth); 												if (weekdays[set[zz].getDay()] == day) {													numDaysFound++;													daysToSubtract=7;												}												daysToSubtract = 1;												while (numDaysFound < occurance) {													set[zz].setDate(set[zz].getDate()-daysToSubtract);														if (weekdays[set[zz].getDay()] == day) {														numDaysFound++;														daysToSubtract=7;														}												}											} else {												if (occurance) {													var numDaysFound=0;													set[zz].setDate(1);													var daysToAdd=1;													if(weekdays[set[zz].getDay()] == day) {														numDaysFound++;														daysToAdd=7;													}													while(numDaysFound < occurance) {														set[zz].setDate(set[zz].getDate()+daysToAdd);														if(weekdays[set[zz].getDay()] == day) {															numDaysFound++;															daysToAdd=7;														}													}												} else {													//we're gonna expand here to add a date for each of the specified days for each month													var numDaysFound=0;													var subset = [];													lastDayOfMonth = new Date(set[zz]);													var daysInMonth = dojo.date.getDaysInMonth(set[zz]);													lastDayOfMonth.setDate(daysInMonth);													set[zz].setDate(1);																									if (weekdays[set[zz].getDay()] == day) {														numDaysFound++;													}													var tmpDate = new Date(set[zz]);													daysToAdd = 1;													while(tmpDate.getDate() < lastDayOfMonth) {														if (weekdays[tmpDate.getDay()] == day) {															numDaysFound++;															if (numDaysFound==1) {																set[zz] = tmpDate;															} else {																subset.push(tmpDate);																tmpDate = new Date(tmpDate);																daysToAdd=7;																	tmpDate.setDate(tmpDate.getDate() + daysToAdd);															}														} else {															tmpDate.setDate(tmpDate.getDate() + daysToAdd);														}													}													var t = set.concat(subset);													set = t; 												}											}										}									}	else {										var subset=[];										for (var zz=0; zz < set.length; zz++) {											var newDate = new Date(set[zz]);											if (regexResult[1] == "-") {												if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {													newDate.setDate(dojo.date.getDaysInMonth(set[zz]) - regexResult[2]);												}											} else {												if (regexResult[2] < dojo.date.getDaysInMonth(set[zz])) {													newDate.setDate(regexResult[2]);												}											}											subset.push(newDate);										}										tmp = set.concat(subset);										set = tmp;									}								}							}						} else {							dojo.debug("TODO: byday within a yearly rule without a bymonth");						}					}					dojo.debug("TODO: Process BYrules for units larger than frequency");								//add this set of events to the complete recurranceSet						var tmp = recurranceSet.concat(set);					recurranceSet = tmp;				}			}			// TODO: add rdates to the recurrance set here			// TODO: subtract exdates from the recurrance set here			//TODO:  subtract dates generated by exrules from recurranceSet here			recurranceSet.push(dtstart);			return recurranceSet;		},		getDate: function() {			return dojo.date.fromIso8601(this.dtstart.value);		}});/* * VTIMEZONE */var VTimeZoneProperties = [	_P("tzid", 1, true), _P("last-mod", 1), _P("tzurl", 1)	// one of 'standardc' or 'daylightc' must occur	// and each may occur more than once.];dojo.iCalendar.VTimeZone = function (/* string */ body) {	// summary	// VTIMEZONE Component	this.name = "VTIMEZONE";	this._ValidProperties = VTimeZoneProperties;	dojo.iCalendar.Component.call(this, body);}dojo.inherits(dojo.iCalendar.VTimeZone, dojo.iCalendar.Component);/* * VTODO */var VTodoProperties = [	// these can occur once only	_P("class", 1), _P("completed", 1), _P("created", 1), _P("description", 1),	_P("dtstart", 1), _P("geo", 1), _P("last-mod", 1), _P("location", 1),	_P("organizer", 1), _P("percent", 1), _P("priority", 1), _P("dtstamp", 1),	_P("seq", 1), _P("status", 1), _P("summary", 1), _P("uid", 1), _P("url", 1),	_P("recurid", 1),	// these two are exclusive	[_P("due", 1), _P("duration", 1)],	// these can occur many times over	_P("attach"), _P("attendee"), _P("categories"), _P("comment"), _P("contact"),	_P("exdate"), _P("exrule"), _P("rstatus"), _P("related"), _P("resources"),	_P("rdate"), _P("rrule")];dojo.iCalendar.VTodo= function (/* string */ body) {	// summary	// VTODO Componenet	this.name = "VTODO";	this._ValidProperties = VTodoProperties;	dojo.iCalendar.Component.call(this, body);}dojo.inherits(dojo.iCalendar.VTodo, dojo.iCalendar.Component);/* * VJOURNAL */var VJournalProperties = [	// these can occur once only	_P("class", 1), _P("created", 1), _P("description", 1), _P("dtstart", 1),	_P("last-mod", 1), _P("organizer", 1), _P("dtstamp", 1), _P("seq", 1),	_P("status", 1), _P("summary", 1), _P("uid", 1), _P("url", 1), _P("recurid", 1),	// these can occur many times over	_P("attach"), _P("attendee"), _P("categories"), _P("comment"), _P("contact"),	_P("exdate"), _P("exrule"), _P("related"), _P("rstatus"), _P("rdate"), _P("rrule")];dojo.iCalendar.VJournal= function (/* string */ body) {	// summary	// VJOURNAL Component	this.name = "VJOURNAL";	this._ValidProperties = VJournalProperties;	dojo.iCalendar.Component.call(this, body);}dojo.inherits(dojo.iCalendar.VJournal, dojo.iCalendar.Component);/* * VFREEBUSY */var VFreeBusyProperties = [	// these can occur once only	_P("contact"), _P("dtstart", 1), _P("dtend"), _P("duration"),	_P("organizer", 1), _P("dtstamp", 1), _P("uid", 1), _P("url", 1),	// these can occur many times over	_P("attendee"), _P("comment"), _P("freebusy"), _P("rstatus")];dojo.iCalendar.VFreeBusy= function (/* string */ body) {	// summary	// VFREEBUSY Component	this.name = "VFREEBUSY";	this._ValidProperties = VFreeBusyProperties;	dojo.iCalendar.Component.call(this, body);}dojo.inherits(dojo.iCalendar.VFreeBusy, dojo.iCalendar.Component);/* * VALARM */var VAlarmProperties = [	[_P("action", 1, true), _P("trigger", 1, true), [_P("duration", 1), _P("repeat", 1)],	_P("attach", 1)],	[_P("action", 1, true), _P("description", 1, true), _P("trigger", 1, true),	[_P("duration", 1), _P("repeat", 1)]],	[_P("action", 1, true), _P("description", 1, true), _P("trigger", 1, true),	_P("summary", 1, true), _P("attendee", "*", true),	[_P("duration", 1), _P("repeat", 1)],	_P("attach", 1)],	[_P("action", 1, true), _P("attach", 1, true), _P("trigger", 1, true),	[_P("duration", 1), _P("repeat", 1)],	_P("description", 1)],];dojo.iCalendar.VAlarm= function (/* string */ body) {	// summary	// VALARM Component	this.name = "VALARM";	this._ValidProperties = VAlarmProperties;	dojo.iCalendar.Component.call(this, body);}dojo.inherits(dojo.iCalendar.VAlarm, dojo.iCalendar.Component);

⌨️ 快捷键说明

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