Skip to content

Instantly share code, notes, and snippets.

@dsiddy
Created January 9, 2016 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsiddy/87b4dac691777b5e863c to your computer and use it in GitHub Desktop.
Save dsiddy/87b4dac691777b5e863c to your computer and use it in GitHub Desktop.
hide Facebook feeds
// ==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