Created
January 9, 2016 09:20
-
-
Save dsiddy/87b4dac691777b5e863c to your computer and use it in GitHub Desktop.
hide Facebook feeds
This file contains 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== | |
// @match https://*.facebook.com/* | |
// ==/UserScript== | |
// Thanks to @montavilla for pointing me toward Neal Wu's Chrome extension, Kill News Feed (https://chrome.google.com/webstore/detail/kill-news-feed/hjobfcedfgohjkaieocljfcppjbkglfd), which accomplishes the same thing using jQuery. | |
function hideFeeds() { | |
var feedSelectors = [ | |
'div[id^="feed_stream"]', | |
'#pagelet_trending_tags_and_topics', | |
'#pagelet_ego_pane', | |
'#pagelet_canvas_nav_content' | |
]; | |
feedSelectors.forEach(function(feedSelector) { | |
var feed = document.querySelector(feedSelector); | |
if(feed) { | |
feed.parentNode.removeChild(feed); | |
} | |
}); | |
} | |
document.addEventListener('load', hideFeeds); | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function() { | |
hideFeeds(); | |
}); | |
}); | |
observer.observe(document, { | |
childList: true, | |
subtree: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment