only refresh the projector, if the content has changed
This commit is contained in:
parent
7f2d10c9ca
commit
67426f239b
@ -5,16 +5,22 @@
|
||||
* :license: GNU GPL, see LICENSE for more details.
|
||||
*/
|
||||
|
||||
content_hash = null;
|
||||
|
||||
function presentation_reload() {
|
||||
|
||||
if ($('#config > #ajax').html() == 'on') {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/projector/',
|
||||
dataType: 'json',
|
||||
data: '',
|
||||
success: function(data) {
|
||||
$('#currentTime').removeClass('ajax_error');
|
||||
$('#content').html(data.content);
|
||||
var new_content_hash = data['content_hash'];
|
||||
if (new_content_hash != content_hash) {
|
||||
$('#content').html(data.content);
|
||||
content_hash = new_content_hash;
|
||||
}
|
||||
$('#scrollcontent').html(data.scrollcontent);
|
||||
document.title = data.title;
|
||||
$('#currentTime').html(data.time);
|
||||
|
@ -231,6 +231,7 @@ class Projector(TemplateView, AjaxMixin):
|
||||
scrollcontent = render_block_to_string(self.get_template_names()[0], 'scrollcontent', self.data)
|
||||
|
||||
context = super(Projector, self).get_ajax_context(**kwargs)
|
||||
content_hash = hash(content)
|
||||
context.update({
|
||||
'content': content,
|
||||
'scrollcontent': scrollcontent,
|
||||
@ -239,6 +240,7 @@ class Projector(TemplateView, AjaxMixin):
|
||||
'title': self.data['title'],
|
||||
'bigger': config['bigger'],
|
||||
'up': config['up'],
|
||||
'content_hash': content_hash,
|
||||
})
|
||||
return context
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user