var w2utils = (function () { var tmp = {}; // for some temp variables var obj = { version : "1.4.3", settings : { "locale" : "ko-kr", "date_format" : "yyyy-mm-dd", "date_display" : "yyyy, Mon d", "time_format" : "hh:mi pm", "currencyPrefix" : "$", "currencySuffix" : "", "currencyPrecision" : 2, "groupSymbol" : ",", "decimalSymbol" : ".", "shortmonths" : ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "fullmonths" : ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], "shortdays" : ["월", "화", "수", "목", "금", "토", "일"], "fulldays" : ["월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"], "dataType" : 'HTTP', "phrases" : {} },
---- 이하 생략 ----
getMonthHTML: function (month, year) { var td = new Date(); var months = w2utils.settings.fullmonths; var days = w2utils.settings.fulldays; var daysCount = ['31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31']; var today = td.getFullYear() + '/' + (Number(td.getMonth()) + 1) + '/' + td.getDate(); // normalize date year = w2utils.isInt(year) ? parseInt(year) : td.getFullYear(); month = w2utils.isInt(month) ? parseInt(month) : td.getMonth() + 1; if (month > 12) { month -= 12; year++; } if (month < 1 || month === 0) { month += 12; year--; } if (year/4 == Math.floor(year/4)) { daysCount[1] = '29'; } else { daysCount[1] = '28'; } this.options.current = month + '/' + year;
td = new Date(year, month - 1, 1); var weekDay = td.getDay() + 1; // + 1을 더해서 출력일을 한칸 뒤로 미룬다. var tabDays = w2utils.settings.shortdays; var dayTitle = ''; for ( var i = 0, len = tabDays.length; i < len; i++) { dayTitle += '<td>' + tabDays[i] + '</td>'; } var html = '<div class="w2ui-calendar-title title">'+ ' <div class="w2ui-calendar-previous previous"> <div></div> </div>'+ ' <div class="w2ui-calendar-next next"> <div></div> </div> '+
// 캘린더의 타이틀 부분을 변경한다.
// months[month - 1] +', '+ year + year + '년, ' + months[month - 1] + '</div>'+ '<table class="w2ui-calendar-days" cellspacing="0">'+ ' <tr class="w2ui-day-title">' + dayTitle + '</tr>'+ ' <tr>';
var day = 1; for (var ci=1; ci<43; ci++) { if (weekDay === 0 && ci == 1) { for (var ti=0; ti<6; ti++) html += '<td class="w2ui-day-empty"> 5</td>'; ci += 6; } else { if (ci < weekDay || day > daysCount[month-1]) { html += '<td class="w2ui-day-empty"> </td>'; if ((ci) % 7 === 0) html += '</tr><tr>'; continue; } } var dt = year + '/' + month + '/' + day;
var className = ''; if (ci % 7 == 0) className = ' w2ui-saturday'; // 토요일 날짜를 맨 뒤로 이동한다. if (ci % 7 === 1) className = ' w2ui-sunday'; // 일요일 날짜를 맨 앞으로 이동한다. if (dt == today) className += ' w2ui-today';
var dspDay = day; var col = ''; var bgcol = ''; var tmp_dt = w2utils.formatDate(dt, this.options.format); if (this.options.colored && this.options.colored[tmp_dt] !== undefined) { // if there is predefined colors for dates tmp = this.options.colored[tmp_dt].split(':'); bgcol = 'background-color: ' + tmp[0] + ';'; col = 'color: ' + tmp[1] + ';'; } html += '<td class="'+ (this.inRange(tmp_dt) ? 'w2ui-date ' : 'w2ui-blocked') + className + '" style="'+ col + bgcol + '" date="'+ tmp_dt +'">'+ dspDay + '</td>'; if (ci % 7 === 0 || (weekDay === 0 && ci == 1)) html += '</tr><tr>'; day++; } html += '</tr></table>'; return html; },
|