diff --git a/css/qvitter.css b/css/qvitter.css index 574bd3f..826af4e 100644 --- a/css/qvitter.css +++ b/css/qvitter.css @@ -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; diff --git a/js/dom-functions.js b/js/dom-functions.js index 808df3a..00f1897 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -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) { diff --git a/js/misc-functions.js b/js/misc-functions.js index b230b16..5782a1a 100644 --- a/js/misc-functions.js +++ b/js/misc-functions.js @@ -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 = $('
').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; + } + /* ·