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) {
|
2012-04-14 09:04:37 +02:00
|
|
|
$('#currentTime').removeClass('ajax_error');
|
2011-07-31 10:46:29 +02:00
|
|
|
$('#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-04-14 09:04:37 +02:00
|
|
|
/*
|
|
|
|
* Gehe durch alle messages li durch. Wenn der Wert in der data steht, lasse es,
|
|
|
|
* ansonsten füge ein neues li ein und lösche es aus der data weg.
|
|
|
|
* Alles was jetzt noch in der data ist, muss als neues li eingefügt werden.
|
|
|
|
*/
|
2012-02-20 20:35:12 +01:00
|
|
|
|
2012-04-14 09:04:37 +02:00
|
|
|
//# $.each($('#messages li'), function (index, value) {
|
|
|
|
//# message_id = value.attr('id').split('_')[1];
|
|
|
|
//# if (message_id in data) {
|
|
|
|
//# this.html(data[message_id]);
|
|
|
|
//# }
|
|
|
|
//# });
|
|
|
|
$('#messages li').remove();
|
|
|
|
$.each(data['messages'], function (index, value){
|
|
|
|
$('#messages ul').append('<li>' + value[1] + '</li>');
|
|
|
|
});
|
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');
|
2012-04-14 09:04:37 +02:00
|
|
|
setTimeout("presentation_reload()", 1000);
|
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
|
|
|
}
|