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;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
.stream-item.hidden,
|
.stream-item.hidden,
|
||||||
|
.stream-item.hidden-repeat,
|
||||||
.stream-item.always-hidden {
|
.stream-item.always-hidden {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// show full notice text for all cached notices, if we have it in cache
|
||||||
$.each(oldStreamState.children('.stream-item'),function(){
|
$.each(oldStreamState.children('.stream-item'),function(){
|
||||||
getFullUnshortenedHtmlForQueet($(this),true);
|
getFullUnshortenedHtmlForQueet($(this),true);
|
||||||
|
@ -1773,6 +1776,12 @@ function addToFeed(feed, after, extraClasses) {
|
||||||
|
|
||||||
// if repeat-notice doesn't already exist in feed
|
// if repeat-notice doesn't already exist in feed
|
||||||
if($('#stream-item-' + obj.id).length == 0) {
|
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);
|
var queetHtml = buildQueetHtml(obj.retweeted_status, obj.id, extraClassesThisRun, obj);
|
||||||
|
|
||||||
if(after) {
|
if(after) {
|
||||||
|
|
|
@ -343,7 +343,7 @@ function isLocalURL(url) {
|
||||||
· · · · · · · · · */
|
· · · · · · · · · */
|
||||||
|
|
||||||
function maybeShowTheNewQueetsBar() {
|
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) {
|
if(new_queets_num > 0) {
|
||||||
|
|
||||||
$('#new-queets-bar').parent().removeClass('hidden');
|
$('#new-queets-bar').parent().removeClass('hidden');
|
||||||
|
@ -941,6 +941,7 @@ function rememberStreamStateInLocalStorage() {
|
||||||
var feed = $('<div/>').append(firstTwentyVisibleHTML);
|
var feed = $('<div/>').append(firstTwentyVisibleHTML);
|
||||||
feed.find('.temp-post').remove();
|
feed.find('.temp-post').remove();
|
||||||
feed.children('.stream-item').removeClass('not-seen');
|
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.children('.stream-item').removeClass('selected-by-keyboard');
|
||||||
feed.find('.dropdown-menu').remove();
|
feed.find('.dropdown-menu').remove();
|
||||||
feed.find('.stream-item').removeClass('expanded').removeClass('next-expanded').removeClass('hidden').removeClass('collapsing').addClass('visible');
|
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