aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-09-25 23:09:08 -0700
committerredmatrix <mike@macgirvin.com>2016-09-25 23:09:08 -0700
commit7e59c70a9feb0de777a673a5ca5551170787c4e1 (patch)
treeee3b7dbf1bb0b9273cb88f0291c6fa2af497d50d /view/js/main.js
parentbba7fe24e91b5899035df42afb31276a6c6f1d8b (diff)
downloadvolse-hubzilla-7e59c70a9feb0de777a673a5ca5551170787c4e1.tar.gz
volse-hubzilla-7e59c70a9feb0de777a673a5ca5551170787c4e1.tar.bz2
volse-hubzilla-7e59c70a9feb0de777a673a5ca5551170787c4e1.zip
autoscroll to target post/comment when in single-thread mode; don't interfere with other modes; replaces using a named anchor with a url fragment to reach a particular place in the conversation when content is loaded with ajax.
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 227f0b7fe..1c6798c36 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -249,7 +249,7 @@ var divmore_height = 400;
var last_filestorage_id = null;
var mediaPlaying = false;
var contentHeightDiff = 0;
-var gotoAnchor = ((document.location.hash.includes('item_')) ? document.location.hash : '');
+
$(function() {
$.ajaxSetup({cache: false});
@@ -651,9 +651,13 @@ function updateConvItems(mode,data) {
collapseHeight();
}
- if(gotoAnchor != '') {
- document.location.hash = gotoAnchor;
- gotoAnchor = '';
+ // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode
+ if(bParam_mid && mode == 'replace') {
+ $('html, body').animate({ scrollTop: $('.item_' + bParam_mid.substring(0,32)).offset().top }, 'slow');
+ var scrolltoid = $('.collapsed-comments').attr('id').substring(19);
+ $('#collapsed-comments-' + scrolltoid).slideDown();
+ $('#hide-comments-' + scrolltoid).html(aStr.showfewer);
+ $('#hide-comments-total-' + scrolltoid).hide();
}
}