OpenSlides/openslides/projector/static/javascript/projector.js

58 lines
2.0 KiB
JavaScript
Raw Normal View History

/**
* OpenSlides projector functions
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
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) {
$('#currentTime').removeClass('ajax_error');
2011-07-31 10:46:29 +02:00
$('#content').html(data.content);
$('#scrollcontent').html(data.scrollcontent);
2011-07-31 10:46:29 +02:00
document.title = data.title;
$('#currentTime').html(data.time);
2011-09-04 00:18:11 +02:00
$('#content').clearQueue();
// content font-size
2011-09-04 00:18:11 +02:00
$('#content').animate({'font-size': data.bigger + '%'}, 200);
$('#content #sidebar').css({'font-size': '18px'}, 0);
$('#scrollcontent').animate({'font-size': data.bigger + '%'}, 200);
// content position
$('#scrollcontent').animate({'margin-top': data.up + 'em'}, 200);
// overlays
$('#overlays div').remove();
$.each(data['overlays'], function (index, value){
$('#overlays').append('<div id="overlay_' + value[0] + '">' + value[1] + '</div>');
});
setTimeout("presentation_reload()", 500);
2011-07-31 10:46:29 +02:00
},
error: function () {
$('#currentTime').addClass('ajax_error');
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();
});