Jan 15, 2008

Hate: Facebook Applications

On a completely unrelated note, here is a way to block Facebook applications on profiles:

First, you need Firefox. This doesn't work in Internet Explorer.

Then get Greasemonkey: https://addons.mozilla.org/en-US/firefox/addon/748

Install it, then right-click the GreaseMonkey icon (the little brown monkey) in the bottom-right-hand corner and go to New User Script. Type whatever Name, Namespace and Description you want, but put
as the only line for Includes. Leave Excludes empty.

Press Ok, and you should have a thing asking you for a text editor. Choose whatever you want (C:\Windows\notepad.exe under Windows, /usr/bin/gedit under Ubuntu) and copy-paste this code there:

// ==UserScript==
// @name Blocks Profile Applications
// @namespace Facebook Scripts
// @include http://*.facebook.com/profile.php*
// ==/UserScript==

function removeApplications(){
var boxes = document.getElementsByTagName("h2");

//the white-list
var allowables = ["Mini-Feed", "Information", "Friends",
"Mutual Friends", "Friends in Other Networks",
"The Wall", "Education and Work", "Photos", "Groups",

for (var i = 0; i < boxes.length; i++){
if (boxes[i].id.substr(0, 10) == "title_app_"){
var inside = boxes[i].innerHTML;

if (inside.substr(inside.length - 4) == "</a>")
inside = inside.substr(0, inside.length - 4);

var title = inside.substr(
inside.lastIndexOf(">") + 1);

var allowable = false;
for (var j=0; j < allowables.length; j++){
if (allowables[j] == title){
allowable = true;

if (!allowable){
var app_id = boxes[i].id.substr(10);
document.getElementById("box_app_" +
app_id).style.display = "none";

if (document.getElementById("icon_app" + app_id))
document.getElementById("icon_app" +
app_id).style.display = "none";

function removeRequests()
var divs = document.getElementsByTagName("div");

for ( var i = 0; i < divs.length; i++){
if (divs[i].className == "sidebar_item requests" && divs[i].innerHTML.match(/Requests/) ){
divs[i].style.display = "none";

if (window.location.toString().match(/profile/))
else if (window.location.toString().match(/home/))

If you want to change which applications are blocked, you need to change the white list, otherwise it will block all applications. You just put the name of the application in and it won't block it.

This code is not GPL'd, it is not commercial, it is not anything. Do whatever you want with it.

No comments: