PageSourceSearch

https://ohtsuka-ceramics.co.jp/cms_cj6jDjde/wp-content/plugins/biz-calendar/calendar.js?ver=2.2.0

js ohtsuka-ceramics.co.jp collected 2026-10-06 08:14:46 UTC 8,848 bytes, 301 lines download raw bytes

1jQuery(document).ready(function ($) {
2	// if ($("#biz_calendar").size() == 0) {
3	// 	return;
4	// }
5	if ($("#biz_calendar").length == 0) {
6		return;
7	}
8	bizCalendar.start();
9});
10
11var bizCalendar = {
12	start: function () {
13		var now = new Date();
14		this.setting = {
15			year: now.getFullYear(),
16			month: now.getMonth() + 1,
17			options: window.bizcalOptions
18		};
19		document.getElementById('biz_calendar').innerHTML = this.getCalendar();
20	},
21
22	downMonth: function () {
23		if (this.setting.month <= 1) {
24			this.setting.month = 12;
25			this.setting.year = this.setting.year - 1;
26		} else {
27			this.setting.month = this.setting.month - 1;
28		}
29		document.getElementById('biz_calendar').innerHTML = this.getCalendar();
30	},
31
32	upMonth: function () {
33		if (this.setting.month >= 12) {
34			this.setting.month = 1;
35			this.setting.year = this.setting.year + 1;
36		} else {
37			this.setting.month = this.setting.month + 1;
38		}
39		document.getElementById('biz_calendar').innerHTML = this.getCalendar();
40	},
41
42	goToday: function () {
43		var now = new Date();
44		if (this.setting.month == now.getMonth() + 1 && this.setting.year == now.getFullYear()) {
45			return;
46		}
47		this.setting.year = now.getFullYear();
48		this.setting.month = now.getMonth() + 1;
49		document.getElementById('biz_calendar').innerHTML = this.getCalendar();
50	},
51
52	getCalendar: function () {
53		var weekArray = new Array("日", "月", "火", "水", "木", "金", "土");
54		var start_day = this.getStartDayOfMonth(this.setting.year, this.setting.month);
55		var last_date = this.getEndDateOfMonth(this.setting.year, this.setting.month);
56		var calLine = Math.ceil((start_day + last_date) / 7);
57		var calArray = new Array(7 * calLine);
58
59		// カレンダーの日付テーブル作成
60		for (var i = 0; i < 7 * calLine; i++) {
61			if (i >= last_date) {
62				break;
63			}
64			calArray[i + start_day] = i + 1;
65		}
66
67		// カレンダーのタイトル
68		var title = this.setting.year + "年 " + this.setting.month + "月";
69		var html = "<table class='bizcal' ><tr>";
70		html += "<td class='calmonth' colspan='4'>" + title + "</td>";
71		html += this.getPrevMonthTag();
72		html += "<td class='calbtn today-img' onclick='bizCalendar.goToday()' title='今月へ' ><img src='" + this.setting.options.plugindir + "image/today.png' ></td>";
73		html += this.getNextMonthTag();
74		html += "</tr>";
75
76		// カレンダーの曜日行
77		html += "<tr>";
78		for (var i = 0; i < weekArray.length; i++) {
79			html += "<th>";
80			html += weekArray[i];
81			html += "</th>";
82		}
83		html += "</tr>";
84
85		// カレンダーの日付
86		for (var i = 0; i < calLine; i++) {
87			html += "<tr>";
88			for (var j = 0; j < 7; j++) {
89				var date = (calArray[j + (i * 7)] != undefined) ? calArray[j + (i * 7)] : "";
90				html += "<td" + this.getDateClass(date, j) + ">";
91				html += this.getDateTag(date, j);
92				html += "</td>";
93			}
94			html += "</tr>";
95		}
96		html += "</table>";
97
98		// 説明文
99		html += this.getHolidayTitle();
100		html += this.getEventdayTitle();
101		return html;
102	},
103
104	getHolidayTitle: function () {
105		if (this.setting.options.holiday_title != "") {
106			return "<p><span class='boxholiday'></span>" + this.setting.options.holiday_title + "</p>";
107		}
108		return "";
109	},
110
111	getEventdayTitle: function () {
112		if (this.setting.options.eventday_title == "") {
113			return "";
114		}
115		var tag = "<p><span class='boxeventday'></span>"
116		if (this.setting.options.eventday_url == "") {
117			tag += this.setting.options.eventday_title + "</p>";
118			return tag;
119		}
120		tag += "<a href='" + this.setting.options.eventday_url + "'>" + this.setting.options.eventday_title + "</a></p>";
121		return tag;
122	},
123
124	getDateClass: function (date, day) {
125		if (date == undefined || date == "") {
126			return "";
127		}
128		var today = this.isToday(date);
129		var attr = "";
130		switch (this.getDateType(date, day)) {
131			case "EVENTDAY":
132				attr = today == false ? " class='eventday' " : " class='eventday today' ";
133				return attr;
134			case "HOLIDAY":
135				attr = today == false ? " class='holiday' " : " class='holiday today' ";
136				return attr;
137			default:
138				attr = today == false ? "" : " class='today' ";
139				return attr;
140		}
141		return "";
142	},
143
144	isToday: function (date) {
145		var now = new Date();
146		if (now.getFullYear() == this.setting.year
147			&& now.getMonth() + 1 == this.setting.month
148			&& now.getDate() == date) {
149			return true;
150		}
151		return false;
152	},
153
154	getDateTag: function (date, day) {
155		if (date == undefined || date == "") {
156			return "";
157		}
158		var url = this.setting.options.eventday_url;
159		if (url == "") {
160			return date;
161		}
162		if (this.getDateType(date, day) == "EVENTDAY") {
163			return tag = "<a href='" + url + "'>" + date + "</a>";
164		}
165		return date;
166	},
167
168	getDateType: function (date, day) {
169		var fulldate = this.toFormatDate(this.setting.year, this.setting.month, date);
170		// イベント日
171		if (this.setting.options.eventdays.indexOf(fulldate) != -1) {
172			return "EVENTDAY";
173		}
174		// 臨時営業日
175		if (this.setting.options.temp_weekdays.indexOf(fulldate) != -1) {
176			return "WEEKDAY";
177		}
178		// 臨時休業日
179		if (this.setting.options.temp_holidays.indexOf(fulldate) != -1) {
180			return "HOLIDAY";
181		}
182		// 定休日
183		var dayName = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
184		if (this.setting.options[dayName[day]] == "on") {
185			return "HOLIDAY";
186		}
187		// 祝日
188		if (this.isHoliday(fulldate)) {
189			return "HOLIDAY";
190		}
191		return "WEEKDAY";
192	},
193
194	isHoliday: function (fulldate) {
195		if (this.setting.options["holiday"] == undefined || this.setting.options["holiday"] == "off") {
196			return false;
197		}
198		var holidays = this.setting.options["national_holiday"];
199		if (holidays == undefined) {
200			return false;
201		}
202		for (var i = 0; i < holidays.length; i++) {
203			if (holidays[i] == fulldate) {
204				return true;
205			}
206		}
207		return false;
208	},
209
210	toFormatDate: function (y, m, d) {
211		m = m < 10 ? "0" + m : m;
212		d = d < 10 ? "0" + d : d;
213		return y + "-" + m + "-" + d;
214	},
215
216	getEndDateOfMonth: function (year, month) {
217		var date = new Date(year, month, 0);
218		return date.getDate();
219	},
220
221	getStartDayOfMonth: function (year, month) {
222		var date = new Date(year, month - 1, 1);
223		return date.getDay();
224	},
225
226	getPrevMonthTag: function () {
227		var limit = this.setting.options["month_limit"];
228		var tag = "<td class='calbtn down-img' onclick='bizCalendar.downMonth()' title='前の月へ' ><img src='" 
229			+ this.setting.options.plugindir + "image/down.png' ></td>";
230		if (limit == undefined || limit == "制限なし") {
231			return tag;
232		}
233		var now = new Date();
234		var now_year = now.getFullYear();
235		var now_month = now.getMonth() + 1;
236		var can_move = true;
237
238		if (limit == "年内") {
239			if (this.setting.month == 1) {
240				can_move = false;
241			}
242		} else if (limit == "年度内") {
243			if (this.setting.month == 4) {
244				can_move = false;
245			}
246		} else {
247			var prev_limit = this.setting.options["prevmonthlimit"] == undefined ? 0 : this.setting.options["prevmonthlimit"];
248			var prev_limit_year = now_year;
249			var prev_limit_month = now_month - Number(prev_limit);
250			if (prev_limit_month < 1) {
251				prev_limit_year -= 1;
252				prev_limit_month += 12;
253			}
254			if (this.setting.month == prev_limit_month && this.setting.year == prev_limit_year) {
255				can_move = false;
256			}
257		}
258
259		if (!can_move) {
260			tag = "<td class='calbtn down-img' ><img src='" + this.setting.options.plugindir + "image/down-limit.png' ></td>";
261		}
262		return tag;
263	},
264
265	getNextMonthTag: function () {
266		var limit = this.setting.options["month_limit"];
267		var tag = "<td class='calbtn up-img' onclick='bizCalendar.upMonth()' title='次の月へ' ><img src='" + this.setting.options.plugindir + "image/up.png' ></td>";
268		if (limit == undefined || limit == "制限なし") {
269			return tag;
270		}
271		var now = new Date();
272		var now_year = now.getFullYear();
273		var now_month = now.getMonth() + 1;
274		var can_move = true;
275
276		if (limit == "年内") {
277			if (this.setting.month == 12) {
278				can_move = false;
279			}
280		} else if (limit == "年度内") {
281			if (this.setting.month == 3) {
282				can_move = false;
283			}
284		} else {
285			var next_limit = this.setting.options["nextmonthlimit"] == undefined ? 0 : this.setting.options["nextmonthlimit"];
286			var next_limit_year = now_year;
287			var next_limit_month = now_month + Number(next_limit);
288			if (next_limit_month > 12) {
289				next_limit_year += 1;
290				next_limit_month -= 12;
291			}
292			if (this.setting.month == next_limit_month && this.setting.year == next_limit_year) {
293				can_move = false;
294			}
295		}
296		if (!can_move) {
297			tag = "<td class='calbtn up-img' ><img src='" + this.setting.options.plugindir + "image/up-limit.png' ></td>";
298		}
299		return tag;
300	}
301};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.