Skip to content

Instantly share code, notes, and snippets.

@eviltester
Last active May 19, 2021 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eviltester/71c05ae1ea584826feac7e140f249576 to your computer and use it in GitHub Desktop.
Save eviltester/71c05ae1ea584826feac7e140f249576 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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