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 path = location.pathname; 51 if (path.match(/en/)) { 52 var weekArray = new Array("Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."); 53 } else { 54 var weekArray = new Array("æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å"); 55 } 56 57 var start_day = this.getStartDayOfMonth(this.setting.year, this.setting.month); 58 var last_date = this.getEndDateOfMonth(this.setting.year, this.setting.month); 59 var calLine = Math.ceil((start_day + last_date) / 7); 60 var calArray = new Array(7 * calLine); 61 62 // ã«ã¬ã³ãã¼ã®æ¥ä»ãã¼ãã«ä½æ 63 for (var i = 0; i < 7 * calLine; i++) { 64 if (i >= last_date) { 65 break; 66 } 67 calArray[i + start_day] = i + 1; 68 } 69 70 // ã«ã¬ã³ãã¼ã®ã¿ã¤ãã« 71 if (path.match(/en/)) { 72 var title = this.setting.year + "." + this.setting.month; 73 } else { 74 var title = this.setting.year + "å¹´ " + this.setting.month + "æ"; 75 } 76 77 var html = "<table class='bizcal' ><tr>"; 78 html += "<td class='calmonth' colspan='4'>" + title + "</td>"; 79 html += this.getPrevMonthTag(); 80 html += "<td class='calbtn today-img' onclick='bizCalendar.goToday()' title='仿ã¸' ><img src='" + this.setting.options.plugindir + "image/today.png' ></td>"; 81 html += this.getNextMonthTag(); 82 html += "</tr>"; 83 84 // ã«ã¬ã³ãã¼ã®ææ¥è¡ 85 html += "<tr>"; 86 for (var i = 0; i < weekArray.length; i++) { 87 html += "<th>"; 88 html += weekArray[i]; 89 html += "</th>"; 90 } 91 html += "</tr>"; 92 93 // ã«ã¬ã³ãã¼ã®æ¥ä» 94 for (var i = 0; i < calLine; i++) { 95 html += "<tr>"; 96 for (var j = 0; j < 7; j++) { 97 var date = (calArray[j + (i * 7)] != undefined) ? calArray[j + (i * 7)] : ""; 98 html += "<td" + this.getDateClass(date, j) + ">"; 99 html += this.getDateTag(date, j); 100 html += "</td>"; 101 } 102 html += "</tr>"; 103 } 104 html += "</table>"; 105 106 // èª¬ææ 107 html += this.getHolidayTitle(); 108 html += this.getEventdayTitle(); 109 return html; 110 }, 111 112 getHolidayTitle: function () { 113 if (this.setting.options.holiday_title != "") { 114 return "<p><span class='boxholiday'></span>" + this.setting.options.holiday_title + "</p>"; 115 } 116 return ""; 117 }, 118 119 getEventdayTitle: function () { 120 if (this.setting.options.eventday_title == "") { 121 return ""; 122 } 123 var tag = "<p><span class='boxeventday'></span>" 124 if (this.setting.options.eventday_url == "") { 125 tag += this.setting.options.eventday_title + "</p>"; 126 return tag; 127 } 128 tag += "<a href='" + this.setting.options.eventday_url + "'>" + this.setting.options.eventday_title + "</a></p>"; 129 return tag; 130 }, 131 132 getDateClass: function (date, day) { 133 if (date == undefined || date == "") { 134 return ""; 135 } 136 var today = this.isToday(date); 137 var attr = ""; 138 switch (this.getDateType(date, day)) { 139 case "EVENTDAY": 140 attr = today == false ? " class='eventday' " : " class='eventday today' "; 141 return attr; 142 case "HOLIDAY": 143 attr = today == false ? " class='holiday' " : " class='holiday today' "; 144 return attr; 145 default: 146 attr = today == false ? "" : " class='today' "; 147 return attr; 148 } 149 return ""; 150 }, 151 152 isToday: function (date) { 153 var now = new Date(); 154 if (now.getFullYear() == this.setting.year 155 && now.getMonth() + 1 == this.setting.month 156 && now.getDate() == date) { 157 return true; 158 } 159 return false; 160 }, 161 162 getDateTag: function (date, day) { 163 if (date == undefined || date == "") { 164 return ""; 165 } 166 var url = this.setting.options.eventday_url; 167 if (url == "") { 168 return date; 169 } 170 if (this.getDateType(date, day) == "EVENTDAY") { 171 return tag = "<a href='" + url + "'>" + date + "</a>"; 172 } 173 return date; 174 }, 175 176 getDateType: function (date, day) { 177 var fulldate = this.toFormatDate(this.setting.year, this.setting.month, date); 178 // ã¤ãã³ãæ¥ 179 if (this.setting.options.eventdays.indexOf(fulldate) != -1) {
180 return "EVENTDAY"; 181 } 182 // è¨æå¶æ¥æ¥ 183 if (this.setting.options.temp_weekdays.indexOf(fulldate) != -1) { 184 return "WEEKDAY"; 185 } 186 // è¨æä¼æ¥æ¥ 187 if (this.setting.options.temp_holidays.indexOf(fulldate) != -1) { 188 return "HOLIDAY"; 189 } 190 // å®ä¼æ¥ 191 var dayName = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; 192 if (this.setting.options[dayName[day]] == "on") { 193 return "HOLIDAY"; 194 } 195 // ç¥æ¥ 196 if (this.isHoliday(fulldate)) { 197 return "HOLIDAY"; 198 } 199 return "WEEKDAY"; 200 }, 201 202 isHoliday: function (fulldate) { 203 if (this.setting.options["holiday"] == undefined || this.setting.options["holiday"] == "off") { 204 return false; 205 } 206 var holidays = this.setting.options["national_holiday"]; 207 if (holidays == undefined) { 208 return false; 209 } 210 for (var i = 0; i < holidays.length; i++) { 211 if (holidays[i] == fulldate) { 212 return true; 213 } 214 } 215 return false; 216 }, 217 218 toFormatDate: function (y, m, d) { 219 m = m < 10 ? "0" + m : m; 220 d = d < 10 ? "0" + d : d; 221 return y + "-" + m + "-" + d; 222 }, 223 224 getEndDateOfMonth: function (year, month) { 225 var date = new Date(year, month, 0); 226 return date.getDate(); 227 }, 228 229 getStartDayOfMonth: function (year, month) { 230 var date = new Date(year, month - 1, 1); 231 return date.getDay(); 232 }, 233 234 getPrevMonthTag: function () { 235 var limit = this.setting.options["month_limit"]; 236 var tag = "<td class='calbtn down-img' onclick='bizCalendar.downMonth()' title='åã®æã¸' ><img src='" 237 + this.setting.options.plugindir + "image/down.png' ></td>"; 238 if (limit == undefined || limit == "å¶éãªã") { 239 return tag; 240 } 241 var now = new Date(); 242 var now_year = now.getFullYear(); 243 var now_month = now.getMonth() + 1; 244 var can_move = true; 245 246 if (limit == "å¹´å ") { 247 if (this.setting.month == 1) { 248 can_move = false; 249 } 250 } else if (limit == "年度å ") { 251 if (this.setting.month == 4) { 252 can_move = false; 253 } 254 } else { 255 var prev_limit = this.setting.options["prevmonthlimit"] == undefined ? 0 : this.setting.options["prevmonthlimit"]; 256 var prev_limit_year = now_year; 257 var prev_limit_month = now_month - Number(prev_limit); 258 if (prev_limit_month < 1) { 259 prev_limit_year -= 1; 260 prev_limit_month += 12; 261 } 262 if (this.setting.month == prev_limit_month && this.setting.year == prev_limit_year) { 263 can_move = false; 264 } 265 } 266 267 if (!can_move) { 268 tag = "<td class='calbtn down-img' ><img src='" + this.setting.options.plugindir + "image/down-limit.png' ></td>"; 269 } 270 return tag; 271 }, 272 273 getNextMonthTag: function () { 274 var limit = this.setting.options["month_limit"]; 275 var tag = "<td class='calbtn up-img' onclick='bizCalendar.upMonth()' title='æ¬¡ã®æã¸' ><img src='" + this.setting.options.plugindir + "image/up.png' ></td>"; 276 if (limit == undefined || limit == "å¶éãªã") { 277 return tag; 278 } 279 var now = new Date(); 280 var now_year = now.getFullYear(); 281 var now_month = now.getMonth() + 1; 282 var can_move = true; 283 284 if (limit == "å¹´å ") { 285 if (this.setting.month == 12) { 286 can_move = false; 287 } 288 } else if (limit == "年度å ") { 289 if (this.setting.month == 3) { 290 can_move = false; 291 } 292 } else { 293 var next_limit = this.setting.options["nextmonthlimit"] == undefined ? 0 : this.setting.options["nextmonthlimit"]; 294 var next_limit_year = now_year; 295 var next_limit_month = now_month + Number(next_limit); 296 if (next_limit_month > 12) { 297 next_limit_year += 1; 298 next_limit_month -= 12; 299 } 300 if (this.setting.month == next_limit_month && this.setting.year == next_limit_year) { 301 can_move = false; 302 } 303 } 304 if (!can_move) { 305 tag = "<td class='calbtn up-img' ><img src='" + this.setting.options.plugindir + "image/up-limit.png' ></td>"; 306 } 307 return tag; 308 } 309};
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.