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

📄 calendar-exceptions.js

📁 能够实现宾馆管理的基本功能。 例如删除
💻 JS
字号:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Calendar - CalendarSpecialDays * All the special exceptions days functions * v1 	19 / 07 / 2007 * Author : Mickal Gentil * Contact : mickael.gentil@gmail.com *  * + 19/07/2007 Mickal Gentil : Added big week end exception * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************** EXCEPTIONS CONSTANTS DEFINITION****************************************************************/ // Default : French FreeDaysCalendar.SPECIAL_DAYS = {	0  : [ 1 ],	3  : [ 9 ],	4  : [ 1, 8, 17 ],	6  : [ 14 ],	7  : [ 15 ],	10 : [ 1, 11 ],	11 : [ 25 ]};Calendar.NB_OF_NIGHTS_MAX = 3;  /*************************************************************** * * EXCEPTIONS METHODS * ***************************************************************/  /** Calendar.bigWeekEnd()* Only weekend and freedays departure*/Calendar.bigWeekEnd = function(date, y, m, d, nbN, oneDayOnly, noWE) {	nbN = nbN || 3;	var checkSD = 0;	for(var i in Calendar.SPECIAL_DAYS) {		checkSD++;	}		//If date is less than today -> NOK	if(date < new Date() && date.getDate() != new Date().getDate()) {		return true;	}		// if one day only	if(oneDayOnly) {		// friday		if(date.getDay() == 5) {			this.NB_OF_NIGHTS_MAX = nbN;			return false;		}	// other cases	} else {		if(!noWE){		/***************************		* only friday (always OK)		/***************************/		if(date.getDay() == 5) {			this.NB_OF_NIGHTS_MAX = nbN;			return false;		}				/***************************		* only saturday (always OK)		/***************************/		if(date.getDay() == 6) {			// if no special days and friday only			if(nbN == 1 && !checkSD) {return true;}						var dep = new Date(date);			dep.setDate(dep.getDate() + 2);						//If Monday is special day -> OK			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate())) {				this.NB_OF_NIGHTS_MAX = nbN;				return false;			}						dep.setDate(dep.getDate() + 1);						//If Tuesday is special day -> OK			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate())) {				this.NB_OF_NIGHTS_MAX = nbN;				return false;			}						this.NB_OF_NIGHTS_MAX = nbN - 1;						return false;		}				/***************************		* only sunday		/***************************/		if(date.getDay() == 0) {			var dep = new Date(date);			dep.setDate(dep.getDate() + 2);						//If Tuesday is special day -> OK			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate())) {				this.NB_OF_NIGHTS_MAX = nbN;				return false;			}						dep.setDate(dep.getDate() - 1);						//If Monday is special day -> OK			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate())) {				this.NB_OF_NIGHTS_MAX = nbN - 1;				return false;			}						return true;		}		}		/********************************************************		* Special day (other than wednesday)		/*******************************************************/		if(this.dateIsSpecial(date.getFullYear(),date.getMonth(),date.getDate()) && date.getDay() != 3) {			var dep = new Date(date);			dep.setDate(dep.getDate() + 1);						//If next day is special day or friday -> OK			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate()) || dep.getDay() == 5) {				this.NB_OF_NIGHTS_MAX = nbN - 1;								//if next day of the next day is friday				dep.setDate(dep.getDate() + 1);				if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate()) || dep.getDay() == 5 || dep.getDay() == 6 || dep.getDay() == 0) {					this.NB_OF_NIGHTS_MAX = nbN;				}								return false;			}						return true;		}				/***************************		* Special day before		/***************************/		var dep = new Date(date);				//If next day of the next day (delicious ^^) is special day -> OK		/*if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate()) && date.getDay() != 2) {			this.NB_OF_NIGHTS_MAX = nbN;			return false;		}*/				dep.setDate(dep.getDate() + 1);				//If next day is special day -> OK		if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate()) && date.getDay() != 2) {			//if next day of the next day is friday			dep.setDate(dep.getDate() + 1);			if(this.dateIsSpecial(dep.getFullYear(),dep.getMonth(),dep.getDate()) || dep.getDay() == 5) {				this.NB_OF_NIGHTS_MAX = nbN;			} else {				this.NB_OF_NIGHTS_MAX = nbN - 1;			}						return false;		}		}	return true;}; /*************************************************************** * * EXCEPTIONS SPECIAL FUNCTIONS * ***************************************************************/Calendar.dateIsSpecial = function(year, month, day) {	var m = this.SPECIAL_DAYS[month];	if(!m) {return false;}	for(var i = 0, len = m.length; i < len; i++) {		if(m[i] == day) {return true;}	}	return false;};

⌨️ 快捷键说明

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