Skip to content

Instantly share code, notes, and snippets.

@gpoole
Last active November 1, 2020 11:08
Show Gist options
  • Save gpoole/8355ad5269d7f7308d3d42f34204bb3f to your computer and use it in GitHub Desktop.
Save gpoole/8355ad5269d7f7308d3d42f34204bb3f to your computer and use it in GitHub Desktop.
Tampermonkey userscript to remove the Facebook feed and flashing notifications
// ==UserScript==
// @name Facebook distractions off
// @author gpoole
// @version 1.0
// @description Removes distracting, attention-grabbing features like the feed and notifications from Facebook
// @include /https?:\/\/www.facebook.com\/*/
// @noframes
// @run-at document-end
// @grant none
// ==/UserScript==
// Works as of Oct 2020
// Inspired by https://greasyfork.org/en/scripts/37916-feedless-facebook
function injectStyles(styles) {
const head = document.querySelector('head');
const style = document.createElement('style');
style.innerText = styles;
head.appendChild(style);
}
function cleanPage() {
injectStyles(`
div[role=feed],
div[aria-label=Stories],
div[aria-label^=Notifications],
a[aria-label^=Watch],
div[data-pagelet=LeftRail] {
display: none;
}
`);
}
function cleanTitle() {
document.title = "Facebook";
}
cleanPage();
setInterval(cleanTitle, 250);
@Pseudothink
Copy link

Thanks! I finally hit my limit for giving away my attention when I found Facebook adding content to my news feed from sourced I'd specifically unfollowed. I guess "Unfollow" only works as long as one is over Facebook's internal threshold for followed content sources. This prompted me to wonder if I could use a TamperMonkey script to highlight and/or remove news feed items from unfollowed sources, which is how I found this scorched earth approach. Close enough!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment