fix: calendar-js

This commit is contained in:
vv01f 2015-10-20 16:24:32 +02:00
parent 52a1c40434
commit b176e59619

View File

@ -1,16 +1,18 @@
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 );