summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/calendar.js19
-rw-r--r--www/styles/weeks.css5
-rw-r--r--www/weeks.html7
3 files changed, 17 insertions, 14 deletions
diff --git a/www/js/calendar.js b/www/js/calendar.js
index afc2369..5df77ac 100644
--- a/www/js/calendar.js
+++ b/www/js/calendar.js
@@ -28,9 +28,9 @@ function getLastMonday() {
d.setUTCHours(12, 0, 0, 0);
var dow = d.getUTCDay()
if(dow == 0) {
- return new Date(d - (6*24*3600000));
+ return new Date(d.valueOf() - (6*24*3600000));
} else {
- return new Date(d - ((dow-1)*24*3600000));
+ return new Date(d.valueOf() - ((dow-1)*24*3600000));
}
}
@@ -38,9 +38,10 @@ function addDeltaDays(d, days) {
return new Date(d.valueOf() + (days*24*3600000))
}
-function isThisWeek(d) {
- var lastmon = getLastMonday()
- return ((d - lastmon) == 0)
+function isToday(d) {
+ var today = new Date(clock.getRDTimeMS());
+ today.setUTCHours(12, 0, 0, 0);
+ return ((d - today) == 0)
}
function addWeekClass(row, week) {
@@ -72,15 +73,13 @@ function calendar_redraw(weekstart) {
var week = get_rd_week(date.valueOf() + 7199999);
var row = $('<tr>');
addWeekClass(row, week);
- if(isThisWeek(date)) {
- row.append($('<td>').addClass('currentweek').text('*'));
- } else {
- row.append($('<td>').addClass('currentweek').text(''));
- }
row.append($('<td>').addClass('week').text(week));
row.append($('<td>').addClass('month').text(monthname_short[date.getUTCMonth()] + ' ' + date.getUTCFullYear()));
for(var d = 0; d < 7; d++) {
var col = $('<td>').text(date.getUTCDate());
+ if(isToday(date)) {
+ col.addClass('today');
+ }
row.append(col);
if(d < 6) {
date = addDeltaDays(date, 1);
diff --git a/www/styles/weeks.css b/www/styles/weeks.css
index 634da59..fbd0379 100644
--- a/www/styles/weeks.css
+++ b/www/styles/weeks.css
@@ -93,6 +93,11 @@
border-bottom: 1px solid #eee;
}
+#calendar td.today {
+ color: white;
+ border: 2px solid black;
+}
+
#calendar td.currentweek {
font-size: 1.2em;
font-weight: bold;
diff --git a/www/weeks.html b/www/weeks.html
index 53e2dbf..4cba4d2 100644
--- a/www/weeks.html
+++ b/www/weeks.html
@@ -29,10 +29,10 @@
<div id="buttons">
<div>
- <input id="btn-today" type="button" value="Heute"></input>
+ <input id="btn-today" type="button" value="Heute">
</div>
- <input id="btn-earlier" type="button" value="Früher"></input>
- <input id="btn-later" type="button" value="Später"></input>
+ <input id="btn-earlier" type="button" value="Früher">
+ <input id="btn-later" type="button" value="Später">
</div>
</div>
@@ -41,7 +41,6 @@
<tr>
<th></th>
<th></th>
- <th></th>
<th>Mo</th>
<th>Di</th>
<th>Mi</th>