aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-05-05 19:00:00 +0200
committerMax Kostikov <max@kostikov.co>2019-05-05 19:00:00 +0200
commit0537be129cee5674823d22cf4c553510e5e7f35a (patch)
treea99678aee6d4405183940521e95436948c3e43bb
parent9b947c837093ec0d762c3b0e2610b17de9dba786 (diff)
downloadvolse-hubzilla-0537be129cee5674823d22cf4c553510e5e7f35a.tar.gz
volse-hubzilla-0537be129cee5674823d22cf4c553510e5e7f35a.tar.bz2
volse-hubzilla-0537be129cee5674823d22cf4c553510e5e7f35a.zip
More precise scroll back to initial comment in thread
-rw-r--r--view/js/main.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 5592fd63d..48159e6e8 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1160,15 +1160,12 @@ function doreply(parent, ident, owner, hint) {
}
function doscroll(parent, hidden) {
- var back = $('.back-to-reply');
- if(back.length == 0) {
- var pos = Math.round($(window).scrollTop());
- }
- else {
- var pos = back.attr('href').replace(/\D/g,'')
- }
- back.remove();
var x = '#hide-comments-outer-' + hidden.toString();
+ var back = $('.back-to-reply');
+ if(back.length == 0)
+ var pos = $(window).scrollTop();
+ else
+ var pos = back.attr('href').replace(/[^\d|\.]/g,'');
if($(x).length !== 0) {
x = $(x).attr("onclick").replace(/\D/g,'');
var c = '#collapsed-comments-' + x;
@@ -1177,6 +1174,7 @@ function doscroll(parent, hidden) {
pos += $(c).height();
}
}
+ back.remove();
var id = $('[data-mid="' + parent + '"]');
$('html, body').animate({scrollTop:(id.offset().top) - 50}, 'slow');
$('<a href="javascript:doscrollback(' + pos + ');" class="back-to-reply" title="' + aStr['to_reply'] + '"><i class="fa fa-angle-double-down float-right">&nbsp;&nbsp;&nbsp;</i></a>').insertBefore('#wall-item-info-' + id.attr('id').replace(/\D/g,''));