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.
|
* :license: GNU GPL, see LICENSE for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
content_hash = null;
|
||||||
|
|
||||||
function presentation_reload() {
|
function presentation_reload() {
|
||||||
|
|
||||||
if ($('#config > #ajax').html() == 'on') {
|
if ($('#config > #ajax').html() == 'on') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/projector/',
|
url: '/projector/',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: '',
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#currentTime').removeClass('ajax_error');
|
$('#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);
|
$('#scrollcontent').html(data.scrollcontent);
|
||||||
document.title = data.title;
|
document.title = data.title;
|
||||||
$('#currentTime').html(data.time);
|
$('#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)
|
scrollcontent = render_block_to_string(self.get_template_names()[0], 'scrollcontent', self.data)
|
||||||
|
|
||||||
context = super(Projector, self).get_ajax_context(**kwargs)
|
context = super(Projector, self).get_ajax_context(**kwargs)
|
||||||
|
content_hash = hash(content)
|
||||||
context.update({
|
context.update({
|
||||||
'content': content,
|
'content': content,
|
||||||
'scrollcontent': scrollcontent,
|
'scrollcontent': scrollcontent,
|
||||||
@ -239,6 +240,7 @@ class Projector(TemplateView, AjaxMixin):
|
|||||||
'title': self.data['title'],
|
'title': self.data['title'],
|
||||||
'bigger': config['bigger'],
|
'bigger': config['bigger'],
|
||||||
'up': config['up'],
|
'up': config['up'],
|
||||||
|
'content_hash': content_hash,
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user