2012-04-25 22:48:27 +02:00
|
|
|
/**
|
|
|
|
* OpenSlides projector functions
|
|
|
|
*
|
|
|
|
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
* :license: GNU GPL, see LICENSE for more details.
|
|
|
|
*/
|
|
|
|
|
2012-07-04 15:00:08 +02:00
|
|
|
content_hash = null;
|
|
|
|
|
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',
|
|
|
|
success: function(data) {
|
2012-04-14 09:04:37 +02:00
|
|
|
$('#currentTime').removeClass('ajax_error');
|
2012-07-04 15:00:08 +02:00
|
|
|
var new_content_hash = data['content_hash'];
|
|
|
|
if (new_content_hash != content_hash) {
|
|
|
|
$('#content').html(data.content);
|
|
|
|
content_hash = new_content_hash;
|
|
|
|
}
|
2012-04-24 22:27:16 +02:00
|
|
|
$('#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();
|
2012-04-24 22:27:16 +02:00
|
|
|
// content font-size
|
2011-09-04 00:18:11 +02:00
|
|
|
$('#content').animate({'font-size': data.bigger + '%'}, 200);
|
2012-04-24 22:27:16 +02:00
|
|
|
$('#content #sidebar').css({'font-size': '18px'}, 0);
|
2013-05-06 20:17:13 +02:00
|
|
|
$('#scrollcontent').animate({'font-size': data.bigger + '%'}, 100);
|
2012-04-24 22:27:16 +02:00
|
|
|
// content position
|
2013-05-06 20:17:13 +02:00
|
|
|
$('#scrollcontent').animate({'margin-top': data.up + 'em'}, 100);
|
2012-04-24 22:27:16 +02:00
|
|
|
// overlays
|
2012-04-16 17:14:39 +02:00
|
|
|
$('#overlays div').remove();
|
2013-04-15 10:40:47 +02:00
|
|
|
$.each(data['overlays'], function (index, overlay){
|
|
|
|
$('#overlays').append('<div id="overlay_' + overlay['name'] + '">' + overlay['html'] + '</div>');
|
2012-04-14 09:04:37 +02:00
|
|
|
});
|
2012-06-24 21:55:31 +02:00
|
|
|
setTimeout("presentation_reload()", 1000);
|
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();
|
|
|
|
});
|