facebook.com - quiz stories remover

By reeloo Last update Mar 28, 2009 — Installed 6,453 times.

Suggestion

in
Subscribe to Suggestion 6 posts, 4 voices



David Wahlund User

Hi,
your script didn't catch all the quizzes for me so I examined the code a bit. I found that it only looks at the title of the message. I've rewritten it using the getElementsByClassName() function i FF3.
Now it looks inside the 'body' of the message, class 'UIStoryAttachment_Copy'. And matches the forbiden strings to that.
I've also edited the msg_parparpar so that when it locates the UIIntentionalStory item, I'm using 'msg_parparpar.parentNode.removeChild(msg_parparpar);' to remove it from the list of items. That way you don't see the double grey lines indicating something's missing from the homepage.

You can feedback me at david(dot)wahlund(at)gmail(dot)com

// ==UserScript==
// @name facebook.com - quiz stories remover
// @namespace www.reeloo.net
// @description removes quiz stories from homepage; additional filtering possible
// @include http://www.facebook.com/home.php*
// ==/UserScript==

//stories filtering - adding more rules
//
//you can add more rules by adding:
//forbiden_strings.push("ANY TEXT");
//
//any story containing "ANY TEXT" will be removed
//

var forbiden_strings = new Array();
//default rule to match quizzes
forbiden_strings.push("quiz and the result is");
forbiden_strings.push("Check out this quiz!");
forbiden_strings.push("took the quiz");
//here you can add new rules

//removes matching stories
function remove_stories(){
var messages = document.getElementsByClassName("UIStoryAttachment_Copy");
var count = messages.length;
for (var i = count - 1; i >= 0; i--){
msg = messages[i];
//cycles through all forbiden strings
for (var j = 0; j < forbiden_strings.length; j++){
//if msg guts matches forbiden given string
if (msg.textContent.indexOf(forbiden_strings[j]) >= 0){
//finds wrapper for given message
var msg_parparpar =

msg.parentNode.parentNode.parentNode.parentNode.parentNode;
//removes wrapper mentioned above

msg_parparpar.parentNode.removeChild(msg_parparpar);

}
}
}
}

//initiates timer to remove matching stories
//time in ms
function starter(){
//t = setInterval(remove_stories, 1000);
//to disable timer and execute script only once at pageload, comment line above and

uncomment line below, and vice-versa
remove_stories();
}

//waits till page is loaded
window.addEventListener("load", starter, false);

 
bicz User

However I'm not the author of this script, thanks for the hint with getElementsByClassName(). I was searching in all DIVs and it was redundant. But I'm not using 'msg_parparpar.parentNode.removeChild(msg_parparpar);' and there are no gray lines anyway. It was there only yesterday :)
And I recommend to apply this script for whole http://www.facebook.com/*. When you open some page in new tab, home.php will change to somthing different.

 
reeloo Script's Author

Thanks for feedbacks.

David Wahlund:
This script is customizable so then everyone can filter off any story containing any text. That's how You've extended it with "forbiden_strings.push("took the quiz");".

New version blocking all external applications is available at http://userscripts.org/scripts/show/44490

bicz:
I'll permit it for http://www.facebook.com/*home.php*.
In my opinion it's a good way to filter only home page because when You are checking someone's profile, You probably want to see everything about that person, included his/her quizzes results.

 
bicz User

reelo:
Well, it was filtering only stories containing forbiden_strings inside

tag.

You're right, http://www.facebook.com/*home.php* is better

 
brandobean User

This script isn't working for me now. (I'm not clearly sure it ever was).
I'm using the amended code above and have it enabled for http://www.facebook.com/*home.php*

Greasemonkey seems to show the script is ON, but the quiz stories remain. I also added the forbidden string "take this quiz" but still no luck. Help!

 
reeloo Script's Author

brandobean:
Use more recent and universal "facebook.com - external apps blocker": http://userscripts.org/scripts/show/44490