From 52a1c40434057256c828e24762bb5c8bd6e84ae9 Mon Sep 17 00:00:00 2001 From: vv01f Date: Tue, 20 Oct 2015 14:34:48 +0200 Subject: [PATCH] reactivating js for class 'today' as hourly built is disfunctional and last built known per page in footers --- content/static/script/calendar.js | 23 +++++++++++++++++++++++ xsl/header.xsl | 6 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 content/static/script/calendar.js diff --git a/content/static/script/calendar.js b/content/static/script/calendar.js new file mode 100644 index 000000000..ebde1a1be --- /dev/null +++ b/content/static/script/calendar.js @@ -0,0 +1,23 @@ +function hilight_today() { + var now = new Date(); + var ClassName = 'today'; + var today = document.getElementById( "calendar-" + + now.getFullYear() + "-" + + (now.getMonth() + 1) + "-" + + now.getDate() ); + var oldtoday = document.getElementById( document.getElementsByClassName(ClassName)[0].id ); + + /* 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); + } else { + /* Not in calendar yet, retry later: */ + window.setTimeout(hilight_today, 100); + } +} + +window.setTimeout(hilight_today, 1); diff --git a/xsl/header.xsl b/xsl/header.xsl index 456a06def..28b723205 100644 --- a/xsl/header.xsl +++ b/xsl/header.xsl @@ -43,10 +43,10 @@ <script src="script/ie-html5.js" type="text/javascript"></script> <![endif] - - + - --> +