diff options
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 1 | ||||
-rw-r--r-- | view/js/main.js | 12 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 2bab4a0ca..ef73ed793 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -403,6 +403,7 @@ class ThreadItem { 'comment' => $this->get_comment_box($indent), 'previewing' => ($conv->is_preview() ? ' preview ' : ''), 'wait' => t('Please wait'), + 'submid' => substr($item['mid'],0,32), 'thread_level' => $thread_level ); 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(); } } diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 5bf4bc5b6..79c22b4c1 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -4,7 +4,7 @@ </div> <div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;"> {{/if}} - <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite {{/if}}"> + <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite {{/if}} item_{{$item.submid}}"> <a name="item_{{$item.id}}" ></a> <div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}" id="wall-item-outside-wrapper-{{$item.id}}" > <div class="wall-item-content-wrapper {{$item.indent}}" id="wall-item-content-wrapper-{{$item.id}}" style="clear:both;"> |