LinkedIn Promoted Content Blocker

Blocks promoted posts from the LinkedIn feed.

  1. // ==UserScript==
  2. // @name LinkedIn Promoted Content Blocker
  3. // @namespace https://www.jabedmiah.com
  4. // @version 1.03
  5. // @description Blocks promoted posts from the LinkedIn feed.
  6. // @author Jabed Miah
  7. // @match *.linkedin.com/feed/*
  8. // @icon https://www.google.com/s2/favicons?domain=linkedin.com
  9. // @supportURL https://github.com/miahj1/linkedin-promoted-content-blocker/issues
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (new MutationObserver(elementCheck)).observe(document, {childList: true, subtree: true});
  14.  
  15. function elementCheck(changes, observer) {
  16. const cards = document.getElementsByClassName("ember-view occludable-update");
  17.  
  18. Array.from(cards).forEach((card) => {
  19. const companyFound = card.querySelector('img[src*="company-logo_100_100"]')
  20. if (companyFound) {
  21. card.style.display = "none";
  22. }
  23. })
  24. }