fix: calendar-js

This commit is contained in:
vv01f 2015-10-20 16:24:32 +02:00
parent 52a1c40434
commit b176e59619
1 changed files with 11 additions and 9 deletions

View File

@ -1,22 +1,24 @@
function hilight_today() {
var now = new Date();
var ClassName = 'today';
var today = document.getElementById( "calendar-" +
now.getFullYear() + "-" +
var today = document.getElementById( "eventday-" +
//now.getFullYear() + "-" +
(now.getMonth() + 1) + "-" +
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? */
if (today) {
oldtoday.className = oldtoday.className.replace(/\btoday\b/,'');
var td = today.parentNode;
var klass = td.getAttribute('class');
klass = (klass || "") + ' ' + ClassName;
td.setAttribute('class', klass);
if(oldtoday != null) oldtoday.className = oldtoday.className.replace( /\btoday\b/, '' );
var td = today;
var klass = td.getAttribute( 'class' );
klass = ( klass || "" ) + ' ' + ClassName;
td.setAttribute( 'class', klass );
} else {
/* Not in calendar yet, retry later: */
window.setTimeout(hilight_today, 100);
window.setTimeout( hilight_today, 100 );
}
}