diff options
Diffstat (limited to 'assets/js/lustiges-script.js')
-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(); +}); |