fix: calendar-js
This commit is contained in:
parent
52a1c40434
commit
b176e59619
|
@ -1,22 +1,24 @@
|
||||||
function hilight_today() {
|
function hilight_today() {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var ClassName = 'today';
|
var ClassName = 'today';
|
||||||
var today = document.getElementById( "calendar-" +
|
var today = document.getElementById( "eventday-" +
|
||||||
now.getFullYear() + "-" +
|
//now.getFullYear() + "-" +
|
||||||
(now.getMonth() + 1) + "-" +
|
(now.getMonth() + 1) + "-" +
|
||||||
now.getDate() );
|
now.getDate() );
|
||||||
var oldtoday = document.getElementById( document.getElementsByClassName(ClassName)[0].id );
|
var oldid = document.getElementsByClassName( ClassName )[0].id;
|
||||||
|
if( oldid != '')
|
||||||
|
var oldtoday = document.getElementById( oldid );
|
||||||
|
|
||||||
/* Has document fetching completed enough? */
|
/* Has document fetching completed enough? */
|
||||||
if (today) {
|
if (today) {
|
||||||
oldtoday.className = oldtoday.className.replace(/\btoday\b/,'');
|
if(oldtoday != null) oldtoday.className = oldtoday.className.replace( /\btoday\b/, '' );
|
||||||
var td = today.parentNode;
|
var td = today;
|
||||||
var klass = td.getAttribute('class');
|
var klass = td.getAttribute( 'class' );
|
||||||
klass = (klass || "") + ' ' + ClassName;
|
klass = ( klass || "" ) + ' ' + ClassName;
|
||||||
td.setAttribute('class', klass);
|
td.setAttribute( 'class', klass );
|
||||||
} else {
|
} else {
|
||||||
/* Not in calendar yet, retry later: */
|
/* Not in calendar yet, retry later: */
|
||||||
window.setTimeout(hilight_today, 100);
|
window.setTimeout( hilight_today, 100 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user