{"id":190787,"date":"2014-09-21T00:52:03","date_gmt":"2014-09-20T15:52:03","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2014\/09\/21\/biz-calendar%e3%82%92%e6%9c%88%e6%9b%9c%e3%81%af%e3%81%98%e3%81%be%e3%82%8a%e3%81%ab%e5%a4%89%e6%9b%b4%e3%81%97%e3%81%9f%e3%81%84\/"},"modified":"2014-09-21T00:52:03","modified_gmt":"2014-09-20T15:52:03","slug":"biz-calendar%e3%82%92%e6%9c%88%e6%9b%9c%e3%81%af%e3%81%98%e3%81%be%e3%82%8a%e3%81%ab%e5%a4%89%e6%9b%b4%e3%81%97%e3%81%9f%e3%81%84","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/biz-calendar%e3%82%92%e6%9c%88%e6%9b%9c%e3%81%af%e3%81%98%e3%81%be%e3%82%8a%e3%81%ab%e5%a4%89%e6%9b%b4%e3%81%97%e3%81%9f%e3%81%84\/","title":{"rendered":"Biz Calendar\u3092\u6708\u66dc\u306f\u3058\u307e\u308a\u306b\u5909\u66f4\u3057\u305f\u3044"},"content":{"rendered":"<p>\u304a\u4e16\u8a71\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u30bd\u30d5\u30c8\u300cBiz Calendar\u300d\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u304c<br \/>\n\u65e5\u66dc\u306f\u3058\u307e\u308a\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u3092\u6708\u66dc\u59cb\u307e\u308a\u306b\u5909\u66f4\u3057\u305f\u3044\u3068\u8003\u3048\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u81ea\u5206\u306a\u308a\u306b\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8abf\u3079\u305f\u6240\u3001<br \/>\n\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u63db\u3048\u308c\u3070\u51fa\u6765\u305d\u3046\u304b\u306a\u3068\u601d\u3063\u305f\u306e\u3067\u3059\u304c\u3001<br \/>\n\u306a\u304b\u306a\u304b\u4e0a\u624b\u304f\u9032\u3081\u3089\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u30fb\u3053\u3061\u3089\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30fc\u30c9\u306e\u66f8\u304d\u63db\u3048\u3067\u5b9f\u73fe\u53ef\u80fd\u306a\u306e\u304b\uff1f<br \/>\n\u30fb\u5b9f\u73fe\u53ef\u80fd\u3067\u3042\u308c\u3070\u3001\u3069\u306e\u500b\u6240\u3092\u66f8\u304d\u304b\u3048\u308c\u3070\u826f\u3044\u306e\u304b\uff1f<\/p>\n<p>\u3092\u3054\u6559\u6388\u3044\u305f\u3060\u3051\u305f\u3089\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre><code>jQuery(document).ready(function($) {\n\tif ($(&quot;#biz_calendar&quot;).size() == 0) {\n\t\treturn;\n\t}\n\tbizCalendar();\n});\n\nvar currentSetting = null;\n\nvar bizCalendar = function() {\n\tvar options = window.bizcalOptions;\n\tvar now = new Date();\n\n\tvar setting = {\n\t\tyear : now.getFullYear(),\n\t\tmonth : now.getMonth() + 1,\n\t\toptions : options\n\t};\n\twindow.currentSetting = setting;\n\tdocument.getElementById(&#039;biz_calendar&#039;).innerHTML = getCalendar(setting);\n}\n\nfunction downMonth() {\n\tif (currentSetting.month == 1) {\n\t\tcurrentSetting.month = 12;\n\t\tcurrentSetting.year = currentSetting.year - 1;\n\t} else {\n\t\tcurrentSetting.month = currentSetting.month - 1;\n\t}\n\tdocument.getElementById(&#039;biz_calendar&#039;).innerHTML = getCalendar(currentSetting);\n}\n\nfunction upMonth() {\n\tif (currentSetting.month == 12) {\n\t\tcurrentSetting.month = 1;\n\t\tcurrentSetting.year = currentSetting.year + 1;\n\t} else {\n\t\tcurrentSetting.month = currentSetting.month + 1;\n\t}\n\tdocument.getElementById(&#039;biz_calendar&#039;).innerHTML = getCalendar(currentSetting);\n}\n\nfunction goToday() {\n\tvar now = new Date();\n\tif ( currentSetting.month == now.getMonth() + 1 &amp;&amp; currentSetting.year == now.getFullYear()){\n\t\treturn;\n\t}\n\tcurrentSetting.year = now.getFullYear();\n\tcurrentSetting.month = now.getMonth() + 1;\n\tdocument.getElementById(&#039;biz_calendar&#039;).innerHTML = getCalendar(currentSetting);\n}\n\nvar getCalendar = function(setting) {\n\tvar weekArray = new Array(&quot;\u65e5&quot;, &quot;\u6708&quot;, &quot;\u706b&quot;, &quot;\u6c34&quot;, &quot;\u6728&quot;, &quot;\u91d1&quot;, &quot;\u571f&quot;);\n\tvar start_day = getStartDayOfMonth(setting.year, setting.month);\n\tvar last_date = getEndDateOfMonth(setting.year, setting.month);\n\tvar calLine = Math.ceil((start_day + last_date) \/ 7);\n\tvar calArray = new Array(7 * calLine);\n\n\t\/\/ \u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u65e5\u4ed8\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\n\tfor ( var i = 0; i &lt; 7 * calLine; i++) {\n\t\tif (i &gt;= last_date) {\n\t\t\tbreak;\n\t\t}\n\t\tcalArray[i + start_day] = i + 1;\n\t}\n\n\t\/\/ \u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u30bf\u30a4\u30c8\u30eb\n\tvar title = setting.year + &quot;\u5e74 &quot; + setting.month + &quot;\u6708&quot;;\n\tvar html = &quot;&lt;table class=&#039;bizcal&#039; &gt;&lt;tr&gt;&quot;;\n\thtml += &quot;&lt;td class=&#039;calmonth&#039; colspan=&#039;4&#039;&gt;&quot; + title + &quot;&lt;\/td&gt;&quot;;\n\thtml += getPrevMonthTag();\n\thtml += &quot;&lt;td class=&#039;calbtn today-img&#039; onclick=&#039;goToday()&#039; title=&#039;\u4eca\u6708\u3078&#039; &gt;&lt;img src=&#039;&quot; + bizcalplugindir + &quot;image\/today.png&#039; &gt;&lt;\/td&gt;&quot;;\n\thtml += getNextMonthTag();\n\thtml += &quot;&lt;\/tr&gt;&quot;;\n\n\t\/\/ \u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u66dc\u65e5\u884c\n\thtml += &quot;&lt;tr&gt;&quot;;\n\tfor ( var i = 0; i &lt; weekArray.length; i++) {\n\t\thtml += &quot;&lt;th&gt;&quot;;\n\t\thtml += weekArray[i];\n\t\thtml += &quot;&lt;\/th&gt;&quot;;\n\t}\n\thtml += &quot;&lt;\/tr&gt;&quot;;\n\n\t\/\/ \u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u65e5\u4ed8\n\tfor ( var i = 0; i &lt; calLine; i++) {\n\t\thtml += &quot;&lt;tr&gt;&quot;;\n\t\tfor ( var j = 0; j &lt; 7; j++) {\n\t\t\tvar date = (calArray[j + (i * 7)] != undefined) ? calArray[j\n\t\t\t\t\t+ (i * 7)] : &quot;&quot;;\n\t\t\thtml += &quot;&lt;td&quot; + getDateClass(date, j) + &quot;&gt;&quot;;\n\t\t\thtml += getDateTag(date, j);\n\t\t\thtml += &quot;&lt;\/td&gt;&quot;;\n\t\t}\n\t\thtml += &quot;&lt;\/tr&gt;&quot;;\n\t}\n\thtml += &quot;&lt;\/table&gt;&quot;;\n\n\t\/\/ \u8aac\u660e\u6587\n\thtml += getHolidayTitle();\n\thtml += getEventdayTitle();\n\treturn html;\n}\n\nfunction getHolidayTitle() {\n\tif (currentSetting.options.holiday_title != &quot;&quot;) {\n\t\treturn &quot;&lt;p&gt;&lt;span class=&#039;boxholiday&#039;&gt;&lt;\/span&gt;&quot;\n\t\t\t\t+ currentSetting.options.holiday_title + &quot;&lt;\/p&gt;&quot;;\n\t}\n\treturn &quot;&quot;;\n}\n\nfunction getEventdayTitle() {\n\n\tif (currentSetting.options.eventday_title == &quot;&quot;) {\n\t\treturn &quot;&quot;;\n\t}\n\n\tvar tag = &quot;&lt;p&gt;&lt;span class=&#039;boxeventday&#039;&gt;&lt;\/span&gt;&quot;\n\n\tif (currentSetting.options.eventday_url == &quot;&quot;) {\n\t\ttag += currentSetting.options.eventday_title + &quot;&lt;\/p&gt;&quot;;\n\t\treturn tag;\n\t}\n\n\ttag += &quot;&lt;a href=&#039;&quot; + currentSetting.options.eventday_url + &quot;&#039;&gt;&quot;\n\t\t\t+ currentSetting.options.eventday_title + &quot;&lt;\/a&gt;&lt;\/p&gt;&quot;;\n\treturn tag;\n}\n\nvar getDateClass = function(date, day) {\n\n\tif (date == undefined || date == &quot;&quot;) {\n\t\treturn &quot;&quot;;\n\t}\n\tvar today = isToday(date);\n\tvar attr = &quot;&quot;;\n\n\tswitch (getDateType(date, day)) {\n\tcase &quot;EVENTDAY&quot;:\n\t\tattr = today == false ? &quot; class=&#039;eventday&#039; &quot;\n\t\t\t\t: &quot; class=&#039;eventday today&#039; &quot;;\n\t\treturn attr;\n\tcase &quot;HOLIDAY&quot;:\n\t\tattr = today == false ? &quot; class=&#039;holiday&#039; &quot; : &quot; class=&#039;holiday today&#039; &quot;;\n\t\treturn attr;\n\tdefault:\n\t\tattr = today == false ? &quot;&quot; : &quot; class=&#039;today&#039; &quot;;\n\t\treturn attr;\n\t}\n\treturn &quot;&quot;;\n}\n\nfunction isToday(date) {\n\tvar now = new Date();\n\tif (now.getFullYear() == currentSetting.year\n\t\t\t&amp;&amp; now.getMonth() + 1 == currentSetting.month\n\t\t\t&amp;&amp; now.getDate() == date) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nvar getDateTag = function(date, day) {\n\n\tif (date == undefined || date == &quot;&quot;) {\n\t\treturn &quot;&quot;;\n\t}\n\n\tvar url = currentSetting.options.eventday_url;\n\tif (url == &quot;&quot;) {\n\t\treturn date;\n\t}\n\tif (getDateType(date, day) == &quot;EVENTDAY&quot;) {\n\t\treturn tag = &quot;&lt;a href=&#039;&quot; + url + &quot;&#039;&gt;&quot; + date + &quot;&lt;\/a&gt;&quot;;\n\t}\n\n\treturn date;\n}\n\nvar getDateType = function(date, day) {\n\n\tvar fulldate = getFormatDate(currentSetting.year, currentSetting.month,\n\t\t\tdate);\n\n\t\/\/ \u30a4\u30d9\u30f3\u30c8\u65e5\n\tif (currentSetting.options.eventdays.indexOf(fulldate) != -1) {\n\t\treturn &quot;EVENTDAY&quot;;\n\t}\n\n\t\/\/ \u81e8\u6642\u55b6\u696d\u65e5\n\tif (currentSetting.options.temp_weekdays.indexOf(fulldate) != -1) {\n\t\treturn &quot;WEEKDAY&quot;;\n\t}\n\n\t\/\/ \u81e8\u6642\u4f11\u696d\u65e5\n\tif (currentSetting.options.temp_holidays.indexOf(fulldate) != -1) {\n\t\treturn &quot;HOLIDAY&quot;;\n\t}\n\n\t\/\/ \u5b9a\u4f11\u65e5\n\tvar dayName = [ &quot;sun&quot;, &quot;mon&quot;, &quot;tue&quot;, &quot;wed&quot;, &quot;thu&quot;, &quot;fri&quot;, &quot;sat&quot; ];\n\tif (currentSetting.options[dayName[day]] == &quot;on&quot;) {\n\t\treturn &quot;HOLIDAY&quot;;\n\t}\n\n\t\/\/ \u795d\u65e5\n\tif (isHoliday(fulldate)) {\n\t\treturn &quot;HOLIDAY&quot;;\n\t}\n\treturn &quot;WEEKDAY&quot;;\n}\n\nvar isHoliday = function(fulldate) {\n\tif (currentSetting.options[&quot;holiday&quot;] == &quot;off&quot;) {\n\t\treturn false;\n\t}\n\tholidays = currentSetting.options[&quot;holiday_cache&quot;];\n\tif (holidays != undefined &amp;&amp; holidays[fulldate] != null) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nvar getFormatDate = function(y, m, d) {\n\tm = m &lt; 10 ? &quot;0&quot; + m : m;\n\td = d &lt; 10 ? &quot;0&quot; + d : d;\n\treturn y + &quot;-&quot; + m + &quot;-&quot; + d;\n}\n\nvar getEndDateOfMonth = function(year, month) {\n\tvar date = new Date(year, month, 0);\n\treturn date.getDate();\n}\n\nvar getStartDayOfMonth = function(year, month) {\n\tvar date = new Date(year, month - 1, 1);\n\treturn date.getDay();\n}\n\nvar getPrevMonthTag = function() {\n\tvar limit = currentSetting.options[&quot;month_limit&quot;];\n\tvar tag = &quot;&lt;td class=&#039;calbtn down-img&#039; onclick=&#039;downMonth()&#039; title=&#039;\u524d\u306e\u6708\u3078&#039; &gt;&lt;img src=&#039;&quot; + bizcalplugindir + &quot;image\/down.png&#039; &gt;&lt;\/td&gt;&quot;;\n\tif (limit == undefined || limit == &quot;\u5236\u9650\u306a\u3057&quot;) {\n\t\treturn tag;\n\t}\n\tvar can_move = true;\n\tvar now = new Date();\n\tvar now_year =  now.getFullYear();\n\tvar now_month = now.getMonth()  + 1;\n\n\tif (limit == &quot;\u5e74\u5185&quot;) {\n\t\tif (currentSetting.month == 1) {\n\t\t\tcan_move = false;\n\t\t}\n\t} else if (limit == &quot;\u5e74\u5ea6\u5185&quot;) {\n\t\tif (currentSetting.month == 4) {\n\t\t\tcan_move = false;\n\t\t}\n\t} else {\n\t\tvar prev_limit = currentSetting.options[&quot;prevmonthlimit&quot;] == undefined ? 0 : currentSetting.options[&quot;prevmonthlimit&quot;];\n\t\tvar prev_limit_year = now_year;\n\t\tvar prev_limit_month = now_month - Number(prev_limit);\n\t\tif ( prev_limit_month &lt; 1){\n\t\t\tprev_limit_year -= 1;\n\t\t\tprev_limit_month += 12;\n\t\t}\n\t\tif (currentSetting.month == prev_limit_month &amp;&amp; currentSetting.year == prev_limit_year) {\n\t\t\tcan_move = false;\n\t\t}\n\t}\n\n\tif (!can_move) {\n\t\ttag = &quot;&lt;td class=&#039;calbtn down-img&#039; &gt;&lt;img src=&#039;&quot; + bizcalplugindir + &quot;image\/down-limit.png&#039; &gt;&lt;\/td&gt;&quot;;\n\t}\n\treturn tag;\n}\n\nvar getNextMonthTag = function() {\n\tvar limit = currentSetting.options[&quot;month_limit&quot;];\n\tvar tag = &quot;&lt;td class=&#039;calbtn up-img&#039; onclick=&#039;upMonth()&#039; title=&#039;\u6b21\u306e\u6708\u3078&#039; &gt;&lt;img src=&#039;&quot; + bizcalplugindir + &quot;image\/up.png&#039; &gt;&lt;\/td&gt;&quot;;\n\tif (limit == undefined || limit == &quot;\u5236\u9650\u306a\u3057&quot;) {\n\t\treturn tag;\n\t}\n\tvar can_move = true;\n\tvar now = new Date();\n\tvar now_year = now.getFullYear();\n\tvar now_month = now.getMonth() + 1;\n\n\tif (limit == &quot;\u5e74\u5185&quot;) {\n\t\tif (currentSetting.month == 12) {\n\t\t\tcan_move = false;\n\t\t}\n\t} else if (limit == &quot;\u5e74\u5ea6\u5185&quot;) {\n\t\tif (currentSetting.month == 3) {\n\t\t\tcan_move = false;\n\t\t}\n\t} else {\n\t\tvar next_limit = currentSetting.options[&quot;nextmonthlimit&quot;] == undefined ? 0 : currentSetting.options[&quot;nextmonthlimit&quot;];\n\t\tvar next_limit_year = now_year;\n\t\tvar next_limit_month = now_month + Number(next_limit);\n\t\tif ( next_limit_month &gt; 12){\n\t\t\tnext_limit_year += 1;\n\t\t\tnext_limit_month -= 12;\n\t\t}\n\t\tif (currentSetting.month == next_limit_month &amp;&amp; currentSetting.year == next_limit_year) {\n\t\t\tcan_move = false;\n\t\t}\n\t}\n\n\tif ( !can_move) {\n\t\ttag = &quot;&lt;td class=&#039;calbtn up-img&#039; &gt;&lt;img src=&#039;&quot; + bizcalplugindir + &quot;image\/up-limit.png&#039; &gt;&lt;\/td&gt;&quot;;\n\t}\n\treturn tag;\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-190787","topic","type-topic","status-closed","hentry","topic-tag-14105","topic-tag-14060","topic-tag-biz-calendar","topic-tag-bizcalendar"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/190787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/190787\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=190787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}