From 1e68d971c84c8e975d4d5424e518e01d507e7ce6 Mon Sep 17 00:00:00 2001 From: "Charles E. Lehner" Date: Mon, 7 Jun 2021 20:39:30 -0400 Subject: [PATCH] Highlight active half-hour cell --- css/calendar.css | 6 ++++++ schedule/calendar.php | 25 +++++++++++++++---------- schedule/index.php | 6 +++++- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/css/calendar.css b/css/calendar.css index 8ef57ce..637dead 100644 --- a/css/calendar.css +++ b/css/calendar.css @@ -73,6 +73,9 @@ .calendar tbody tr td.hour span { display: block; } +.calendar tbody tr td.active { + border: 1px solid yellow; +} #pointer { position: absolute; left: 0; @@ -83,6 +86,9 @@ .pointer-label { color: red; } +.pointer-label-wrapper { + color: yellow; +} .show-title { position: relative; z-index: 2; diff --git a/schedule/calendar.php b/schedule/calendar.php index a549aff..bc90c08 100644 --- a/schedule/calendar.php +++ b/schedule/calendar.php @@ -66,21 +66,26 @@ for ($i = 0; $i < 86400; $i += 1800) { break; } } + $active = false; + if (!$wrotepointer) { + // If current time is in this range, draw pointer. + $end = DateTimeImmutable::createFromMutable($merge)->add($halfhour); + if ($now >= $merge && $now < $end) { + $active = true; + $props .= ' class="active"'; + } + } echo ""; if ($matchedshow) { echo '
'.$matchedshow['title'].'
'; // if no match was found, leave an empty node } - if (!$wrotepointer) { - // If current time is in this range, draw pointer. - $end = DateTimeImmutable::createFromMutable($merge)->add($halfhour); - if ($now >= $merge && $now < $end) { - // Cell height here should be synced with height of '.calendar tbody tr td' in ../css/calendar.css - $height = 32; - $top = round(date_diff($merge, $now)->format('%i') / 30 * ($height-1)); - echo '
'; - } - $wrotepointer = true; + if ($active) { + // Cell height here should be synced with height of '.calendar tbody tr td' in ../css/calendar.css + $height = 32; + $top = round(date_diff($merge, $now)->format('%i') / 30 * ($height-1)); + echo '
'; + $wrotepointer = true; } echo "\n"; } diff --git a/schedule/index.php b/schedule/index.php index a6fcd76..cd9d6b5 100644 --- a/schedule/index.php +++ b/schedule/index.php @@ -6,7 +6,8 @@ include 'schedule.php';

tilderadio.org

upcoming broadcasts

-

all times in UTC. current time is ().

+

all times in UTC. current time is +().

this schedule is also available in iCalendar format. point your calendar client at https://tilderadio.org/schedule/ics.php.