Created
December 4, 2015 21:38
-
-
Save fortserious/b5a29378dc9e99ac39f4 to your computer and use it in GitHub Desktop.
facebook extraneous content remover
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 fb no extraneous content | |
// @namespace rossdoran.com | |
// @version 0.1 | |
// @description removes content displayed because people 'liked' it, commented on it or replied to a comment on it | |
// @author ross doran | |
// @match https://www.facebook.com/* | |
// @noframes | |
// @grant none | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
// populate whitelist | |
whitelist = [""]; // list of full names, comma-separated, each in quotes, that you want to see related content from. use the name as it appears on facebook. (remember to update this if they use a nickname later) | |
// example whitelist: | |
// whitelist = ["Alan Alda","Wendell Pierce","Jessica Walters"]; | |
waitForKeyElements("span.fcg", function() { // wait for a span with content to appear | |
$("span.fcg:contains('liked this.'),span.fcg:contains('commented on'),span.fcg:contains('replied to'),span.fcg:contains('likes')").each(function(){ checkWhiteList($(this)); }) // if span contains offending header "liked this/commented on/replied to/likes", checkwhitelist | |
}); | |
function checkWhiteList(me) // ensure that name is not in whitelisted | |
{ | |
var shareName = me.find("a").html(); | |
if (whitelist.indexOf(shareName) == -1) // if name is not present in the whitelist array | |
{ | |
removeFCG(me); // remove post | |
} | |
} | |
function removeFCG(me) | |
{ | |
me.closest(".userContentWrapper").css("display","none") // remove story content wrapper | |
me.parents("._4-u2").css("display","none") // remove the story separator line | |
// for the future: add class/ids to keep track of stories i've hidden and why (me.html() will contain the offending reason) | |
// add spot on menu bar to see what stories have been hidden with button/link/ability to unhide embedded as well as a permalink to the story | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment