2020-06-18 06:21:52 +00:00
|
|
|
<?php
|
2020-07-03 06:51:01 +00:00
|
|
|
$additional_head='<link rel="alternate" type="text/calendar" href="https://tilderadio.org/schedule/ics.php">';
|
2020-06-18 06:21:52 +00:00
|
|
|
include '../header.php';
|
2020-07-03 01:53:12 +00:00
|
|
|
include 'schedule.php';
|
2020-06-18 06:21:52 +00:00
|
|
|
?>
|
|
|
|
|
2021-04-29 16:47:09 +00:00
|
|
|
<h1><a href="https://tilderadio.org"><img style="width:72px;margin-top:-30px;margin-right:5px;" src="../logos/tilderadio.png">tilderadio.org</a></h1>
|
2020-06-18 06:21:52 +00:00
|
|
|
<h4>upcoming broadcasts</h4>
|
2021-05-30 04:14:46 +00:00
|
|
|
<p>all times in UTC. current time is <span id="utcdate"><?=formatdate("now")?></span> (<span class="pointer-label">—</span>).</p>
|
2020-07-03 06:51:01 +00:00
|
|
|
<p>this schedule is also available in <a href="https://icalendar.org/validator.html?url=https://tilderadio.org/schedule/ics.php">iCalendar format</a>. point your calendar client at <code>https://tilderadio.org/schedule/ics.php</code>.</p>
|
2020-06-18 06:21:52 +00:00
|
|
|
|
2020-09-26 19:29:30 +00:00
|
|
|
<?php
|
|
|
|
include 'calendar.php';
|
|
|
|
?>
|
|
|
|
|
2020-06-18 19:36:12 +00:00
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>dj</th>
|
2020-06-28 06:19:42 +00:00
|
|
|
<th>start</th>
|
|
|
|
<th>end</th>
|
2020-06-18 19:36:12 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php foreach ($schedule as $item): ?>
|
|
|
|
<tr>
|
2020-06-23 05:25:49 +00:00
|
|
|
<td><?=$item["title"]?></td>
|
2020-06-28 06:19:42 +00:00
|
|
|
<td><?=formatdate($item["start"])?></td>
|
|
|
|
<td><?=formatdate($item["end"])?></td>
|
2020-06-18 19:36:12 +00:00
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-06-18 04:07:03 +00:00
|
|
|
|
2020-07-01 02:31:13 +00:00
|
|
|
<script>
|
2021-05-30 04:14:46 +00:00
|
|
|
let halfHour = 1800000;
|
|
|
|
// Gather schedule table cells by timestamp
|
|
|
|
const cells = document.querySelectorAll('.calendar tbody td');
|
|
|
|
let ranges = [];
|
|
|
|
for (const cell of Array.from(cells)) {
|
|
|
|
const m = /^show-(\d*)$/.exec(cell.id);
|
|
|
|
if (!m) continue;
|
|
|
|
ranges.push({
|
|
|
|
startTime: m[1]*1000,
|
|
|
|
cell,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
ranges.sort((a, b) => {
|
|
|
|
return a.startTime - b.startTime;
|
|
|
|
});
|
|
|
|
let currentRangeI = 0;
|
|
|
|
|
|
|
|
function getCurrentRange(now) {
|
|
|
|
for (i = currentRangeI; i < ranges.length; i++) {
|
|
|
|
const range = ranges[i];
|
|
|
|
if (!range) return;
|
|
|
|
const rangeStart = range.startTime;
|
|
|
|
if (rangeStart <= now && (rangeStart + halfHour) > now) {
|
|
|
|
return range;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update the timer and pointer as time passes.
|
2020-07-01 02:31:13 +00:00
|
|
|
// Because PHP gives the time on page load, people who disable Javascript won't be missing out on much.
|
|
|
|
let months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
|
|
|
|
let daysOfWeek = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
|
|
|
|
function update_date() {
|
|
|
|
var d = new Date();
|
2020-07-02 02:09:38 +00:00
|
|
|
document.getElementById("utcdate").innerText = daysOfWeek[d.getUTCDay()]+" "+months[d.getUTCMonth()]+" "+d.getUTCDate().toString()+" "+d.getUTCHours().toString().padStart(2,'0')+":"+d.getUTCMinutes().toString().padStart(2,'0');
|
2020-07-01 02:31:13 +00:00
|
|
|
setTimeout(update_date,15000);
|
2021-05-30 04:14:46 +00:00
|
|
|
updatePointer(d);
|
2020-07-01 02:31:13 +00:00
|
|
|
}
|
|
|
|
setTimeout(update_date,15000);
|
2021-05-30 04:14:46 +00:00
|
|
|
|
|
|
|
let pointer = document.getElementById("pointer");
|
|
|
|
// Create pointer in case it wasn't added in the page generation.
|
|
|
|
if (!pointer) {
|
|
|
|
pointer = document.createElement('div');
|
|
|
|
pointer.id = 'pointer';
|
|
|
|
}
|
|
|
|
|
|
|
|
let prevRange;
|
|
|
|
function updatePointer(d) {
|
|
|
|
// Find current cell
|
|
|
|
const range = getCurrentRange(d.getTime());
|
|
|
|
if (!range) {
|
|
|
|
// Done with schedule. Remove pointer. Need to refresh.
|
|
|
|
if (prevRange) {
|
|
|
|
prevRange.cell.removeChild(pointer);
|
|
|
|
prevRange = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Move pointer to different cell if changed cell.
|
|
|
|
if (range !== prevRange) {
|
|
|
|
range.cell.appendChild(pointer);
|
|
|
|
}
|
|
|
|
// Move pointer based on time in current cell.
|
|
|
|
const progress = (d.getTime() - range.startTime) / halfHour;
|
|
|
|
pointer.style.top = (progress * (range.cell.offsetHeight-1)).toFixed(0) + 'px';
|
|
|
|
}
|
|
|
|
// Update pointer immediately
|
|
|
|
updatePointer(new Date());
|
|
|
|
|
2020-07-01 02:31:13 +00:00
|
|
|
</script>
|
|
|
|
|
2020-06-18 04:07:03 +00:00
|
|
|
<?php include '../footer.php'; ?>
|