PageSourceSearch

https://shizuoka-hikari-eye.com/wp-content/plugins/business-calendar/business-calendar.js

js shizuoka-hikari-eye.com collected 2026-09-26 09:28:40 UTC 7,132 bytes, 285 lines download raw bytes

1//
2// ページ読み込み時
3//
4jQuery(document).ready(function(){
5
6	jQuery(".isp-calendar-frame").each( function() {
7
8		// 当月カレンダーをdiv内に表示
9		create_business_calendar(jQuery(this));
10
11		// リターン
12		return true;
13	});
14
15});
16
17// 指定月のカレンダーを表示
18// 第1引数: isp-calendar-frame の jQueryオブジェクト
19// 第2引数: カレンダーの年(省略時は当年)
20// 第3引数: カレンダーの月(省略時は当月)
21function create_business_calendar(jq, y, m) {
22
23	// html埋め込みパラメータ
24	var bas_holiday = new Array();
25	var inc_holiday = new Array();
26	var exc_holiday = new Array();
27	var month_future;
28	var month_past;
29	var s_day;
30	
31	// 変数
32	var now = new Date();	// 現在時カレンダー
33	var arr;				// "yyyy-m"形式の文字列
34	var today = false;		// 当月であれば true
35	var mydate;				// 表示年月の先頭日
36	var firstday;			// 表示年月の先頭日の曜日
37	var enddate;			// 表示年月の末日
38	var nxt_y;				// 翌月の年
39	var nxt_m;				// 翌月の月
40	var prv_y;				// 先月の年
41	var prv_m;				// 先月の月
42	var max_y_f;			// 月送りの限界年
43	var max_m_f;			// 月送りの限界月
44	var max_y_p;			// 月戻りの限界年
45	var max_m_p;			// 月戻りの限界月
46	var nxt_link;			// 先月へのリンクhtml
47	var prv_link;			// 来月へのリンクhtml
48	var day_array;			// 曜日表示文字の配列
49	
50	// 作業変数
51	var today_class = '';
52	var check_date;
53	var week = -1;
54	var holiday;
55	var html;				// 出力html
56	var count = 1;
57	var values;
58	var val;
59	var i;
60	var diff;
61
62	// 省略時引数のセット
63	if(y == undefined) y = now.getFullYear();
64	if(m == undefined) m = now.getMonth() + 1;
65	while ( jq.attr("class") != "isp-calendar-frame") {
66		jq = jq.parent();
67	}
68
69	// 当月か確認
70	if(y == now.getFullYear() && m == now.getMonth() + 1) {
71		today = true;
72	}
73
74	// HTML埋め込みパラメータの取得
75	values = jq.children(".base-holiday").val();
76	values = values.split('&');
77	for(i=0; i<values.length; i++) {
78		val = values[i].split('=');
79		bas_holiday[i] = val[1].split(',');
80	}
81
82
83	values = jq.children(".inc-holiday").val();
84	if( values.length > 0) {
85		values = values.split('&');
86		for(i=0; i<values.length; i++) {
87			val = values[i].split('=');
88			inc_holiday[val[0]] = val[1].split(',');
89		}
90	}
91
92	values = jq.children(".exc-holiday").val();
93	if( values.length > 0) {
94		values = values.split('&');
95		for(i=0; i<values.length; i++) {
96			val = values[i].split('=');
97			exc_holiday[val[0]] = val[1].split(',');
98		}
99	}
100
101	month_future = parseInt(jq.children(".month_future").val());
102	
103	month_past = parseInt(jq.children(".month_past").val());
104
105	s_day = parseInt(jq.children(".s_day").val());
106
107
108	// 月送りを求める(未来)
109	max_y_f = now.getFullYear();
110	max_m_f = (now.getMonth() + 1) + month_future;
111	if(max_m_f > 12) {
112		max_y_f++;
113		max_m_f -= 12;
114	}
115	check_date = new Date(max_y_f, (max_m_f-1), 1);
116	mydate = new Date(y, (m-1), 1);
117	if((check_date - mydate) < 0) {
118		y = max_y_f;
119		m = max_m_f;
120	}
121
122
123	// 月送りを求める(過去)
124	max_y_p = now.getFullYear();
125	max_m_p = (now.getMonth() + 1) - month_past;
126	if(max_m_p < 0) {
127		max_y_p--;
128		max_m_p += 12;
129	}
130	check_date = new Date(max_y_p, (max_m_p-1), 1);
131	mydate = new Date(y, (m-1), 1);
132	if((mydate - check_date) < 0) {
133		y = max_y_p;
134		m = max_m_p;
135	}
136
137while(count < 3){
138
139	if(count != 1) {
140		// 翌月を取得
141		if(m == 1) {
142			y = y; m = m + 1;
143		} else if(m == 12) {
144			y = y + 1; m = 1;
145		} else {
146			y = y; m = m + 1;
147		}
148
149		// 翌月、先月を取得
150		if(m == 1) {
151			nxt_y = y; nxt_m = m + 1; prv_y = y - 1; prv_m = 12;
152		} else if(m == 12) {
153			nxt_y = y + 1; nxt_m = 1; prv_y = y; prv_m = m - 1;
154		} else {
155			nxt_y = y; nxt_m = m + 1; prv_y = y; prv_m = m - 1;
156		}
157	
158		// リンクを取得
159		if(y == max_y_f && m == max_m_f) {
160			nxt_link = '<div class="move_button nxt_off">&nbsp;</div>';
161		} else {
162			nxt_link = '<div class="move_button nxt" onclick="create_business_calendar( jQuery(this), ' + nxt_y + ', ' + nxt_m + ')">&nbsp;</div>';
163		}
164	
165		if(y == max_y_p && m == max_m_p) {
166			prv_link = '<div class="move_button prv_off">&nbsp;</div>';
167		} else {
168			prv_link = '<div class="move_button prv" onclick="create_business_calendar( jQuery(this), ' + prv_y + ', ' + prv_m + ')">&nbsp;</div>';
169		}
170
171	}
172	
173	arr = y + "-" + m;
174
175	// 末日を取得
176	mydate = new Date(y, m, 0);
177	enddate = mydate.getDate();
178
179	// 指定年指定月1日の曜日
180	mydate = new Date(y, (m-1), 1);
181	firstday = mydate.getDay();
182
183	// 週始めを取得
184	if(s_day == 0) {
185		day_array = new Array("日", "月", "火", "水", "木", "金", "土");
186	} else if(s_day == 1) {
187		day_array = new Array("月", "火", "水", "木", "金", "土", "日");
188	} else if(s_day == 2) {
189		day_array = new Array("火", "水", "木", "金", "土", "日", "月");
190	} else if(s_day == 3) {
191		day_array = new Array("水", "木", "金", "土", "日", "月", "火");
192	} else if(s_day == 4) {
193		day_array = new Array("木", "金", "土", "日", "月", "火", "水");
194	} else if(s_day == 5) {
195		day_array = new Array("金", "土", "日", "月", "火", "水", "木");
196	} else if(s_day == 6) {
197		day_array = new Array("土", "日", "月", "火", "水", "木", "金");
198	}
199
200	// カレンダーの作成
201	html = '<table><tbody>'
202				+ '<tr><td colspan="7" nowrap="nowrap"><div align="center"><strong>' + m + '月</strong></div></td></tr><tr>';
203
204	for(var i=0; i<day_array.length; i++) {
205		html += '<td class="day">' + day_array[i] + '</td>';
206	}
207
208	html += '</tr>';
209
210
211	// 1日になるまで空白のセルを作成
212	if(firstday < s_day) {
213		diff = Math.abs((7+firstday) - s_day);
214	} else {
215		diff = Math.abs(firstday - s_day);
216	}
217
218	if(diff > 0) {
219		html += '<tr valign="middle">';
220		for(var i=0; i<diff; i++) {
221			html += '<td align="center">&nbsp;</td>';
222		}
223	}
224
225	// カレンダー本体の作成
226	week = -1;
227	for(var i=1; i<=enddate; i++) {
228		myday = mydate.getDay();
229		if(myday == s_day && i != 1) {
230			html += '</tr><tr valign="middle">';
231		}
232
233		if(myday == firstday) week++;
234
235		// 休日の確認
236		holiday = bas_holiday[week][myday];
237		if(exc_holiday[arr] != undefined) {
238			if(jQuery.inArray(i+"", exc_holiday[arr]) > -1) holiday = "";
239		}
240		if(inc_holiday[arr] != undefined) {
241			if(jQuery.inArray(i+"", inc_holiday[arr]) > -1) holiday = "all";
242		}
243
244		// 本日の確認
245		if(today) {
246			if(i == now.getDate()) {
247				today_class = ' today';
248			} else {
249				today_class = '';
250			}
251		}
252
253		if(holiday.length > 0) {
254			html += '<td class="' + holiday + today_class + '">' + i + '</td>';
255		} else {
256			html += '<td class="business' + today_class + '">' + i + '</td>';
257		}
258
259		mydate.setDate(mydate.getDate() + 1);
260
261		// 末日以降のデータを埋める
262		if(i == enddate) {
263			while(mydate.getDay() != s_day) {
264				html += '<td align="center">&nbsp;</td>';
265				mydate.setDate(mydate.getDate() + 1);
266			}
267		}
268	}
269
270	html += '</tr></tbody></table>';
271
272	if(count == 1) {
273		html1 = html;
274	}else{
275		html2 = html;
276	}
277	count ++;
278}
279	jq.children(".isp-calendar-table1").html(html1);
280	jq.children(".isp-calendar-table2").html(html2);
281
282	
283	// リターン
284	return true;
285}

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.