From ece1dd1d7edc800085def93e50efc25a3dda55a7 Mon Sep 17 00:00:00 2001 From: Hubzilla Date: Fri, 20 Jan 2017 12:03:46 -0800 Subject: js errors with raw message-id, string update --- view/js/main.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'view/js') diff --git a/view/js/main.js b/view/js/main.js index c67f1c167..2fc912093 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -662,7 +662,13 @@ function updateConvItems(mode,data) { } // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode - if($('.item_' + bParam_mid.substring(0,32)).length && !$('.item_' + bParam_mid.substring(0,32)).hasClass('toplevel_item') && mode == 'replace') { + // use the same method to generate the submid as we use in ThreadItem, + // substr(0,32) + base64_encode + replace(['+','='],['','']); + var submid = bParam_mid; + var submid_encoded = ((submid.length) ? submid.substring(0,32) : 'abcdefg'); + submid_encoded = window.btoa(submid_encoded); + submid_encoded = submid_encoded.replace(/[\+\=]/g,''); + if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item') && mode == 'replace') { if($('.collapsed-comments').length) { var scrolltoid = $('.collapsed-comments').attr('id').substring(19); $('#collapsed-comments-' + scrolltoid + ' .autotime').timeago(); @@ -670,8 +676,8 @@ function updateConvItems(mode,data) { $('#hide-comments-' + scrolltoid).html(aStr.showfewer); $('#hide-comments-total-' + scrolltoid).hide(); } - $('html, body').animate({ scrollTop: $('.item_' + bParam_mid.substring(0,32)).offset().top - $('nav').outerHeight() }, 'slow'); - $('.item_' + bParam_mid.substring(0,32)).addClass('item-highlight'); + $('html, body').animate({ scrollTop: $('.item_' + submid_encoded).offset().top - $('nav').outerHeight() }, 'slow'); + $('.item_' + submid_encoded).addClass('item-highlight'); } $(document.body).trigger("sticky_kit:recalc"); -- cgit v1.2.3