Skip to content

Instantly share code, notes, and snippets.

@happiness801
Last active November 28, 2019 03:41
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 happiness801/54ccde98b931f96240eabb878cbfef88 to your computer and use it in GitHub Desktop.
Save happiness801/54ccde98b931f96240eabb878cbfef88 to your computer and use it in GitHub Desktop.
Removes Facebook cruft
// ==UserScript==
// @name Remove Ads/Cruft from facebook.com
// @namespace http://onai.net/
// @version 0.1
// @description Removes ads, cruft
// @author Kevin Gwynn
// @match https://www.facebook.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let removeCruft = function() {
// Not working as a userScript currently; not sure why
let $ = document.querySelector;
// Accurate as of 2019-11-27
$('div[role=navigation] UL LI:nth-child(2)').remove(); // Watch
$('div[role=navigation] UL LI:nth-child(2)').remove(); // Marketplace
$('div[role=navigation] UL LI:nth-child(3)').remove(); // Gaming
$('div[role=complementary] div div div div div').remove(); // Ad...
$('div[role=banner] div:nth-child(4) div div div').remove(); // Give Feedback
};
//setTimeout(removeCruft, 1000);
//setTimeout(removeCruft, 3000);
//setTimeout(removeCruft, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment