diff options
author | MaZderMind | 2014-11-10 01:07:11 +0100 |
---|---|---|
committer | MaZderMind | 2014-11-10 01:07:11 +0100 |
commit | 2ad3b1c61c4d2f11ad57840a091e4db397689405 (patch) | |
tree | 4d6b5e94052adbe0d2077cd9c58675ac47ddd6f9 | |
parent | 3265e2c34059e7181ee792cc8a2c3418d5eb2687 (diff) |
basic setup for dynamic program teasers on the startpage
Diffstat (limited to '')
-rw-r--r-- | .htaccess | 4 | ||||
-rw-r--r-- | assets/js/lustiges-script.js | 37 | ||||
-rwxr-xr-x | build.sh | 8 | ||||
-rw-r--r-- | program-json.php | 6 | ||||
-rw-r--r-- | template/rooms.phtml | 2 |
5 files changed, 54 insertions, 3 deletions
@@ -35,6 +35,10 @@ RewriteRule ^(lounge|ambient)/?$ party.php?room=$1&format=audio [L] # /about/ -> about.php RewriteRule ^about/?$ about.php [L] +# /program.json -> program-json.php +RewriteRule ^program.json?$ program-json.php [L] + + # Show a known page in case of as miss RewriteRule ^404.html$ 404.php [L] ErrorDocument 404 /~peter/voc-frontends/31c3/404.php diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index bf186f8..7e94057 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -182,3 +182,40 @@ $(function() { updateSlideImage(); }); + +// startpage program teaser +$(function() { + var + updateTimer = 5000, /* update display every 5 seconds */ + refetchTimer = 5*60*1000, /* re-request current / upcoming program every 5 minutes */ + programData = {}, + $rooms = $('.rooms .lecture li'); + + if($rooms.length == 0) + return; + + function fetchProgram() { + console.log('fetchProgram'); + $.ajax({ + url: 'program.json', + dataType: 'json', + success: function(data) { + console.log('fetchProgram returned'); + programData = data; + updateProgtamTeaser(); + }, + + // success & error + complete: function() { + setTimeout(fetchProgram, refetchTimer); + } + }); + } + + function updateProgtamTeaser() { + console.log('updateProgtamTeaser'); + setTimeout(updateProgtamTeaser, updateTimer); + } + + fetchProgram(); +}); @@ -1,4 +1,7 @@ #!/bin/sh + +LOCAL_SERVER='http://localhost/~peter/voc-frontends/31c3/' + echo "building scss" scss assets/css/src/lustige-styles.scss assets/css/lustige-styles.css @@ -16,8 +19,9 @@ wget \ --recursive \ --no-parent \ --page-requisites \ - http://localhost/~peter/voc-frontends/31c3/ \ - http://localhost/~peter/voc-frontends/31c3/404.html + $LOCAL_SERVER \ + $LOCAL_SERVER/404.html + $LOCAL_SERVER/program.json echo "setting <base />-tag" find build -name "*.html" -print0 | xargs -0 -exec sed -i 's~<base href="[^"]*" />~<base href="/" />~g'; diff --git a/program-json.php b/program-json.php new file mode 100644 index 0000000..2b5e38b --- /dev/null +++ b/program-json.php @@ -0,0 +1,6 @@ +<?php + +require_once('lib/bootstrap.php'); + +header('Content-Type: application/json'); +echo json_encode(program()); diff --git a/template/rooms.phtml b/template/rooms.phtml index 1f1ee93..35b509a 100644 --- a/template/rooms.phtml +++ b/template/rooms.phtml @@ -3,7 +3,7 @@ <div class="container-fluid rooms"> <h1>Live-Streams</h1> - <div class="room-group"> + <div class="room-group lecture"> <h2>Lecture Rooms</h2> <ul> |