From d870b988e9d87c3e80096a8922db60aa7a7ddfa9 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 14 Apr 2012 09:04:37 +0200 Subject: [PATCH] try to reload the beamer, if the server is down --- openslides/static/javascript/projector.js | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/openslides/static/javascript/projector.js b/openslides/static/javascript/projector.js index 2692baadd..e8a23f6c6 100644 --- a/openslides/static/javascript/projector.js +++ b/openslides/static/javascript/projector.js @@ -6,6 +6,7 @@ function presentation_reload() { dataType: 'json', data: '', success: function(data) { + $('#currentTime').removeClass('ajax_error'); $('#content').html(data.content); document.title = data.title; $('#currentTime').html(data.time); @@ -14,24 +15,27 @@ function presentation_reload() { $('#content li').css({'font-size': data.bigger + '%'}, 200); $('#content #sidebar').css({'font-size': '16px'}, 0); $('#content').animate({'margin-top': data.up + 'em'}, 200); - /*TODO: messages neu schreiben*/ + /* + * 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. + */ - if (data.countdown_visible == true) - $('#countdown').slideDown(); - if (data.countdown_visible == false) - $('#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(); + //# $.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('
  • ' + value[1] + '
  • '); + }); setTimeout("presentation_reload()", 500); }, error: function () { $('#currentTime').addClass('ajax_error'); + setTimeout("presentation_reload()", 1000); } }); }