Last active
October 11, 2020 18:00
-
-
Save bigethan/7d65298682bf8fff59fe437b445c81b8 to your computer and use it in GitHub Desktop.
Hides posts in your linked feed that are Promoted or more than 1 week old. To install click the `Raw` button and your userscript extension will take it from there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fresh Linkedin Feed | |
// @namespace http://bigethan.com/ | |
// @version 0.1 | |
// @description Hide promoted and weeks old content in the linkedin feed | |
// @author @bigethan | |
// @match https://www.linkedin.com/feed/ | |
// @grant none | |
// ==/UserScript== | |
(function (document) { | |
var observer = new MutationObserver(function (mutations, me) { | |
// `mutations` is an array of mutations that occurred | |
// `me` is the MutationObserver instance | |
var oldEls = document | |
.querySelectorAll(".feed-shared-actor__sub-description") | |
.forEach((el) => { | |
if (/Promoted|weeks ago|month/.test(el.innerText)) { | |
el.closest("div.relative.ember-view").remove(); | |
} | |
}); | |
}); | |
// start observing | |
observer.observe(document, { | |
childList: true, | |
subtree: true, | |
}); | |
})(document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment