diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-11-29 08:34:47 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-11-29 08:34:47 +0100 |
commit | bf1ec44186ac87827ed7fc9b21e96101b6c4fad2 (patch) | |
tree | e3c15d13e4d94ccd35a91928befb6386365fcfa5 /view/js/mod_hq.js | |
parent | 455720ae938126d9a0d3c728beb0a7ba3268a4d0 (diff) | |
download | volse-hubzilla-bf1ec44186ac87827ed7fc9b21e96101b6c4fad2.tar.gz volse-hubzilla-bf1ec44186ac87827ed7fc9b21e96101b6c4fad2.tar.bz2 volse-hubzilla-bf1ec44186ac87827ed7fc9b21e96101b6c4fad2.zip |
rework liveUpdate() and notificationsUpdate() (aka ping) to first do the liveUpdate and when this is done only do the ping once. rename initLiveUpdate() to initUpdate() and more main.js cleanup.
Diffstat (limited to 'view/js/mod_hq.js')
-rw-r--r-- | view/js/mod_hq.js | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js index 3ce5f1ca6..d61a4ff3b 100644 --- a/view/js/mod_hq.js +++ b/view/js/mod_hq.js @@ -9,18 +9,20 @@ $(document).on('click', '#jot-toggle', function(e) { }); - function hqLiveUpdate(notify_id) { if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */ + if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; } - if(($('.comment-edit-text.expanded').length) || (in_progress)) { + + if(($('.comment-edit-text.expanded').length) || (in_progress) || (mediaPlaying)) { if(livetime) { clearTimeout(livetime); } livetime = setTimeout(liveUpdate, 10000); return; } + if(livetime !== null) livetime = null; @@ -113,20 +115,6 @@ function hqLiveUpdate(notify_id) { in_progress = false; - // FIXME - the following lines were added so that almost - // immediately after we update the posts on the page, we - // re-check and update the notification counts. - // As it turns out this causes a bit of an inefficiency - // as we're pinging twice for every update, once before - // and once after. A btter way to do this is to rewrite - // NavUpdate and perhaps LiveUpdate so that we check for - // post updates first and only call the notification ping - // once. - - updateCountsOnly = true; - if(timer) clearTimeout(timer); - timer = setTimeout(NavUpdate,10); - }); } else { @@ -138,20 +126,11 @@ function hqLiveUpdate(notify_id) { in_progress = false; - // FIXME - the following lines were added so that almost - // immediately after we update the posts on the page, we - // re-check and update the notification counts. - // As it turns out this causes a bit of an inefficiency - // as we're pinging twice for every update, once before - // and once after. A btter way to do this is to rewrite - // NavUpdate and perhaps LiveUpdate so that we check for - // post updates first and only call the notification ping - // once. - - updateCountsOnly = true; - if(timer) clearTimeout(timer); - timer = setTimeout(NavUpdate,10); - } + + }) + .done(function() { + notificationsUpdate(); }); } + |