2011-07-31 10:46:29 +02:00
|
|
|
function presentation_reload() {
|
|
|
|
if ($('#config > #ajax').html() == 'on') {
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
2012-02-20 20:35:12 +01:00
|
|
|
url: '/projector/',
|
2011-07-31 10:46:29 +02:00
|
|
|
dataType: 'json',
|
|
|
|
data: '',
|
|
|
|
success: function(data) {
|
|
|
|
$('#content').html(data.content);
|
|
|
|
document.title = data.title;
|
|
|
|
$('#currentTime').html(data.time);
|
2011-09-04 00:18:11 +02:00
|
|
|
$('#content').clearQueue();
|
|
|
|
$('#content').animate({'font-size': data.bigger + '%'}, 200);
|
2011-09-21 20:58:15 +02:00
|
|
|
$('#content li').css({'font-size': data.bigger + '%'}, 200);
|
2011-09-21 21:02:29 +02:00
|
|
|
$('#content #sidebar').css({'font-size': '16px'}, 0);
|
2011-09-04 00:18:11 +02:00
|
|
|
$('#content').animate({'margin-top': data.up + 'em'}, 200);
|
2012-02-20 20:35:12 +01:00
|
|
|
|
|
|
|
if (data.countdown_visible == true)
|
2011-11-09 21:16:02 +01:00
|
|
|
$('#countdown').slideDown();
|
2012-02-20 20:35:12 +01:00
|
|
|
if (data.countdown_visible == false)
|
2011-11-09 21:16:02 +01:00
|
|
|
$('#countdown').slideUp();
|
|
|
|
if (data.countdown_control == "reset")
|
|
|
|
resetTimer(data.countdown_time);
|
|
|
|
if (data.countdown_control == 'start') {
|
|
|
|
if (!timer_is_running)
|
|
|
|
startTimer();
|
|
|
|
}
|
|
|
|
if (data.countdown_control == 'stop')
|
|
|
|
stopTimer();
|
2011-09-03 18:50:47 +02:00
|
|
|
setTimeout("presentation_reload()", 500);
|
2011-07-31 10:46:29 +02:00
|
|
|
},
|
|
|
|
error: function () {
|
2011-09-03 18:50:47 +02:00
|
|
|
$('#currentTime').addClass('ajax_error');
|
2011-07-31 10:46:29 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchajax() {
|
|
|
|
if ($('#config > #ajax').html() == 'on') {
|
|
|
|
$('#config > #ajax').html('off');
|
|
|
|
$('#ajaxswitcher').html('<a href="#" onClick="switchajax()">Ajax Anschalten</a>');
|
|
|
|
} else {
|
|
|
|
$('#config > #ajax').html('on');
|
|
|
|
$('#ajaxswitcher').html('<a href="#" onClick="switchajax()">Ajax Ausschalten</a>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
switchajax();
|
|
|
|
switchajax();
|
|
|
|
presentation_reload();
|
|
|
|
});
|
2011-11-09 21:16:02 +01:00
|
|
|
|
2012-02-03 20:49:16 +01:00
|
|
|
// *** Countdown variables and functions ***
|
2011-11-09 21:16:02 +01:00
|
|
|
var timer_value;
|
|
|
|
var timer_is_running=false;
|
|
|
|
var timer_is_visible=false;
|
|
|
|
var timerIntervalId;
|
|
|
|
|
|
|
|
function resetTimer(value) {
|
|
|
|
stopTimer()
|
|
|
|
timer_value = value;
|
|
|
|
updateTimer();
|
|
|
|
}
|
|
|
|
function stopTimer() {
|
|
|
|
timer_is_running = false;
|
|
|
|
clearInterval(timerIntervalId);
|
|
|
|
}
|
|
|
|
|
|
|
|
function startTimer() {
|
|
|
|
timer_is_running = true;
|
|
|
|
if (timer_value > 0) {
|
|
|
|
timerIntervalId = setInterval("decrementTimer()", 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function decrementTimer() {
|
|
|
|
timer_value--;
|
|
|
|
if (timer_value <= 0) {
|
|
|
|
timer_value = 0;
|
|
|
|
stopTimer();
|
|
|
|
}
|
|
|
|
updateTimer();
|
|
|
|
}
|
|
|
|
function convertSeconds(s) {
|
|
|
|
var m = Math.floor(s / 60);
|
|
|
|
s %= 60;
|
|
|
|
var h = Math.floor(m / 60);
|
|
|
|
m %= 60;
|
|
|
|
return (h>0?h+':':'') + (h>0&&m<10?'0':'') + m + ':' + (s<10?'0':'') + s;
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateTimer() {
|
|
|
|
if (timer_value >= 0) {
|
|
|
|
$("#countdown").html(convertSeconds(timer_value));
|
|
|
|
}
|
2012-02-03 20:49:16 +01:00
|
|
|
}
|