diff options
Diffstat (limited to 'js/main.js')
-rw-r--r-- | js/main.js | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/js/main.js b/js/main.js index ed8d4ec3f..2d1e9ab76 100644 --- a/js/main.js +++ b/js/main.js @@ -118,11 +118,12 @@ var scroll_next = false; var next_page = 1; var page_load = true; + var loadingPage = false; $(function() { $.ajaxSetup({cache: false}); - msie = $.browser.msie ; + msie = false; // $.browser.msie ; /* setup tooltips *//* $("a,.tt").each(function(){ @@ -162,7 +163,7 @@ function close_last_popup_menu() { if(last_popup_menu) { last_popup_menu.hide(); - last_popup_button.removeClass("selected"); +/* last_popup_button.removeClass("selected"); */ last_popup_menu = null; last_popup_button = null; } @@ -187,7 +188,7 @@ e.preventDefault(); e.stopPropagation(); if (menu.attr('popup')=="false") return false; - $(w).parent().toggleClass("selected"); +/* $(w).parent().toggleClass("selected"); */ /* notification menus are loaded dynamically * - here we find a rel tag to figure out what type of notification to load */ var loader_source = $(menu).attr('rel'); @@ -251,7 +252,7 @@ function NavUpdate() { if(liking) - $('.like-rotator').hide(); + $('.like-rotator').spin(false); if(! stopped) { @@ -270,6 +271,7 @@ if($('#live-channel').length) { src = 'channel'; liveUpdate(); } if($('#live-community').length) { src = 'community'; liveUpdate(); } if($('#live-display').length) { src = 'display'; liveUpdate(); } + if($('#live-search').length) { src = 'search'; liveUpdate(); } if($('#live-photos').length) { if(liking) { @@ -344,15 +346,27 @@ function updateConvItems(mode,data) { if(mode === 'update') { prev = 'threads-begin'; + $('.thread-wrapper.toplevel_item',data).each(function() { + var ident = $(this).attr('id'); + var commentWrap = $('#'+ident+' .collapsed-comments').attr('id'); + var itmId = 0; + var isVisible = false; + if(typeof commentWrap !== 'undefined') + itmId = commentWrap.replace('collapsed-comments-',''); + if($('#' + ident).length == 0 && profile_page == 1) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); + if($('#collapsed-comments-'+itmId).is(':visible')) + isVisible = true; $('#' + prev).after($(this)); - $("div.wall-item-ago").timeago(); + if(isVisible) + showHideComments(itmId); + $(".autotime").timeago(); // divgrow doesn't prevent itself from attaching a second (or 500th) // "show more" div to a content region - it also has a few other // issues related to how we're trying to use it. @@ -363,8 +377,13 @@ function updateConvItems(mode,data) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); + // more FIXME related to expanded comments + if($('#collapsed-comments-'+itmId).is(':visible')) + isVisible = true; $('#' + ident).replaceWith($(this)); - $("div.wall-item-ago").timeago(); + if(isVisible) + showHideComments(itmId); + $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } @@ -381,7 +400,7 @@ function updateConvItems(mode,data) { $(this).attr('src',$(this).attr('dst')); }); $('#threads-end').before($(this)); - $("div.wall-item-ago").timeago(); + $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } @@ -390,10 +409,14 @@ function updateConvItems(mode,data) { $(this).attr('src',$(this).attr('dst')); }); $('#' + ident).replaceWith($(this)); - $("div.wall-item-ago").timeago(); + $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } }); + + if(loadingPage) { + loadingPage = false; + } } if(mode === 'replace') { // clear existing content @@ -409,7 +432,7 @@ function updateConvItems(mode,data) { $(this).attr('src',$(this).attr('dst')); }); $('#' + prev).after($(this)); - $("div.wall-item-ago").timeago(); + $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } @@ -417,7 +440,7 @@ function updateConvItems(mode,data) { }); } - $('.like-rotator').hide(); + $('.like-rotator').spin(false); if(commentBusy) { commentBusy = false; @@ -469,7 +492,7 @@ function updateConvItems(mode,data) { function liveUpdate() { - if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; } + if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; } if(($('.comment-edit-text-full').length) || (in_progress)) { if(livetime) { clearTimeout(livetime); @@ -503,7 +526,7 @@ function updateConvItems(mode,data) { } if(page_load) - $("#page-spinner").show(); + $("#page-spinner").spin('small'); $.get(update_url,function(data) { var update_mode = ((page_load) ? 'replace' : 'update'); @@ -513,8 +536,8 @@ function updateConvItems(mode,data) { scroll_next = false; in_progress = false; updateConvItems(update_mode,data); - $("#page-spinner").hide(); - $("#profile-jot-text-loading").hide(); + $("#page-spinner").spin(false); + $("#profile-jot-text-loading").spin(false); }); @@ -580,14 +603,14 @@ function updateConvItems(mode,data) { function dolike(ident,verb) { unpause(); - $('#like-rotator-' + ident.toString()).show(); + $('#like-rotator-' + ident.toString()).spin('tiny'); $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); liking = 1; } function dosubthread(ident) { unpause(); - $('#like-rotator-' + ident.toString()).show(); + $('#like-rotator-' + ident.toString()).spin('tiny'); $.get('subthread/' + ident.toString(), NavUpdate ); liking = 1; } @@ -595,7 +618,7 @@ function updateConvItems(mode,data) { function dostar(ident) { ident = ident.toString(); - $('#like-rotator-' + ident).show(); + $('#like-rotator-' + ident).spin('tiny'); $.get('starred/' + ident, function(data) { if(data.result == 1) { $('#starred-' + ident).addClass('starred'); @@ -609,7 +632,7 @@ function updateConvItems(mode,data) { $('#star-' + ident).removeClass('hidden'); $('#unstar-' + ident).addClass('hidden'); } - $('#like-rotator-' + ident).hide(); + $('#like-rotator-' + ident).spin(false); }); } @@ -892,7 +915,7 @@ jQuery.timeago.settings.strings = { }; -$("div.wall-item-ago").timeago(); +$(".autotime").timeago(); //$("div.wall-item-body").divgrow({ initialHeight: 400 }); //reCalcHeight(); @@ -915,6 +938,7 @@ $("div.wall-item-ago").timeago(); } + $(window).scroll(function () { if(typeof buildCmd == 'function') { $('#more').hide(); @@ -926,12 +950,15 @@ $(window).scroll(function () { } if($(window).scrollTop() + $(window).height() == $(document).height()) { - $('#more').hide(); - $('#no-more').hide(); - // alert('scroll'); - next_page++; - scroll_next = true; - liveUpdate(); + if(! loadingPage) { + $('#more').hide(); + $('#no-more').hide(); + // alert('scroll'); + next_page++; + scroll_next = true; + loadingPage = true; + liveUpdate(); + } } } |