diff options
author | Mario <mario@mariovavti.com> | 2019-11-22 14:11:26 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-22 14:11:26 +0000 |
commit | b62eb665c5ad12ec7bde6bace71a0ddbb6aac28d (patch) | |
tree | e7be91535e9bb359a9199c5c28daa74d5242e178 /view | |
parent | c72716eca77d548b457621b004206aa51240464d (diff) | |
download | volse-hubzilla-b62eb665c5ad12ec7bde6bace71a0ddbb6aac28d.tar.gz volse-hubzilla-b62eb665c5ad12ec7bde6bace71a0ddbb6aac28d.tar.bz2 volse-hubzilla-b62eb665c5ad12ec7bde6bace71a0ddbb6aac28d.zip |
sse: store the item mid plus reactions mids in data-mids and change functions accordingly
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 46 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 2 |
2 files changed, 43 insertions, 5 deletions
diff --git a/view/js/main.js b/view/js/main.js index f88153d9b..29a95d9b1 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -849,10 +849,23 @@ function updateConvItems(mode,data) { // take care of the notifications count updates $('.thread-wrapper', data).each(function() { - var nmid = $(this).data('b64mid'); + //var nmid = $(this).data('b64mid'); + var nmids = $(this).data('b64mids'); - sse_mids.push(nmid); + console.log(nmids); + nmids.forEach(function (nmid, index) { + sse_mids.push(nmid); + if($('.notification[data-b64mid=\'' + nmid + '\']').length) { + $('.notification[data-b64mid=\'' + nmid + '\']').each(function() { + var n = this.parentElement.id.split('-'); + return sse_updateNotifications(n[1], nmid, true); + }); + sse_mids = []; + } + }); + +/* if($('.notification[data-b64mid=\'' + nmid + '\']').length) { $('.notification[data-b64mid=\'' + nmid + '\']').each(function() { var n = this.parentElement.id.split('-'); @@ -860,9 +873,10 @@ function updateConvItems(mode,data) { }); sse_mids = []; } - +*/ }); + // reset rotators and cursors we may have set before reaching this place $('.like-rotator').hide(); @@ -929,6 +943,22 @@ function scrollToItem() { var encoded = ((submid.substr(0,4) == 'b64.') ? true : false); var submid_encoded = ((encoded) ? submid : window.btoa(submid)); + $('.thread-wrapper').filter(function() { + if($(this).data('b64mids').indexOf(submid_encoded) > -1 && !$(this).hasClass('toplevel_item')) { + if($('.collapsed-comments').length) { + var scrolltoid = $('.collapsed-comments').attr('id').substring(19); + $('#collapsed-comments-' + scrolltoid + ' .autotime').timeago(); + $('#collapsed-comments-' + scrolltoid).show(); + $('#hide-comments-' + scrolltoid).html(aStr.showfewer); + $('#hide-comments-total-' + scrolltoid).hide(); + } + $('html, body').animate({ scrollTop: $(this).offset().top - $('nav').outerHeight(true) }, 'slow'); + $(this).addClass('item-highlight'); + } + + }); + +/* if($('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').length && !$('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').hasClass('toplevel_item')) { if($('.collapsed-comments').length) { var scrolltoid = $('.collapsed-comments').attr('id').substring(19); @@ -940,6 +970,7 @@ function scrollToItem() { $('html, body').animate({ scrollTop: $('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').offset().top - $('nav').outerHeight(true) }, 'slow'); $('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').addClass('item-highlight'); } +*/ } function collapseHeight() { @@ -1275,6 +1306,7 @@ function doreply(parent, ident, owner, hint) { } function doscroll(parent, hidden) { + var id; var x = '#hide-comments-outer-' + hidden.toString(); var back = $('#back-to-reply'); if(back.length == 0) @@ -1290,7 +1322,13 @@ function doscroll(parent, hidden) { } } back.remove(); - var id = $('[data-b64mid="' + parent + '"]'); + + $('.thread-wrapper').filter(function() { + if($(this).data('b64mids').indexOf(parent) > -1) { + id = $(this); + } + }); + $('html, body').animate({scrollTop:(id.offset().top) - 50}, 'slow'); $('<a href="javascript:doscrollback(' + pos + ');" id="back-to-reply" class="float-right" title="' + aStr['to_reply'] + '"><i class="fa fa-angle-double-down"> </i></a>').insertBefore('#wall-item-info-' + id.attr('id').replace(/\D/g,'')); } diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index f639683b8..6ae24a487 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}}" data-b64mid="{{$item.mid}}"> + <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}}" data-b64mids='{{$item.mids}}'> <a name="item_{{$item.id}}" ></a> <div class="wall-item-outside-wrapper{{if $item.is_comment}} comment{{/if}}{{if $item.previewing}} preview{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" > <div class="clearfix wall-item-content-wrapper{{if $item.is_comment}} comment{{/if}}" id="wall-item-content-wrapper-{{$item.id}}"> |