Kill All Quizzes…

Updated 2009-08-03

Well the script stopped working a while ago, and I didn’t bother to update it… but this evening I thought I would…

Intro

So, Facebook sucks, but I can’t quit it. Anyone want to look up the definition of “addiction”? The newly redesigned news-feed removed the filter-by-app feature and added quizzes. Stupid fucking quizzes!

Googling for a way to remove them, I stumbled upon this Greasemonkey script by pepcza. It’s very simple and clever, using <jargon>XPath</jargon>, something that I’ve never touched before. It works, but doesn’t catch all quizzes, it requires you to use Firefox and install Greasemonkey, and it doesn’t delete those dag-named quizzes on the second viewing.

So I decided to make a bookmarklet that everyone can install in their bookmarks toolbar. One click, and bam, the quizzes disappear. Well almost all of them anyway.

How-To – Kuneri’s Version

Kuneri wrote a filter that is more comprehensive that it deletes all “news” from external apps (so he claims), which is a good idea because Facebook apps are 99.9% shit anyway. It also catches new items and filters them straight away.

I’ve expanded on his work and made different options, e.g. one that just fades the spam and makes it readable when you click on it, and another one that makes it faded and not take up that much space.

Total Deletion
javascript:void(( function () { document.addEventListener("DOMNodeInserted",function(event) {if(location.href.match('\/home\.php') && event.target.getElementsByClassName && event.target.getElementsByClassName('UIIntentionalStory_AttachmentInfo')) cleartheshizzle(event.target);}, false ); var cleartheshizzle=function(storyNode) {var footernodes = storyNode.getElementsByClassName('UIStoryAttachment');for (var i = 0; i < footernodes.length; i++) {if (footernodes[i].innerHTML.match('apps\.facebook\.com\/')) {storyNode.style.display='none';}};footernodes=null; }; if(location.href.match('\/home\.php')) {var storyNodes = document.getElementsByClassName('UIIntentionalStory');for (var i = 0; i < storyNodes.length; i++) {cleartheshizzle(storyNodes[i]);} }})());

Faded and Shrunk, Click to View
javascript:void(( function () { document.addEventListener("DOMNodeInserted",function(event) {if(location.href.match('\/home\.php') && event.target.getElementsByClassName && event.target.getElementsByClassName('UIIntentionalStory_AttachmentInfo')) cleartheshizzle(event.target);}, false ); var cleartheshizzle=function(storyNode) {var footernodes = storyNode.getElementsByClassName('UIStoryAttachment');for (var i = 0; i < footernodes.length; i++) {if (footernodes[i].innerHTML.match('apps\.facebook\.com\/')) {var tgt = storyNode;tgt.onclick = function() {this.style.height = (this.style.height == '20px')?'auto':'20px';this.style.opacity = (this.style.opacity < 1)?1:0.2;};tgt.style.height = '20px';tgt.style.opacity = 0.2;tgt.style.overflow = 'hidden';}};footernodes=null; }; if(location.href.match('\/home\.php')) {var storyNodes = document.getElementsByClassName('UIIntentionalStory');for (var i = 0; i < storyNodes.length; i++) {cleartheshizzle(storyNodes[i]);} }})());

Here’s a preview of what it does, with pixelation to protect the innocent and the stupid:
Fade and Shrink

How To
  1. Copy one of the codes in the gray boxes above (you can triple-click to select the whole thing) into your clipboard.
  2. Go to your Bookmarks toolbar (in Firefox, this is the bar where the “Smart Bookmarks” appears), right click in an empty area, and select “New Bookmark…”
  3. Add Bookmark
    Paste the copied code into the “Location:”
  4. Give the bookmark a name. I label mine “Fuck Quizzes”, and click “Add”.
  5. To test, go to your Facebook news feed, click the bookmark, and see the quizzes (if there were any) disappear.
  6. Profit!

Old and Doesn’t Always Work – pepcza Version

pepcza’s version of the script tries to find the words “took the” and “quiz”, but I think the quizmakers are changing it to “completed the quiz”, so it doesn’t always work.
(Tried on Firefox and Opera. If you use IE, my condolonces.)

  1. Copy the following code (you can triple-click to select the whole thing) into your clipboard:
    javascript:void((function(){var filterString = []; var h = 0; filterString[h++] = "//h3[@class = 'UIIntentionalStory_Message' and ((contains(string(.), 'took the') and contains(string(.), 'quiz')) or contains(string(.), 'Check out this quiz!'))]/ancestor::div[contains(@class, 'UIStory')][1]"; filterString[h++] = "//div[@class = 'UIStoryAttachment_Copy' and ((contains(string(.), 'took') and contains(string(.), 'quiz')) or contains(string(.), 'Check out this quiz!'))]/ancestor::div[contains(@class, 'UIStory')]"; for (var h = 0; h < filterString.length; h++) { var quizStories = document.evaluate(filterString[h], document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < quizStories.snapshotLength; i++) { quizStories.snapshotItem(i).style.display = 'none';}}})());
  2. Continue with Step 2 above!

Thoughts

I wonder if there’s a way to “OR” XPath statements, there probably is, I’m just too lazy to read up on it. And I wonder if this will just make the problem worse, because people who remove the damned quiz-spam will not complain about it, and the original problem won’t get fixed.

3 Responses to “Kill All Quizzes…”


  1. 1 lianna 2009-03-22 at 16:04:54

    vielen Dank!!

  2. 2 it_me 2009-04-26 at 21:21:59

    weeeeeeeeeeeeeeeeeeeeeeeeeeee…thanks a lot!!!!!! :-)

  3. 3 haidukul 2009-04-30 at 13:23:35

    doesn’t seem to work for me. Using Opera 9.64. Done everything you said. I thnk facebook modified the text for quizez: it’s now “take this quiz”.


Leave a Reply




 

March 2009
M T W T F S S
« Jan   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

a

Reverse

To reverse the order of the entries (chronogical top-to-bottom), paste this into your address bar, and hit Enter: