{"id":1265,"date":"2012-08-03T20:20:21","date_gmt":"2012-08-03T11:20:21","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=1265"},"modified":"2013-12-29T20:08:01","modified_gmt":"2013-12-29T11:08:01","slug":"post-1265","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/jquery\/1265","title":{"rendered":"FullCalendar \u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba"},"content":{"rendered":"<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306e\u306b\u4fbf\u5229\u306ajQuery\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u300cFullCalendar\u300d\u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u884c\u3063\u305f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u30e1\u30e2\u66f8\u304d\u3067\u3059\u3002<br \/>\n<a href=\"http:\/\/arshaw.com\/fullcalendar\/\">FullCalendar <\/a><br \/>\n<a href=\"http:\/\/arshaw.com\/fullcalendar\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000000-1024x736.jpg\" alt=\"\" title=\"WS000000\" width=\"1024\" height=\"736\" class=\"alignnone size-large wp-image-1292\" \/><\/a><\/p>\n<p>DEMO<br \/>\n<a href=\"http:\/\/shimz.me\/example\/fullcalenar\/01\/before.html\">before<\/a><br \/>\n<a href=\"http:\/\/shimz.me\/example\/fullcalenar\/01\/\">after<\/a><\/p>\n<p>\u4f7f\u7528\u3057\u305f\u306e\u306f\u3001fullcalendar\u306ever 1.5.3\u3067\u3059\u3002<\/p>\n<p><strong>\u30e9\u30d9\u30eb\u306e\u5909\u66f4<\/strong><br \/>\n<a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000001.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000001-150x104.jpg\" alt=\"\" title=\"WS000001\" width=\"150\" height=\"104\" class=\"alignnone size-thumbnail wp-image-1293\" \/><\/a><br \/>\n<a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000002.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000002-150x100.jpg\" alt=\"\" title=\"WS000002\" width=\"150\" height=\"100\" class=\"alignnone size-thumbnail wp-image-1294\" \/><\/a><\/p>\n<pre class=\"start-line:64 lang:default decode:true \" title=\"fullcalendar before\" >\r\n\tmonthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],\r\n\tmonthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],\r\n\tdayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],\r\n\tdayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],\r\n\r\n<\/pre>\n<pre class=\"start-line:64 lang:default decode:true \" title=\"fullcalendar.js after\" >\tmonthNames: ['\uff11\u6708','\uff12\u6708','\uff13\u6708','\uff14\u6708','\uff15\u6708','\uff16\u6708','\uff17\u6708','\uff18\u6708','\uff19\u6708','\uff11\uff10\u6708','\uff11\uff11\u6708','\uff11\uff12\u6708'],\r\n\tmonthNamesShort: ['\uff11\u6708','\uff12\u6708','\uff13\u6708','\uff14\u6708','\uff15\u6708','\uff16\u6708','\uff17\u6708','\uff18\u6708','\uff19\u6708','\uff11\uff10\u6708','\uff11\uff11\u6708','\uff11\uff12\u6708'],\r\n\tdayNames: ['\u65e5\u66dc\u65e5','\u6708\u66dc\u65e5','\u706b\u66dc\u65e5','\u6c34\u66dc\u65e5','\u6728\u66dc\u65e5','\u91d1\u66dc\u65e5','\u571f\u66dc\u65e5'],\r\n\tdayNamesShort: ['\u65e5','\u6708','\u706b','\u6c34','\u6728','\u91d1','\u571f'],\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u6642\u523b\u306e\u8868\u8a18\u3092\u5909\u66f4\uff08Month-view\uff09<\/strong><\/p>\n<p><a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000004.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000004.jpg\" alt=\"\" title=\"WS000004\" width=\"128\" height=\"108\" class=\"alignnone size-full wp-image-1295\" \/><\/a><br \/>\n<a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000003.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000003.jpg\" alt=\"\" title=\"WS000003\" width=\"129\" height=\"108\" class=\"alignnone size-full wp-image-1296\" \/><\/a><br \/>\n<\/p>\n<pre class=\"start-line:57 lang:js decode:true \" title=\"fullcalendar.js before\" >\ttimeFormat: { \/\/ for event elements\r\n\t\t'': 'h(:mm)t' \/\/ default\r\n\t},\r\n<\/pre>\n<pre class=\"start-line:57 lang:js decode:true \" title=\"fullcalendar.js after\" >\ttimeFormat: { \/\/ for event elements\r\n\t\t'': 'H:mm' \/\/ default\r\n\t},\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u6642\u523b\u306e\u8868\u8a18\u3092\u5909\u66f4\uff08Week-view, Day-view\uff09<\/strong><br \/>\n<a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000006.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000006-61x150.jpg\" alt=\"\" title=\"WS000006\" width=\"61\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1298\" \/><\/a><br \/>\n<a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000005.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/08\/WS000005-63x150.jpg\" alt=\"\" title=\"WS000005\" width=\"63\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1297\" \/><\/a><\/p>\n<pre class=\"start-line:2809 lang:js decode:true \" title=\"fullcalendar.js before\" >\taxisFormat: 'h(:mm)tt',\r\n\ttimeFormat: {\r\n\t\tagenda: 'h:mm{ - h:mm}'\r\n\t},\r\n<\/pre>\n<pre class=\"start-line:2809 lang:js decode:true \" title=\"fullcalendar.js after\" >\taxisFormat: 'H:mm',\r\n\ttimeFormat: {\r\n\t\tagenda: 'H:mm{ - H:mm}'\r\n\t},\r\n<\/pre>\n<p>timeFormat\u3067\u6307\u5b9a\u3067\u304d\u308b\u66f8\u5f0f\u306f\u30011554\u884c\u76ee\u8fba\u308a\u306b\u8a18\u8ff0\u304c\u3042\u308b\u306e\u3067\u305d\u3053\u3092\u53c2\u7167<\/p>\n<pre class=\"start-line:1554 lang:js decode:true \" title=\"fullcalendar.js\" >var dateFormatters = {\r\n\ts\t: function(d)\t{ return d.getSeconds() },\r\n\tss\t: function(d)\t{ return zeroPad(d.getSeconds()) },\r\n\tm\t: function(d)\t{ return d.getMinutes() },\r\n\tmm\t: function(d)\t{ return zeroPad(d.getMinutes()) },\r\n\th\t: function(d)\t{ return d.getHours() % 12 || 12 },\r\n\thh\t: function(d)\t{ return zeroPad(d.getHours() % 12 || 12) },\r\n\tH\t: function(d)\t{ return d.getHours() },\r\n\tHH\t: function(d)\t{ return zeroPad(d.getHours()) },\r\n\td\t: function(d)\t{ return d.getDate() },\r\n\tdd\t: function(d)\t{ return zeroPad(d.getDate()) },\r\n\tddd\t: function(d,o)\t{ return o.dayNamesShort[d.getDay()] },\r\n\tdddd: function(d,o)\t{ return o.dayNames[d.getDay()] },\r\n\tM\t: function(d)\t{ return d.getMonth() + 1 },\r\n\tMM\t: function(d)\t{ return zeroPad(d.getMonth() + 1) },\r\n\tMMM\t: function(d,o)\t{ return o.monthNamesShort[d.getMonth()] },\r\n\tMMMM: function(d,o)\t{ return o.monthNames[d.getMonth()] },\r\n\tyy\t: function(d)\t{ return (d.getFullYear()+'').substring(2) },\r\n\tyyyy: function(d)\t{ return d.getFullYear() },\r\n\tt\t: function(d)\t{ return d.getHours() &lt; 12 ? 'a' : 'p' },\r\n\ttt\t: function(d)\t{ return d.getHours() &lt; 12 ? 'am' : 'pm' },\r\n\tT\t: function(d)\t{ return d.getHours() &lt; 12 ? 'A' : 'P' },\r\n\tTT\t: function(d)\t{ return d.getHours() &lt; 12 ? 'AM' : 'PM' }, \tu\t: function(d)\t{ return formatDate(d, &quot;yyyy-MM-dd'T'HH:mm:ss'Z'&quot;) }, \tS\t: function(d)\t{ \t\tvar date = d.getDate(); \t\tif (date &gt; 10 &amp;&amp; date &lt; 20) {\r\n\t\t\treturn 'th';\r\n\t\t}\r\n\t\treturn ['st', 'nd', 'rd'][date%10-1] || 'th';\r\n\t}\r\n};\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/strong><\/p>\n<pre class=\"start-line:4530 lang:js decode:true \" title=\"fullcalendar.js before\" >\r\n\t\/\/ attaches eventClick, eventMouseover, eventMouseout\r\n\tfunction eventElementHandlers(event, eventElement) {\r\n\t\teventElement\r\n\t\t\t.click(function(ev) {\r\n\t\t\t\tif (!eventElement.hasClass('ui-draggable-dragging') &amp;&amp;\r\n\t\t\t\t\t!eventElement.hasClass('ui-resizable-resizing')) {\r\n\t\t\t\t\t\treturn trigger('eventClick', this, event, ev);\r\n\t\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.hover(\r\n\t\t\t\tfunction(ev) {\r\n\t\t\t\t\ttrigger('eventMouseover', this, event, ev);\r\n\t\t\t\t},\r\n\t\t\t\tfunction(ev) {\r\n\t\t\t\t\ttrigger('eventMouseout', this, event, ev);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\/\/ TODO: don't fire eventMouseover\/eventMouseout *while* dragging is occuring (on subject element)\r\n\t\t\/\/ TODO: same for resizing\r\n\t}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"start-line:4350 lang:js decode:true mark:10-14\" title=\"fullcalendar.js after\" >\t\/\/ attaches eventClick, eventMouseover, eventMouseout\r\n\tfunction eventElementHandlers(event, eventElement) {\r\n\t\teventElement\r\n\t\t\t.click(function(ev) {\r\n\t\t\t\tif (!eventElement.hasClass('ui-draggable-dragging') &amp;&amp;\r\n\t\t\t\t\t!eventElement.hasClass('ui-resizable-resizing')) {\r\n\t\t\t\t\t\treturn trigger('eventClick', this, event, ev);\r\n\t\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.dblclick(\r\n\t\t\t\tfunction(ev) {\r\n\t\t\t\t\treturn trigger('eventDblClick', this, event, ev);\r\n\t\t\t\t}\r\n\t\t\t)\r\n\t\t\t.hover(\r\n\t\t\t\tfunction(ev) {\r\n\t\t\t\t\ttrigger('eventMouseover', this, event, ev);\r\n\t\t\t\t},\r\n\t\t\t\tfunction(ev) {\r\n\t\t\t\t\ttrigger('eventMouseout', this, event, ev);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\/\/ TODO: don't fire eventMouseover\/eventMouseout *while* dragging is occuring (on subject element)\r\n\t\t\/\/ TODO: same for resizing\r\n\t}\r\n<\/pre>\n<p>\u4f7f\u3044\u65b9<\/p>\n<pre class=\"lang:js decode:true \" title=\"index.html eventDblClick\" >\r\n$('#calendar').fullCalendar({\r\n    eventDblClick: function(calEvent, jsEvent, view) {\r\n\r\n        alert('Event: ' + calEvent.title);\r\n        alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);\r\n        alert('View: ' + view.name);\r\n\r\n        \/\/ change the border color just for fun\r\n        $(this).css('border-color', 'red');\r\n\r\n    }\r\n});\r\n<\/pre>\n<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u305f\u969b\u306b\u51e6\u7406\u3092\u5b9f\u884c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u30a4\u30d9\u30f3\u30c8\u3092JSON\u3067\u8aad\u307f\u8fbc\u3080<\/strong><br \/>\n\u5168\u30a4\u30d9\u30f3\u30c8\u30c7\u30fc\u30bf\u3092\u4e00\u6c17\u306b\u8aad\u307f\u8fbc\u3080\u306e\u3067\u3042\u308c\u3070\u3001events\u306b\u30a4\u30d9\u30f3\u30c8\u30c7\u30fc\u30bf\u306e(json\u5f62\u5f0f)\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3059\u308c\u3070\u3044\u3044\u3060\u3051\u3002<br \/>\n\uff08\u8a73\u3057\u304f\u306f\u3001demos\u306e\u4e2d\u306ejson.html\u3092\u53c2\u7167)<\/p>\n<pre class=\"lang:js decode:true mark:3\" title=\"json.html before\" >\r\n\t\t$('#calendar').fullCalendar({\r\n\t\t\teditable: true,\r\n\t\t\tevents: &quot;json-events.php&quot;,\r\n\t\t\teventDrop: function(event, delta) {\r\n\t\t\t\talert(event.title + ' was moved ' + delta + ' daysn' +\r\n\t\t\t\t\t'(should probably update your database)');\r\n\t\t\t},\r\n\t\t\tloading: function(bool) {\r\n\t\t\t\tif (bool) $('#loading').show();\r\n\t\t\t\telse $('#loading').hide();\r\n\t\t\t}\r\n\r\n\t\t});\r\n<\/pre>\n<p>\u3067\u3082\u3001\u4e0a\u8a18\u306e\u65b9\u6cd5\u3067\u306f\u30a4\u30d9\u30f3\u30c8\u30c7\u30fc\u30bf\u304c\uff11\u5e74\u5206\uff0f\uff12\u5e74\u5206\u3068\u5897\u3048\u3066\u3044\u304f\u3068\u91cd\u304f\u306a\u308b\u3002<br \/>\n\u306a\u306e\u3067view\u306e\u5207\u308a\u66ff\u308f\u308a\u6642\u306b\u5fc5\u8981\u306a\u30a4\u30d9\u30f3\u30c8\u30c7\u30fc\u30bf\u3060\u3051\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"lang:js decode:true mark:3-17\" title=\"json.html after\" >$('#calendar').fullCalendar({\r\n\teditable: true,\r\n\tviewDisplay: function(view) {\r\n\t\t$.ajax({\r\n\t\t\turl: &quot;json-events.php&quot;,\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype:&quot;post&quot;,\r\n\t\t\tdata: {\r\n\t\t\t\t&quot;start&quot;: view.start.toString(),\r\n\t\t\t\t&quot;end&quot;: view.end.toString(),\r\n\t\t\t},\r\n\t\t\tsuccess: function(EventSource) {\r\n\t\t\t\t$('#calendar').fullCalendar('removeEvents');\r\n\t\t\t\t$('#calendar').fullCalendar('addEventSource', EventSource);\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\teventDrop: function(event, delta) {\r\n\t\talert(event.title + ' was moved ' + delta + ' daysn' +\r\n\t\t\t'(should probably update your database)');\r\n\t},\r\n\tloading: function(bool) {\r\n\t\tif (bool) $('#loading').show();\r\n\t\telse $('#loading').hide();\r\n\t}\r\n\r\n});\r\n<\/pre>\n<p>json-events.php\u3067\u306f\u3001\u53d7\u3051\u53d6\u3063\u305fstart,end\u306e\u5024\u3092\u3064\u304b\u3063\u3066\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3060\u3051\u3092json\u3067\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/category\/fullcalendar\">\u305d\u306e\u4ed6\u306eFllCalendar\u306e\u8a18\u4e8b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306e\u306b\u4fbf\u5229\u306ajQuery\u306e\u30d7\u30e9\u30b0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1292,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,22],"tags":[],"class_list":["post-1265","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fullcalendar","category-jquery","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=1265"}],"version-history":[{"count":50,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1265\/revisions"}],"predecessor-version":[{"id":1737,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1265\/revisions\/1737"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/1292"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=1265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=1265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=1265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}