diff options
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/view/js/main.js b/view/js/main.js index 4e4431f33..1322c2112 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -770,7 +770,7 @@ function updateConvItems(mode,data) { mediaPlaying = false; }); - var bimgs = ((preloadImages) ? false : $(".wall-item-body img, .wall-photo-item img").not(function() { return this.complete; })); + var bimgs = $(".wall-item-body img, .wall-photo-item img").not(function() { return this.complete; }); var bimgcount = bimgs.length; if (bimgcount) { @@ -778,22 +778,38 @@ function updateConvItems(mode,data) { bimgcount--; if (! bimgcount) { collapseHeight(); + + if(bParam_mid && mode === 'replace') + scrollToItem(); + + $(document.body).trigger("sticky_kit:recalc"); } }); } else { collapseHeight(); + + if(bParam_mid && mode === 'replace') + scrollToItem(); + + $(document.body).trigger("sticky_kit:recalc"); } +} + +function scrollToItem() { // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode // use the same method to generate the submid as we use in ThreadItem, // base64_encode + replace(['+','='],['','']); + if(justifiedGalleryActive) + return; + var submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg'); var encoded = ((submid.substr(0,4) == 'b64.') ? true : false); var submid_encoded = ((encoded) ? submid.substr(4) : window.btoa(submid)); submid_encoded = submid_encoded.replace(/[\+\=]/g,''); - if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item') && mode == 'replace') { + if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item')) { if($('.collapsed-comments').length) { var scrolltoid = $('.collapsed-comments').attr('id').substring(19); $('#collapsed-comments-' + scrolltoid + ' .autotime').timeago(); @@ -801,11 +817,9 @@ function updateConvItems(mode,data) { $('#hide-comments-' + scrolltoid).html(aStr.showfewer); $('#hide-comments-total-' + scrolltoid).hide(); } - $('html, body').animate({ scrollTop: $('.item_' + submid_encoded).offset().top - $('nav').outerHeight() }, 'slow'); + $('html, body').animate({ scrollTop: $('.item_' + submid_encoded).offset().top - $('nav').outerHeight(true) }, 'slow'); $('.item_' + submid_encoded).addClass('item-highlight'); } - - $(document.body).trigger("sticky_kit:recalc"); } function collapseHeight() { |