23 lines
610 B
JavaScript
23 lines
610 B
JavaScript
function hilight_today() {
|
|
var now = new Date();
|
|
var today_id = "calendar-" +
|
|
now.getFullYear() + "-" +
|
|
(now.getMonth() + 1) + "-" +
|
|
now.getDate();
|
|
|
|
var today = document.getElementById(today_id);
|
|
|
|
/* Has document fetching completed enough? */
|
|
if (today) {
|
|
var td = today.parentNode;
|
|
var klass = td.getAttribute('class');
|
|
klass = (klass || "") + " today";
|
|
td.setAttribute('class', klass);
|
|
} else {
|
|
/* No calendar, retry later: */
|
|
window.setTimeout(hilight_today, 100);
|
|
}
|
|
}
|
|
|
|
window.setTimeout(hilight_today, 1);
|