Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
linkedin feed trimmer
// find the text line in a feed item e.g. [person] commented on this
window.setInterval(function(){
Array.from(document.querySelectorAll("div.feed-shared-text-view > span > span")).forEach(function(item){
if(item.innerText.endsWith(" this") || item.innerText.endsWith(" this insightful")){
// mark it for ignoring and the parent for deletion
item.className="IGNORE";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display="none";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className="DELETEENTRY";
}});},100)
//find promoted posts and mark for deletion
window.setInterval(function(){
Array.from(document.querySelectorAll(".feed-shared-actor__sub-description")).forEach(function(item){
if(item.innerText.endsWith("Promoted")){
// mark it for ignoring and the parent for deletion
item.className="IGNORE";
item.parentElement.parentElement.parentElement.parentElement.parentElement.style.display="none";
item.parentElement.parentElement.parentElement.parentElement.parentElement.className="DELETEENTRY";
}});},150)
//---
// delete everything we marked - this isn't really needed since they are hidden above
window.setInterval(function(){
Array.from(document.querySelectorAll(".DELETEENTRY")).forEach(function(deleteme){
deleteme.parentNode.removeChild(deleteme);
})},500);
@eviltester

This comment has been minimized.

Copy link
Owner Author

@eviltester eviltester commented May 29, 2020

I tend to use timings 100, 500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment