found class=today xslt for javascript solution

This commit is contained in:
vv01f 2015-09-28 18:36:02 +02:00
parent 1988f4ed4e
commit 3e428b3531
2 changed files with 2 additions and 23 deletions

View File

@ -1,22 +0,0 @@
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);

View File

@ -64,8 +64,9 @@
-->
<xsl:template name="output-day">
<xsl:param name="date"/>
<xsl:variable name="today"><xsl:value-of select="substring(date:date(),1,10)"/></xsl:variable>
<td>
<xsl:attribute name="class">
<xsl:attribute name="class"><xsl:if test="$today = $date">today </xsl:if>
<xsl:text>cal</xsl:text>
<xsl:choose>
<xsl:when test="date:day-in-week($date) = 1">sun</xsl:when>