October 2021
- Lectures
- YMSC Courses
- Conferences
- Seminars/Colloquiums
- Mini Courses
\n' +
'
';
},
monthInit: function (num) {
return this.month[num];
},
dateInit: function (num) {
return (num < 10 ? '0' : '') + num;
},
//获取当前选择的年月
setMonthAndDay: function () {
switch (this.eventName) {
case "load":
var current = new Date();
calUtil.showYear = current.getFullYear();
calUtil.showMonth = current.getMonth() + 1;
calUtil.curDay = current.getDate();
calUtil.curDate = calUtil.showYear + '-' + calUtil.dateInit(calUtil.showMonth) + '-' + calUtil.dateInit(calUtil.curDay);
this.eventName = '';
break;
case "current":
break;
}
},
bulidCal: function (iYear, iMonth) {
var aMonth = new Array();
aMonth[0] = this.weekStr;
var iDayOfFirst = new Date(iYear, iMonth - 1, 1).getDay();
var iDaysInMonth = new Date(iMonth, iMonth, 0).getDate();
var iVarDate = 1;
for (var w = 1, d = iDayOfFirst; w < 7 && iVarDate <= iDaysInMonth; w++, d = 0) {
aMonth[w] = new Array(7);
for (; d < aMonth[w].length; d++) {
if (iVarDate <= iDaysInMonth) {
aMonth[w][d] = iVarDate;
iVarDate++;
}
}
}
return aMonth;
},
before: function (lStr, rStr) {
return new Date(lStr).getTime() <= new Date(rStr).getTime();
},
getTodayNews: function (signList, week, yyMMdd) {
var todayNews = [];
for (var i = 0; i < signList.length; i++) {
var json = signList[i];
var sdate = json.sdate;
var edate = json.edate;
if (edate == '') {//如果只有当天
if (yyMMdd == sdate) todayNews.push(json);
} else {//结束时间也有,判断时间区间和周期都符合的条件
if (this.before(sdate, yyMMdd) && this.before(yyMMdd, edate)) {
if(json.week=='' || json.week=='[]' || json.week.indexOf(week) > -1)
todayNews.push(json);
}
}
}
return todayNews;
},
drawCal: function (iYear, iMonth, signList) {
var myMonth = this.bulidCal(iYear, iMonth);
var htmls = new Array();
htmls.push('
');
for (var i = 0; i < myMonth[0].length; i++) htmls.push("- " + myMonth[0][i] + "
");
htmls.push("
");
htmls.push('
');
var srtYearMonth = iYear + '-' + this.dateInit(iMonth) + '-';
//更多地址 需要初始化下.此处性能优化
var + (this.ontDayUrl.indexOf("?") >-1 ? '&' : '?')+'day=';
for (var w = 1; w < myMonth.length; w++) {
for (var d = 0; d < 7; d++) {
if (myMonth[w][d] == undefined) {
htmls.push('-
');
} else {//
var yymmdd = srtYearMonth + this.dateInit(myMonth[w][d]);
var todayNews = this.getTodayNews(signList, d, yymmdd);
var cube = '';
var list = '';
if (todayNews.length > 0) {
for (var i = 0; i < todayNews.length; i++) {
var json = todayNews[i]
var color = this.colorCube[json.treeid];
if (color == undefined) color = 'bg005de8'
if (cube.indexOf(color) == -1) cube += '';
if (i < 3) {//添加
var show = !json.Organizer ||json.Organizer == '' ? (!json.zjr || json.zjr == '' ? (!json.Speaker || json.Speaker == '' ? '' : 'Speaker:' + json.Speaker) : 'Speaker:' + json.zjr) : ('Organizer:' + json.Organizer);
list += '【' + json.treeName + '】
' +
'
' + json.title + '
' + show + ' ';
} else if (i == 3) {//更多
list += '';
}
}
if (cube.length > 0) cube = '' + cube + '
'
if (list.length > 0) list = '' + list + '
'
}
var html = '- ' + myMonth[w][d] + cube + '\n' + list + '
';
htmls.push(html);
}
}
}
htmls.push("
");
return htmls.join('');
}
};
function getJson(year, date) {
$.ajax({
url: "newsdata/1043423/" + year + "-" + date + ".js",
type: "get",
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
success: function (data) {
calUtil.init(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
},
complete: function (XMLHttpRequest, textStatus) {
this;
}
});
}
function riliYyyyInit(num){
calUtil.showMonth = calUtil.showMonth + num;
if(calUtil.showMonth==13){
calUtil.showMonth = 1 ;
calUtil.showYear = calUtil.showYear + 1;
}else if(calUtil.showMonth==0){
calUtil.showMonth = 12 ;
calUtil.showYear = calUtil.showYear - 1;
}
calUtil.init([]);
getJson(calUtil.showYear, calUtil.dateInit(calUtil.showMonth));
}
riliYyyyInit(0);