diff options
author | M. Dent <dentm42@gmail.com> | 2019-02-24 03:32:39 +0100 |
---|---|---|
committer | M. Dent <dentm42@gmail.com> | 2019-02-24 03:32:39 +0100 |
commit | 89bcb1de420b63883dce63e27aa81e6e636b6129 (patch) | |
tree | 9e5b9de14c0c91f12ecfe8a1865235a348c6af4d /view/js/main.js | |
parent | ef6a280019e105bd90aca5c25e395237f9de934b (diff) | |
parent | 06aa32db224926227794fe4e76bcdfdb1b6b62e5 (diff) | |
download | volse-hubzilla-89bcb1de420b63883dce63e27aa81e6e636b6129.tar.gz volse-hubzilla-89bcb1de420b63883dce63e27aa81e6e636b6129.tar.bz2 volse-hubzilla-89bcb1de420b63883dce63e27aa81e6e636b6129.zip |
Merge branch 'js_fixes' into 'dev'
fix regression from commit 04ec35d9cc39cbf62c8db2818574c1f6d56f2a20 where...
See merge request hubzilla/core!1532
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js index 4e4431f33..b1af29846 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -784,16 +784,26 @@ function updateConvItems(mode,data) { 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 +811,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() { |