Last active
December 24, 2017 12:43
-
-
Save tthew/2c80ff69da0165284953d9d75d7b2195 to your computer and use it in GitHub Desktop.
Free yourself from the Facebook feed.
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 Freed | |
// @description Free yourself from the Facebook feed. | |
// @version 1 | |
// @include https://www.facebook.com/* | |
// @grant GM_addStyle | |
// ==/UserScript== | |
GM_addStyle(` | |
div[role=feed] { | |
display: none; | |
} | |
`); | |
const freeMe = () => { | |
const feed = document.querySelector('div[role=feed]'); | |
if (feed) { | |
feed.parentNode.removeChild(feed); | |
} | |
}; | |
// Watch #content_container for changes and call freeMe on mutations | |
const target = document.querySelector('#content_container'); | |
if (target) { | |
const observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
freeMe(); | |
}); | |
}); | |
const config = { attributes: true, childList: true, characterData: true }; | |
observer.observe(target, config); | |
} | |
window.onpopstate = freeMe; | |
freeMe(); | |
console.log('Your feed is being hidden by the Freed UserScript ₍˄·͈༝·͈˄₎◞'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment