?? cal2.js
字號:
}
function cyclical(num) {
return(Gan[num%10]+Zhi[num%12])
}
function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {
this.isToday = false;
this.sYear = sYear;
this.sMonth = sMonth;
this.sDay = sDay;
this.week = week;
this.lYear = lYear;
this.lMonth = lMonth;
this.lDay = lDay;
this.isLeap = isLeap;
this.cYear = cYear;
this.cMonth = cMonth;
this.cDay = cDay;
this.color = '';
this.solarTerms = '';
this.solarTerms = '';
this.solarFestival = '';
this.lunarFestival = '';
}
function sTerm(y,n) {
var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000 ) + Date.UTC(1900,0,6,2,5) )
return(offDate.getUTCDate())
}
function calendar(y,m) {
var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2
var lDPOS = new Array(3)
var n = 0
var firstLM = 0
sDObj = new Date(y,m,1)
this.length = solarDays(y,m)
this.firstWeek = sDObj.getDay()
for(var i=0;i<this.length;i++) {
if(lD>lX) {
sDObj = new Date(y,m,i+1)
lDObj = new Lunar(sDObj)
lY = lDObj.year
lM = lDObj.month
lD = lDObj.day
lL = lDObj.isLeap
lX = lL? leapDays(lY): monthDays(lY,lM)
if(n==0) firstLM = lM
lDPOS[n++] = i-lD+1
}
this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],
lY, lM, lD++, lL,
cyclical(lDObj.yearCyl) ,cyclical(lDObj.monCyl), cyclical(lDObj.dayCyl++) )
if((i+this.firstWeek)%7==0) this[i].color = 'red'
if((i+this.firstWeek)%14==13) this[i].color = 'red'
}
tmp1=sTerm(y,m*2 )-1
tmp2=sTerm(y,m*2+1)-1
this[tmp1].solarTerms = solarTerm[m*2]
this[tmp2].solarTerms = solarTerm[m*2+1]
if(m==3) this[tmp1].color = '#CC4AF7'
for(i in sFtv)
if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' '
if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = '#BC02D7'
}
for(i in wFtv)
if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
tmp1=Number(RegExp.$2)
tmp2=Number(RegExp.$3)
this[((this.firstWeek>tmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' '
}
for(i in lFtv)
if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {
tmp1=Number(RegExp.$1)-firstLM
if(tmp1==-11) tmp1=1
if(tmp1 >=0 && tmp1<n) {
tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1
if( tmp2 >= 0 && tmp2<this.length) {
this[tmp2].lunarFestival += RegExp.$4 + ' '
if(RegExp.$3=='*') this[tmp2].color = '#FF00FF'
}
}
}
if((this.firstWeek+12)%7==5)
this[12].solarFestival += '\u9ED1\u8272\u661F\u671F\u4E94 '
if(y==tY && m==tM)
this[tD-1].solarTerms +='\u4ECA\u5929^@^'
if(y==tY && m==tM) this[tD-1].isToday = true;
}
function cDay(d){
var s;
switch (d) {
case 10:
s = '初十'; break;
case 20:
s = '二十'; break;
break;
case 30:
s = '三十'; break;
break;
default :
s = nStr2[Math.floor(d/10)];
s += nStr1[d%10];
}
return(s);
}
var cld;
function drawCld(SY,SM) {
var i,sD,s,size;
cld = new calendar(SY,SM);
if(SY>1874 && SY<1909) yDisplay = '\u5149\u7EEA ' + (((SY-1874)==1)?'\u5143':SY-1874)
if(SY>1908 && SY<1912) yDisplay = '\u5BA3\u7EDF ' + (((SY-1908)==1)?'\u5143':SY-1908)
if(SY>1911 && SY<1949) yDisplay = '\u6C11\u56FD ' + (((SY-1911)==1)?'\u5143':SY-1911)
if(SY>1948 && SY<1950) yDisplay = '\u4E2D\u534E\u4EBA\u6C11\u5171\u548C\u56FD' + (((SY-1948)==1)?'\u6210\u7ACB':SY-1948)
if(SY>1949) yDisplay = '\u4E2D\u534E\u4EBA\u6C11\u5171\u548C\u56FD\u6210\u7ACB' + (((SY-1949)==1)?'\u5143':SY-1949)
GZ.innerHTML = '<table border=0 cellpadding=0 cellspacing=0 width=374 style="FONT-SIZE: 9pt"><tr><td align=right width=85% valign=bottom><font color=#FFCC00>●</font><font color=#FFFFFF> <a onmouseout="hidetip2()" onmouseover=showtip2(this,event,"'+'\u73B0\u5728\u662F\u516C\u5143'+SY+'\u5E74'+month2[SM]+'") href="#">'+ yDisplay+'\u5E74'+'</a> <font color=#FFCC00>●</font> '+Animals[(SY-4)%12]+'\u5E74[\u519C\u5386' + cyclical(SY-1900+36)+'\u5E74]' +"</td></td><td align=center width=15%><img src='" +Animals2[(SY-4)%12]+".gif'></td>" + '</tr></table>' ;
YMBG.innerHTML =monthName[SM]+" " +SY+"</a>" ;
for(i=0;i<42;i++) {
sObj=eval('SD'+ i);
lObj=eval('LD'+ i);
sObj.className = '';
sD = i - cld.firstWeek;
if(sD>-1 && sD<cld.length) {
sObj.innerHTML = sD+1;
if(cld[sD].isToday) sObj.className = 'todyaColor';
sObj.style.color = cld[sD].color;
if(cld[sD].lDay==1)
lObj.innerHTML = '<b>'+(cld[sD].isLeap?'閏':'') + cld[sD].lMonth + '月' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'小':'大')+'</b>';
else
lObj.innerHTML = cDay(cld[sD].lDay);
s=cld[sD].lunarFestival;
if(s.length>0) {
if(s.length>6) s = s.substr(0, 4)+'…';
s = s.fontcolor('#C49402');
}
else {
s=cld[sD].solarFestival;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -