Facebook Application Notification Remover

By Jørgen Tjernø Last update Jul 21, 2007 — Installed 606 times. Daily Installs: 0, 2, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0
// ==UserScript==
// @name           Facebook Application Notification Remover
// @namespace      http://daxxar.com/greasemonkey/
// @description    Removes notifications about application stuff like "Foo installed the bar application" and "Foo has been <something caused by an application>"
// @include        http://*facebook.com/profile.php?id=*
// @include        http://*facebook.com/home.php*
// ==/UserScript==


// Checks wether an element has a specific CSS class, by using
// a simple regex (\b means 'word boundary').
function hasClass(element, classname) {
    if (element.className
        && element.className.match(new RegExp("\\b" + classname + "\\b")))
        return true;
    return false;
}

var divs = document.getElementsByTagName('div');
for (var i = 0; i < divs.length; i++)
{
    var div = divs.item(i);
    /* This removes the notifications from the 'home' page, i.e. from 
     * your news feeds about your friends.
     * Foo (added|removed) the Bar application. */
    if (hasClass(div, 'app_install_story'))
        div.style.display = 'none';
    /* This removes the notifications from people's profiles, i.e. 
     * from their "mini-feed".
     * Foo (added|removed) the Bar application.
     * Foo was turned into a zombie.
     * (and whatever other platform-specific announces) */
    else if (hasClass(div, 'platform'))
        div.style.display = 'none';
}