diff --git a/css/calendar.css b/css/calendar.css index 4b2326f..637dead 100644 --- a/css/calendar.css +++ b/css/calendar.css @@ -53,6 +53,7 @@ vertical-align: middle; border-left: 1px solid #626E7E; position: relative; + /* Height here should be synced with $cell_height in ../schedule/calendar.php */ height: 32px; cursor: pointer; overflow: hidden; @@ -72,6 +73,26 @@ .calendar tbody tr td.hour span { display: block; } +.calendar tbody tr td.active { + border: 1px solid yellow; +} +#pointer { + position: absolute; + left: 0; + right: 0; + border-top: 1px solid red; + z-index: 1; +} +.pointer-label { + color: red; +} +.pointer-label-wrapper { + color: yellow; +} +.show-title { + position: relative; + z-index: 2; +} @media (max-width: 60em) { .calendar-wrapper { display: block; diff --git a/schedule/calendar.php b/schedule/calendar.php index 10ccf57..bc90c08 100644 --- a/schedule/calendar.php +++ b/schedule/calendar.php @@ -49,23 +49,45 @@ for ($i = 0; $i < 86400; $i += 1800) { ?> format('Y-m-d') .' ' .date('H:i:s', $time + $i)); + // Set id for this time span, for referencing in JS. + $props = 'id="show-'.$merge->getTimestamp().'"'; // We'll now use $merge to see if any shows are airing at this time - $match = false; + $matchedshow = null; foreach ($schedule as $show) { if (check_in_range($show['start'], $show['end'], $merge->format('Y-m-d H:i:s'))) { - echo "" . $show['title'] . "\n"; - $match = true; + $matchedshow = $show; break; } } - // if no match was found, leave an empty node - if (! $match) { - echo "\n"; + $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 ($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 78ac97f..2fd3dac 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.