').appendTo($columnNav);
});
}
}
function setClassCategories(){
$('.categories a').each(function(){
if(!$(this).hasClass('.urllist-category-link')){
$(this).addClass('urllist-category-link category-'+$(this).text());
}
});
}
setLocalNav();
setClassCategories();
//////////////////////////////////////////////////////////
/*
/* ã«ã¬ã³ãã¼
**/
var eventData;
var Calendar = function (elm) {
this.$elm = elm;
}
Calendar.prototype.init = function () {
this.$calendar = null;
this.calendarDate = {};
this.settings = {
year: 0,
month: 0,
weekValue: ['æ¥', 'æ', 'ç«', 'æ°´', 'æ¨', 'é', 'å'],
areaClass: 'calendar',
activeDateClass: 'active-date',
prevNavClass: 'prev',
nextNavClass: 'next',
sunClass: 'sun',
satClass: 'sat',
todayClass: 'today',
emptyClass: '',
headerFormat: 'yå¹´mæ',
emptyValue: ' '
}
var date = this.getDate();
this.calendarData = {
year: date.year,
month: date.month,
date: date
};
this.today = date.days;
this.currentMonth = date.month;
this.currentYear = date.year;
this.setup();
}
Calendar.prototype.getDate = function () {
var date = new Date();
var toYear = date.getFullYear();
var toMonth = date.getMonth() + 1;
var toDays = date.getDate();
var result = {};
result = {
year: toYear,
month: toMonth,
days: toDays
};
return result;
};
Calendar.prototype.getPrevDate = function () {
var result = {
year: this.calendarData.year,
month: this.calendarData.month
};
if (result.month === 1) {
result.year--;
result.month = 12;
} else {
result.month--;
}
return result;
};
Calendar.prototype.getNextDate = function () {
var result = {
year: this.calendarData.year,
month: this.calendarData.month
};
if (result.month === 12) {
result.year++;
result.month = 1;
} else {
result.month++;
}
return result;
};
Calendar.prototype.zeroFormat = function (v, n) {
var vl = String(v).length;
if (n > vl) {
return (new Array((n - vl) + 1).join(0)) + v;
} else {
return v;
}
};
Calendar.prototype.weekClass = function (weekNumber, targetDate) {
var date = this.getDate();
var classArr = [];
var classStr = '';
if (weekNumber === 0) {
classArr.push(this.settings.sunClass);
} else if (weekNumber === 6) {
classArr.push(this.settings.satClass);
}
if (targetDate && targetDate === '' + date.year + this.zeroFormat(date.month, 2) + this.zeroFormat(date.days, 2)) {
classArr.push(this.settings.todayClass);
}
if (classArr.length > 0) {
classStr = ' class="' + classArr.join(' ') + '"';
}
return classStr;
};
Calendar.prototype.createBaseHTML = function () {
var htmlStr = '';
htmlStr += '\n
\n';
htmlStr += '
\n';
htmlStr += '
\n';
htmlStr += '\n';
htmlStr += '
\n';
htmlStr += '
\n';
htmlStr += '
\n';
htmlStr += '
\n';
htmlStr += '
\n';
this.$calendar = $(htmlStr);
this.$calendar.addClass(this.settings.areaClass);
this.$calendar.find('.calendar-month').addClass(this.settings.activeDateClass);
this.$calendar.find('.calendar-prev').addClass(this.settings.prevNavClass);
this.$calendar.find('.calendar-next').addClass(this.settings.nextNavClass);
};
Calendar.prototype.createBody = function () {
var self = this;
var year = this.calendarData.year;
var month = this.calendarData.month;
var lastdays = new Date(year, month, 0);
var forDate = new Date(year, month - 1, 1);
var emptyCell = '
' + this.settings.emptyValue + '
\n';
var rowCount = 1;
var htmlStr = '';
var i;
var j;
var len;
htmlStr = '
\n';
$.each(this.settings.weekValue, function (i, value) {
htmlStr += '
' + value + '
\n';
});
htmlStr += '
\n';
htmlStr += '
\n';
// å§ãä½ç½
if (forDate.getDay() > 0) {
for (j = 0; j < forDate.getDay(); j++) {
htmlStr += emptyCell;
}
}
// æ¥ä»
for (i = 1, len = lastdays.getDate(); i <= len; i++) {
forDate = new Date(year, month - 1, i);
var dataLink = "";
var eventName = "";
var eventCate = "";
var linkFlag = false;
var getCateClass = function(cate){
var cls = ""
switch(cate) {
case "hard":
cls = "cate1"; //ãã¯ãã«ã«ã¹ãã«
break;
case "soft":
cls = "cate2"; //ãã¥ã¼ãã³ã¹ãã«
break;
case "woman":
cls = "cate3"; // 女æ§åã
break;
case "other":
cls = "cate4"; // CODE.SCORE
break;
}
return cls;
}
for (var j in eventData) {
if (Number(eventData[j].year) === year && Number(eventData[j].month) === month && Number(eventData[j].day) === i) {
linkPath = eventData[j].url;
eventName = eventData[j].title;
eventCate = eventData[j].category;
linkFlag = true;
}
}
if(linkFlag && this.today === i && this.currentMonth === this.calendarData.month && this.currentYear === this.calendarData.year){
// ä»å¹´ã§ãããä»æã§ãããä»æ¥ã§ãããã¤ãã³ãããã
var cls = getCateClass(eventCate);
htmlStr += '