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 /assets/js | |
parent | 3265e2c34059e7181ee792cc8a2c3418d5eb2687 (diff) |
basic setup for dynamic program teasers on the startpage
Diffstat (limited to '')
-rw-r--r-- | assets/js/lustiges-script.js | 37 |
1 files changed, 37 insertions, 0 deletions
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(); +}); |