From: Bastian Dehn Date: Sat, 18 Dec 2021 20:47:42 +0000 (+0100) Subject: add mark weekend days X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=62d31a9d851f6e38aa849b7a4b6134bea7462375;p=calender.git add mark weekend days --- diff --git a/cal.css b/cal.css index f3a9fd9..4e4c6c3 100644 --- a/cal.css +++ b/cal.css @@ -19,3 +19,7 @@ table .row.monthday { table .row.weekday { background-color: lightgray; } + +table .weekend { + background-color: lightyellow; +} diff --git a/stripcalender.mjs b/stripcalender.mjs index 8b80ace..6ad0ede 100644 --- a/stripcalender.mjs +++ b/stripcalender.mjs @@ -69,7 +69,13 @@ export class StripCalender let th = null; for (let i = 1; i <= days; i++) { + this._date.setDate(i); th = document.createElement("th"); + + if (this._date.getDay() == 0 + || this._date.getDay() == 6) + th.classList.add("weekend"); + th.innerText = i; tr.appendChild(th); } @@ -98,6 +104,11 @@ export class StripCalender for (let i = 1; i <= days; i++) { this._date.setDate(i); th = document.createElement("th"); + + if (this._date.getDay() == 0 + || this._date.getDay() == 6) + th.classList.add("weekend"); + th.innerText = weekday[this._date.getDay()]; tr.appendChild(th); }