// ==UserScript== // @name Suppress Suggested and Promoted Posts on LinkedIn // @namespace https://example.com/ // @version 1.2 // @description Remove LinkedIn posts labeled as "Suggested" and dynamically observe for new ones // @author JH // @match https://www.linkedin.com/* // @include http://*linkedin.com/* // @include https://*linkedin.com/* // @license MIT // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to hide divs with data-id starting with 'urn:li:activity:' containing spans with 'Promoted' or 'Suggested' function hidePromotedPosts() { const divs = document.querySelectorAll('div[data-id^="urn:li:activity:"]'); // Select divs with data-id starting with 'urn:li:activity:' divs.forEach(div => { const spans = div.querySelectorAll('span'); // Look for spans within these divs spans.forEach(span => { if (span.textContent.trim() === 'Promoted' || span.textContent.trim() === 'Suggested') { div.style.display = 'none'; // Hide the entire div } }); }); } // Call the function to hide the promoted and suggested posts hidePromotedPosts(); // Run the function when new posts are loaded (using a MutationObserver) const observer = new MutationObserver(hidePromotedPosts); observer.observe(document.body, { childList: true, subtree: true }); })();