From 76c878d65a8efe1e5c4b23070e8b036f58603217 Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 19:02:06 +0000 Subject: [PATCH 1/7] allow for remote development of schedule by pointing to live schedule json in dev --- schedule/schedule.php | 52 ++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/schedule/schedule.php b/schedule/schedule.php index 5afb0ad..74f0883 100644 --- a/schedule/schedule.php +++ b/schedule/schedule.php @@ -2,31 +2,37 @@ include 'apikey.php'; if (empty($apikey)) { - die("missing api key"); + /* If we don't have the API key, assume we're developing. Pull data from live version of this file */ + $context = stream_context_create([ + "http" => [ + "method" => "GET", + ] + ]); + $schedule = json_decode(file_get_contents("https://tilderadio.org/schedule/schedule.php?json=yes", false, $context), true); +} else { + $context = stream_context_create([ + "http" => [ + "method" => "GET", + "header" => "X-API-Key: $apikey\r\n" + ] + ]); + + // allow ics.php to overwrite $from and $to + if (!isset($from,$to)) { + $from = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 1 day")); + $to = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 8 days")); + } + + $schedule = json_decode( + file_get_contents( + "https://radio.tildeverse.org/api/station/1/streamers/schedule?start=$from&end=$to", + false, + $context + ), + true + ); } -$context = stream_context_create([ - "http" => [ - "method" => "GET", - "header" => "X-API-Key: $apikey\r\n" - ] -]); - -// allow ics.php to overwrite $from and $to -if (!isset($from,$to)) { - $from = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 1 day")); - $to = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 8 days")); -} - -$schedule = json_decode( - file_get_contents( - "https://radio.tildeverse.org/api/station/1/streamers/schedule?start=$from&end=$to", - false, - $context - ), - true -); - usort($schedule, function ($a, $b) { return $a["start"] <=> $b["start"]; }); From 8729aecc377c586290f94f9d0a4ec1a92e405669 Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 19:29:30 +0000 Subject: [PATCH 2/7] adds hard-coded calendar without data as placeholder --- css/calendar.css | 118 ++++++++++ header.php | 1 + schedule/calendar.php | 525 ++++++++++++++++++++++++++++++++++++++++++ schedule/index.php | 4 + 4 files changed, 648 insertions(+) create mode 100644 css/calendar.css create mode 100644 schedule/calendar.php diff --git a/css/calendar.css b/css/calendar.css new file mode 100644 index 0000000..dbb14a0 --- /dev/null +++ b/css/calendar.css @@ -0,0 +1,118 @@ +.calendar-wrapper { + display: block; + max-height: 500px; + overflow-y: scroll; +} +.calendar { + font-family: sans-serif; + width: 100%; + border-spacing: 0; + border-collapse: separate; + table-layout: fixed; + margin-bottom: 50px; +} +.calendar thead tr th { + background: #626E7E; + color: #d1d5db; + padding: 0.5em; + overflow: hidden; +} +.calendar thead tr th:first-child { + border-radius: 3px 0 0 0; +} +.calendar thead tr th:last-child { + border-radius: 0 3px 0 0; +} +.calendar thead tr th .day { + display: block; + font-size: 1.2em; + border-radius: 50%; + width: 30px; + height: 30px; + margin: 0 auto 5px; + padding: 5px; + line-height: 1.8; +} +.calendar thead tr th .day.active { + background: #d1d5db; + color: #626E7E; +} +.calendar thead tr th .short { + display: none; +} +.calendar thead tr th i { + vertical-align: middle; + font-size: 2em; +} +.calendar tbody tr { + background: #d1d5db; +} +.calendar tbody tr:nth-child(odd) { + background: #c8cdd4; +} +.calendar tbody tr:nth-child(2n+0) td { + border-bottom: 1px solid #626E7E; +} +.calendar tbody tr td { + text-align: center; + vertical-align: middle; + border-left: 1px solid #626E7E; + position: relative; + height: 32px; + cursor: pointer; +} +.calendar tbody tr td:last-child { + border-right: 1px solid #626E7E; +} +.calendar tbody tr td.hour { + font-size: 2em; + padding: 0; + color: #626E7E; + background: #fff; + border-bottom: 1px solid #626E7E; + border-collapse: separate; + min-width: 100px; + cursor: default; +} +.calendar tbody tr td.hour span { + display: block; +} +@media (max-width: 60em) { + .calendar thead tr th .long { + display: none; + } + .calendar thead tr th .short { + display: block; + } + .calendar tbody tr td.hour span { + transform: rotate(270deg); + -webkit-transform: rotate(270deg); + -moz-transform: rotate(270deg); + } +} +@media (max-width: 27em) { + .calendar thead tr th { + font-size: 65%; + } + .calendar thead tr th .day { + display: block; + font-size: 1.2em; + border-radius: 50%; + width: 20px; + height: 20px; + margin: 0 auto 5px; + padding: 5px; + } + .calendar thead tr th .day.active { + background: #d1d5db; + color: #626E7E; + } + .calendar tbody tr td.hour { + font-size: 1.7em; + } + .calendar tbody tr td.hour span { + transform: translateY(16px) rotate(270deg); + -webkit-transform: translateY(16px) rotate(270deg); + -moz-transform: translateY(16px) rotate(270deg); + } +} diff --git a/header.php b/header.php index e03bb99..6ea4c50 100644 --- a/header.php +++ b/header.php @@ -8,6 +8,7 @@ + diff --git a/schedule/calendar.php b/schedule/calendar.php new file mode 100644 index 0000000..bbb015c --- /dev/null +++ b/schedule/calendar.php @@ -0,0 +1,525 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 1 + Monday + Mon + + 2 + Tuesday + Tue + + 3 + Wendsday + We + + 4 + Thursday + Thur + + 5 + Friday + Fri + + 6 + Saturday + Sat + + 7 + Sunday + Sun +
00:00
01:00
02:00
03:00
04:00
05:00
06:00
07:00
08:00
09:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00
23:00
+
diff --git a/schedule/index.php b/schedule/index.php index ad72099..47b8515 100644 --- a/schedule/index.php +++ b/schedule/index.php @@ -9,6 +9,10 @@ include 'schedule.php';

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.

+ + From b8980af5208dad25d81b8ce66b9f8f7641afb9f4 Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 19:41:02 +0000 Subject: [PATCH 3/7] color scheme is hacker for cal --- css/calendar.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/css/calendar.css b/css/calendar.css index dbb14a0..3281a92 100644 --- a/css/calendar.css +++ b/css/calendar.css @@ -1,7 +1,7 @@ .calendar-wrapper { display: block; - max-height: 500px; - overflow-y: scroll; + /* max-height: 500px; */ + /* overflow-y: scroll; */ } .calendar { font-family: sans-serif; @@ -12,10 +12,11 @@ margin-bottom: 50px; } .calendar thead tr th { - background: #626E7E; - color: #d1d5db; + background: #1c201b; padding: 0.5em; overflow: hidden; + text-align: center; + border-bottom: 1px solid #26d700; } .calendar thead tr th:first-child { border-radius: 3px 0 0 0; @@ -45,10 +46,10 @@ font-size: 2em; } .calendar tbody tr { - background: #d1d5db; + background: #1c201b; } .calendar tbody tr:nth-child(odd) { - background: #c8cdd4; + background: #313e2f; } .calendar tbody tr:nth-child(2n+0) td { border-bottom: 1px solid #626E7E; @@ -67,8 +68,7 @@ .calendar tbody tr td.hour { font-size: 2em; padding: 0; - color: #626E7E; - background: #fff; + background: #072000; border-bottom: 1px solid #626E7E; border-collapse: separate; min-width: 100px; From d726d6522a95868846a8f238366aa94ed63416d2 Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 20:25:24 +0000 Subject: [PATCH 4/7] programatically drawing calendar from $schedule --- schedule/calendar.php | 560 ++++-------------------------------------- 1 file changed, 49 insertions(+), 511 deletions(-) diff --git a/schedule/calendar.php b/schedule/calendar.php index bbb015c..dca1618 100644 --- a/schedule/calendar.php +++ b/schedule/calendar.php @@ -1,525 +1,63 @@
+= $start_ts) && ($user_ts < $end_ts)); +} + +$begin = new DateTime($schedule[0]['start']); +$end = new DateTime(end($schedule)['start']); + +$daterange = new DatePeriod($begin, new DateInterval('P1D'), $end); + +?>
- - - - - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +format('Y-m-d') .' ' .date('H:i:s', $time + $i)); +?> + + +
- 1 - Monday - Mon - - 2 - Tuesday - Tue - - 3 - Wendsday - We - - 4 - Thursday - Thur - - 5 - Friday - Fri - - 6 - Saturday - Sat - - 7 - Sunday - Sun - + format("d") ?> + format("l") ?> + format("D") ?> +
00:00
01:00
:00
02:00
03:00
04:00
05:00
06:00
07:00
08:00
09:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00
23:00
format('Y-m-d H:i:s'); ?>
From 3987c26428b652811de06423e4c509bdda0a003c Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 20:40:39 +0000 Subject: [PATCH 5/7] successfully populating shows into calendar --- schedule/calendar.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/schedule/calendar.php b/schedule/calendar.php index dca1618..10ccf57 100644 --- a/schedule/calendar.php +++ b/schedule/calendar.php @@ -3,21 +3,22 @@ function check_in_range($start_date, $end_date, $checkdate) { $start_ts = strtotime($start_date); $end_ts = strtotime($end_date); - $user_ts = strtotime($checkdate); - return (($user_ts >= $start_ts) && ($user_ts < $end_ts)); + $ch_ts = strtotime($checkdate); + return (($ch_ts >= $start_ts) && ($ch_ts < $end_ts)); } +// Create a date range between the schedule start and end dates $begin = new DateTime($schedule[0]['start']); $end = new DateTime(end($schedule)['start']); - $daterange = new DatePeriod($begin, new DateInterval('P1D'), $end); - ?> + @@ -46,12 +49,23 @@ for ($i = 0; $i < 86400; $i += 1800) { // 1800 = half hour, 86400 = one day ?> format('Y-m-d') .' ' .date('H:i:s', $time + $i)); -?> - -format('Y-m-d H:i:s'))) { + echo "\n"; + $match = true; + break; + } + } + // if no match was found, leave an empty node + if (! $match) { + echo "\n"; + } } ?> From edc9543120d1c381f0a77ab936c2cbb884aa9337 Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 20:48:58 +0000 Subject: [PATCH 6/7] css tweaks for better phone display --- css/calendar.css | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/css/calendar.css b/css/calendar.css index 3281a92..4d0de87 100644 --- a/css/calendar.css +++ b/css/calendar.css @@ -1,8 +1,3 @@ -.calendar-wrapper { - display: block; - /* max-height: 500px; */ - /* overflow-y: scroll; */ -} .calendar { font-family: sans-serif; width: 100%; @@ -61,6 +56,7 @@ position: relative; height: 32px; cursor: pointer; + overflow: hidden; } .calendar tbody tr td:last-child { border-right: 1px solid #626E7E; @@ -78,6 +74,16 @@ display: block; } @media (max-width: 60em) { + .calendar-wrapper { + display: block; + overflow-x: scroll; + } + .calendar { + min-width: 800px; + } + .calendar tbody tr td.hour { + font-size: 16px; + } .calendar thead tr th .long { display: none; } @@ -91,6 +97,17 @@ } } @media (max-width: 27em) { + .calendar-wrapper { + display: block; + overflow-x: scroll; + } + .calendar { + min-width: 800px; + } + .calendar tbody tr td.hour { + font-size: 16px; + text-align: right; + } .calendar thead tr th { font-size: 65%; } @@ -107,9 +124,6 @@ background: #d1d5db; color: #626E7E; } - .calendar tbody tr td.hour { - font-size: 1.7em; - } .calendar tbody tr td.hour span { transform: translateY(16px) rotate(270deg); -webkit-transform: translateY(16px) rotate(270deg); From 6c272afa110a29f3e7eb76a8a3b89d39a4cc679f Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Sat, 26 Sep 2020 20:51:40 +0000 Subject: [PATCH 7/7] fixes large h1s on mobile causing horizontal scrolling --- css/hacker.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/css/hacker.css b/css/hacker.css index cc3a08a..c2e83bf 100644 --- a/css/hacker.css +++ b/css/hacker.css @@ -304,7 +304,8 @@ th { .img-thumbnail, body { - background-color: #040304 + background-color: #040304; + overflow-x: hidden; } @font-face { @@ -1585,7 +1586,7 @@ h6 { .h1, h1 { - font-size: 48px + font-size: 38px } .h2, @@ -1834,6 +1835,11 @@ dd { } @media (min-width:768px) { + .h1, + h1 { + font-size: 48px + } + .dl-horizontal dt { float: left; width: 160px; @@ -8014,4 +8020,4 @@ tr.active { ::-moz-selection { background: #3EE77B; color: #040304 -} \ No newline at end of file +}
@@ -32,12 +33,14 @@ foreach($daterange as $date){
:00format('Y-m-d H:i:s'); ?>" . $show['title'] . "