g_json = ''; $(function() { // $関数の割り当てを初期化 jQuery.noConflict(); // 改めて変数を割り当てる var $j = jQuery; $( '#datepicker' ).datepicker({ /* showButtonPanel: true, */ minDate: "+0m", maxDate: "+365d", onSelect: function(dateText) { document.getElementById('loading').style.display = 'block'; var res = document.getElementById('xhr-div_1'); res.innerHTML = ''; nsp_calendar_SetScheduleDay(dateText.split('/')[2]); }, onChangeMonthYear: function(year, month, obj) { document.getElementById('loading').style.display = 'block'; var res = document.getElementById('xhr-div_1'); res.innerHTML = ''; nsp_calendar_SetScheduleMonth(year + '' + ("0"+month).slice(-2)); } }); $(document).ready(function() { var hiduke = new Date(); var year = hiduke.getFullYear(); var month = ("0"+(hiduke.getMonth() + 1)).slice(-2); nsp_calendar_SetScheduleMonth(year + '' + month); }); function addCustomInformation(dt) { setTimeout(function() { $('.ui-datepicker-calendar td:contains(' + dt + ')').filter(function() { var date = $(this).text(); if(date == dt) return /\d/.test(date); }).find("a").attr('data-custom', ' '); }, 0)}; function nsp_calendar_SetScheduleMonth(dt) { var objXHR = new XMLHttpRequest(); objXHR.open('GET', 'https://api-nursepress.jpn.org/api/calendar/?date=' + dt, true); objXHR.responseType = "text"; objXHR.onreadystatechange = function() { if (objXHR.readyState === 4 && objXHR.status === 200) { var res = document.getElementById('xhr-div_1'); g_json = JSON.parse(objXHR.responseText); var hiduke = new Date(); var _year = hiduke.getFullYear(); var _month = ("0"+(hiduke.getMonth() + 1)).slice(-2); var _today = hiduke.getDate(); for(var i=0;i

' + g_json[i].title + '

会長名/大会長:' + g_json[i].name.replace(' ','').replace('  ', ' ') + '場所:' + g_json[i].place + '

'; } else { if(parseInt(g_json[i].date_min) >= parseInt(_today)) { res.innerHTML += '
  • ' + g_json[i].title + '

    会長名/大会長:' + g_json[i].name.replace(' ','').replace('  ', ' ') + '場所:' + g_json[i].place + '

  • '; } else if(g_json[i].date_max !== '') { if(parseInt(g_json[i].date_min) <= parseInt(_today) && parseInt(g_json[i].date_max) >= parseInt(_today)) { res.innerHTML += '
  • ' + g_json[i].title + '

    会長名/大会長:' + g_json[i].name.replace(' ','').replace('  ', ' ') + '場所:' + g_json[i].place + '

  • '; } } } addCustomInformation(g_json[i].date_min); if(g_json[i].date_max !== '') for(var j =parseInt(g_json[i].date_min);j <= parseInt(g_json[i].date_max);j++) addCustomInformation(j); } document.getElementById('loading').style.display = 'none'; } }; objXHR.send(null); } function nsp_calendar_SetScheduleDay(day) { var res = document.getElementById('xhr-div_1'); var _cnt = 0; for(var i=0;i

    ' + g_json[i].title + '

    会長名/大会長:' + g_json[i].name.replace('  ', ' ') + '場所:' + g_json[i].place + '

    '; _cnt++; } else if(g_json[i].date_max !== '') { if(parseInt(g_json[i].date_min) <= parseInt(day) && parseInt(g_json[i].date_max) >= parseInt(day)) { res.innerHTML += '
  • ' + g_json[i].title + '

    会長名/大会長:' + g_json[i].name.replace('  ', ' ') + '場所:' + g_json[i].place + '

  • '; _cnt++; } } addCustomInformation(g_json[i].date_min); if(g_json[i].date_max !== '') for(var j =parseInt(g_json[i].date_min);j <= parseInt(g_json[i].date_max);j++) addCustomInformation(j); } if(_cnt === 0) res.innerHTML += '
  • 予定はありません。
  • '; document.getElementById('loading').style.display = 'none'; } });