hide multiple repeats of same notice
This commit is contained in:
parent
35aad6a531
commit
95838ace25
|
@ -1706,6 +1706,7 @@ body.rtl #history-container.menu-container a .chev-right {
|
|||
overflow:hidden;
|
||||
}
|
||||
.stream-item.hidden,
|
||||
.stream-item.hidden-repeat,
|
||||
.stream-item.always-hidden {
|
||||
display:none;
|
||||
}
|
||||
|
@ -2023,7 +2024,7 @@ body.rtl .queet.rtl .expanded-content {
|
|||
overflow: hidden;
|
||||
}
|
||||
.quoted-notice:hover {
|
||||
text-decoration: none !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.stream-item:hover:not(.expanded) .quoted-notice {
|
||||
border: 1px solid #ddd;
|
||||
|
|
|
@ -718,6 +718,9 @@ function setNewCurrentStream(streamObject,setLocation,fallbackId,actionOnSuccess
|
|||
});
|
||||
}
|
||||
|
||||
// hide dublicate repeats, only show the first/oldest instance of a notice
|
||||
oldStreamState = hideAllButOldestInstanceOfStreamItem(oldStreamState);
|
||||
|
||||
// show full notice text for all cached notices, if we have it in cache
|
||||
$.each(oldStreamState.children('.stream-item'),function(){
|
||||
getFullUnshortenedHtmlForQueet($(this),true);
|
||||
|
@ -746,7 +749,7 @@ function setNewCurrentStream(streamObject,setLocation,fallbackId,actionOnSuccess
|
|||
actionOnSuccess();
|
||||
|
||||
// make sure page-container is visible
|
||||
$('#page-container').css('opacity','1');
|
||||
$('#page-container').css('opacity','1');
|
||||
|
||||
// don't invoke actionOnSuccess later if we already invoked it here
|
||||
actionOnSuccess = false;
|
||||
|
@ -1773,6 +1776,12 @@ function addToFeed(feed, after, extraClasses) {
|
|||
|
||||
// if repeat-notice doesn't already exist in feed
|
||||
if($('#stream-item-' + obj.id).length == 0) {
|
||||
|
||||
// if the repeated notice already exist in feed, we add this, but hidden
|
||||
if($('.stream-item[data-quitter-id="' + obj.retweeted_status.id + '"]').length > 0) {
|
||||
extraClassesThisRun += ' hidden-repeat';
|
||||
}
|
||||
|
||||
var queetHtml = buildQueetHtml(obj.retweeted_status, obj.id, extraClassesThisRun, obj);
|
||||
|
||||
if(after) {
|
||||
|
|
|
@ -343,7 +343,7 @@ function isLocalURL(url) {
|
|||
· · · · · · · · · */
|
||||
|
||||
function maybeShowTheNewQueetsBar() {
|
||||
var new_queets_num = $('#feed-body').find('.stream-item.hidden:not(.always-hidden)').length;
|
||||
var new_queets_num = $('#feed-body').find('.stream-item.hidden:not(.always-hidden):not(.hidden-repeat)').length;
|
||||
if(new_queets_num > 0) {
|
||||
|
||||
$('#new-queets-bar').parent().removeClass('hidden');
|
||||
|
@ -941,6 +941,7 @@ function rememberStreamStateInLocalStorage() {
|
|||
var feed = $('<div/>').append(firstTwentyVisibleHTML);
|
||||
feed.find('.temp-post').remove();
|
||||
feed.children('.stream-item').removeClass('not-seen');
|
||||
feed.children('.stream-item').removeClass('hidden-repeat'); // this means we need hide repeats when adding cached notices to feed later
|
||||
feed.children('.stream-item').removeClass('selected-by-keyboard');
|
||||
feed.find('.dropdown-menu').remove();
|
||||
feed.find('.stream-item').removeClass('expanded').removeClass('next-expanded').removeClass('hidden').removeClass('collapsing').addClass('visible');
|
||||
|
@ -959,6 +960,24 @@ function rememberStreamStateInLocalStorage() {
|
|||
}
|
||||
|
||||
|
||||
/* ·
|
||||
·
|
||||
· Hide all instances (repeats) of a notice but the first/oldest one
|
||||
·
|
||||
· @param streamItems: jQuery object with stream items as children
|
||||
·
|
||||
· · · · · · · · · */
|
||||
|
||||
function hideAllButOldestInstanceOfStreamItem(streamItemContainer) {
|
||||
streamItemContainer.children('.stream-item').each(function(){
|
||||
// if this stream item have siblings _after_ it, with the same id, hide it!
|
||||
if($(this).nextAll('.stream-item[data-quitter-id="' + $(this).attr('data-quitter-id') + '"]').length > 0) {
|
||||
$(this).addClass('hidden-repeat');
|
||||
}
|
||||
});
|
||||
return streamItemContainer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ·
|
||||
|
|
Loading…
Reference in New Issue
Block a user