Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Presentations
- function presentations()
- {
- $.ajax({
- url: '/jsonapi/presentations/',
- type: 'POST',
- dataType: 'json',
- complete: function(xhr, textStatus) {
- setTimeout("presentations()", 5000);
- },
- success: function(data, textStatus, xhr) {
- $(".presentation").html(data.length);
- console.log('Checking presentations');
- var item_list = '';
- for (var i=0; i < data.length; i++) {
- var thumbnail = '<div class="thumbnail"><img src="/static/img/default_avatar.png" /></div>';
- var title = '<span class="title">' + data[i].name + '</span>';
- var author = '<span class="author">' + data[i].user + '</span>';
- var twitter_name = '<span class="twitter_username">@' + data[i].twitter_name + '</span>';
- var content = '<div class="content">'+ title + author + twitter_name + '</div>';
- var countdown = (data[i].status == 'ongoing' ? '<div class="countdown">9:38</div>' : '');
- var item = '<li class="'+ data[i].status +'">'+ thumbnail + content + countdown + '</li>';
- item_list += item;
- var now = new Date();
- var endingSoon = new Date(now);
- endingSoon.setMinutes(now.getMinutes() + 1);
- // $(".ongoing .countdown").countdown(endingSoon,
- // {
- // precision: "simple"
- // }
- // );
- };
- console.log(item_list);
- console.log($("#presentations ul").html());
- if($("#presentations ul").html() == item_list)
- {
- console.log('No change in presentation');
- }
- else
- {
- console.log('Presentations changed');
- $("#presentations ul").html(item_list);
- }
- },
- error: function(xhr, textStatus, errorThrown) {
- //called when there is an error
- }
- });
- }
- presentations();
Add Comment
Please, Sign In to add comment