PageSourceSearch

https://miyakogreencenter.com/miyakogreencenter/wp-content/plugins/biz-calendar/calendar.js?ver=2.2.0

js miyakogreencenter.com collected 2026-10-05 20:05:25 UTC 8,784 bytes, 298 lines download raw bytes

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

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.