Last active
January 27, 2017 05:10
-
-
Save nwertzberger/6cc103344750ab7fb3082d1877848236 to your computer and use it in GitHub Desktop.
This file contains 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 Kill Facebook Garbage | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide all likes, shares, comments, and replies from feed. Only Original Posts! | |
// @author Nicholas Wertzberger | |
// @match https://www.facebook.com/ | |
// @grant none | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let cleansing = false; | |
let totalClears = 0; | |
let lastClears = 0; | |
let cardDiv = 'h_gro96nogx'; | |
let matches = [ | |
' shared ', | |
'liked this', | |
'reacted to this', | |
'replied to a', | |
'commented on this', | |
'commented on your', | |
'commented on a post', | |
'was mentioned in a', | |
'Sponsored' | |
]; | |
function toNone() { | |
if ($(this).css("display") !== "none") { | |
totalClears++; | |
} | |
return "none"; | |
} | |
function cleansePage() { | |
if (cleansing){ | |
return; | |
} | |
cleansing = true; | |
for( let i=0; i < matches.length; i++) { | |
let matchText = matches[i]; | |
$("."+ cardDiv + ":contains('" + matchText + "')").css("display", toNone); | |
} | |
// This hides when people post links. | |
$("." + cardDiv + ":has('div._2iau div._6lz')").css("display", toNone); | |
// makes those one-liner posts not such a huge font size. | |
$("div._58jw").css("font-size", '12pt'); | |
cleansing = false; | |
return; | |
} | |
setInterval(() => { | |
if (lastClears == totalClears) { | |
return; | |
} | |
lastClears = totalClears; | |
console.log("Cleared " + totalClears + " pointless articles"); | |
}, 10000); | |
setInterval(cleansePage, 1000); | |
setTimeout(cleansePage, 10); | |
$(document).scroll( () => { | |
if (!cleansing) { setTimeout(cleansePage, 10);} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment