',
''].join('');
};
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth();
$.ajax(
{type:'GET',
url:'/' + ['archive', year, month+1].join('/'),
success: function(html){
var head_elm = document.getElementsByTagName('head')[0];
head_elm.appendChild(style_elm);
var actives = {};
Array.prototype.forEach.call($('time', $.parseHTML(html)),function(elm){
actives[parseInt(elm.innerHTML.split(/-/)[2])] = true;
});
$(document).ready(function(){
var label = ['
', year.toString(), m2Month(month), '
'].join('');
var $cal_box = $('#cal-box');
if($cal_box.length === 0){return;}
$cal_box.html(label + createMonthDaysArray(year, month).map(date2Elm).join(''));;
Array.prototype.forEach.call($cal_box.find('a'),function(elm, count){
var date = count + 1;
var $elm = $(elm);
if(actives[date]){
$elm.addClass('active');
}else{
$elm.addClass('disable');
$elm.click(function(event){
event.preventDefault();
});
}
});
});
}
});
}(jQuery);