Last active
November 1, 2020 11:08
-
-
Save gpoole/8355ad5269d7f7308d3d42f34204bb3f to your computer and use it in GitHub Desktop.
Tampermonkey userscript to remove the Facebook feed and flashing notifications
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 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!