Makes sponsored feeds invisible on facebook.com
当前为
// ==UserScript==
// @name Facebook no ads
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Makes sponsored feeds invisible on facebook.com
// @author Darmikon
// @match https://www.facebook.com/
// @grant none
// ==/UserScript==
const trimAds = () => {
const feeds = document.getElementById('contentArea').querySelectorAll('[id*=hyperfeed_story_id]');
feeds.forEach(feed => {
try {
const titleSpan = feed
.querySelector('[data-testid="story-subtitle"]')
.children[2];
if(titleSpan.nodeName === "DIV") {
feed.style.display = "none";
}
} catch (e) {}
});
}
(function() {
window.addEventListener('scroll', () => {
setTimeout(trimAds, 1000);
});
})();