Skip to content

Instantly share code, notes, and snippets.

@vshivam vshivam/no-spoiler.user.js
Last active May 25, 2016

Embed
What would you like to do?
Greasemonkey script to hide/mark spoilers on your Facebook homepage.
// ==UserScript==
// @name Spoiler Killer
// @include http://*.facebook.com/*
// @include https://*.facebook.com/*
// @require http://code.jquery.com/jquery-1.7.1.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// @version 1
// @namespace http://shivamverma.info
// @description Blacken/Completely hide facebook status updates with Game of Thrones spoilers
// ==/UserScript==
(function(){
/*** NOW DEPRECATED IN FAVOUR OF
* https://gist.github.com/vshivam/94d18c5d652217a449a5b785cbda1073
***/
var spoiler = 'I am a dumbass ! (<i>via Spoiler Killer</i>)';
var terms = ['spoiler', 'game of thrones', 'hodor', 'jon snow', 'khaleesi', 'stark', 'dothraki'];
var hide = false;
function actionFunction(node){
var content = node.html();
content = content.toLowerCase();
$.each(terms, function(index, term){
if(content.indexOf(term) > -1){
console.log(node);
if(hide){
node.html(spoiler);
} else {
node.css('background', 'black');
$(node).on("mouseenter", function(){
$(this).css('background', 'white');
});
$(node).on("mouseleave", function(){
$(this).css('background', 'black');
});
}
}
});
}
waitForKeyElements("div.userContent", actionFunction);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.