diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-17 03:10:19 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-17 03:10:19 -0700 |
commit | a50947a4bc3f779df8fa4e6777bc025fcefc8d21 (patch) | |
tree | 2196406c0c64494f5a4b604c695db6bbcd81897d /include/main.js | |
parent | c5031139ebb46ce4994d3bd62059ae4eaba71359 (diff) | |
download | volse-hubzilla-a50947a4bc3f779df8fa4e6777bc025fcefc8d21.tar.gz volse-hubzilla-a50947a4bc3f779df8fa4e6777bc025fcefc8d21.tar.bz2 volse-hubzilla-a50947a4bc3f779df8fa4e6777bc025fcefc8d21.zip |
like, dislike, activity streams, etc.
Diffstat (limited to 'include/main.js')
-rw-r--r-- | include/main.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/main.js b/include/main.js index ca6d56d8b..cc44db5d4 100644 --- a/include/main.js +++ b/include/main.js @@ -36,6 +36,7 @@ var livetime = null; var msie = false; var stopped = false; + var timer = null; $(document).ready(function() { $.ajaxSetup({cache: false}); @@ -77,12 +78,12 @@ }); }) ; } - setTimeout(NavUpdate,30000); + timer = setTimeout(NavUpdate,30000); } function liveUpdate() { - if((src == null) || (stopped)) { return; } + if((src == null) || (stopped)) { $('.like-rotator').hide(); return; } if($('.comment-edit-text-full').length) { livetime = setTimeout(liveUpdate, 10000); return; @@ -102,6 +103,8 @@ $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper')); + $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like')); + $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike')); $('#' + ident + ' ' + '.my-comment-photo').each(function() { $(this).attr('src',$(this).attr('dst')); }); @@ -110,6 +113,7 @@ } prev = ident; }); + $('.like-rotator').hide(); }); } @@ -129,3 +133,20 @@ $(node).css('width',16); $(node).css('height',16); } + + // Since ajax is asynchronous, we will give a few seconds for + // the first ajax call (setting like/dislike), then run the + // updater to pick up any changes and display on the page. + // The updater will turn any rotators off when it's done. + // This function will have returned long before any of these + // events have completed and therefore there won't be any + // visible feedback that anything changed without all this + // trickery. This still could cause confusion if the "like" ajax call + // is delayed and NavUpdate runs before it completes. + + function dolike(ident,verb) { + $('#like-rotator-' + ident.toString()).show(); + $.get('like/' + ident.toString() + '?verb=' + verb ); + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,3000); + } |