Skip to content

Instantly share code, notes, and snippets.

@santiq
Created February 26, 2016 17:44
Show Gist options
  • Save santiq/c0a82ece6443e754e395 to your computer and use it in GitHub Desktop.
Save santiq/c0a82ece6443e754e395 to your computer and use it in GitHub Desktop.
function deleteDuplicates(){
var shouts = $('#Feed-list > .activity-element > .clearfix.shout-footer > .s-action-list').map((i,e)=>{
return ( $(e).attr('data-id') )
}).toArray();
var duplicated = shouts.filter( (elem, index, arr) => arr.indexOf(elem) !== index );
duplicated.forEach((shout)=>{
$("#Feed-list > .activity-element > .clearfix.shout-footer > div[data-id="+shout+"]").each((i,e)=>{
if(i===0)
return;
$(e).parent().parent()[0].remove()
});
})
}
deleteDuplicates();
$(document).ajaxSuccess(function(event, jqXHR, settings) {
if (settings.url.indexOf('ajax/feed/fetch') > -1 || settings.url.indexOf('serv/more/trend') > -1)
deleteDuplicates();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment