Facebook Highlights Remove

By Ali Karbassi Last update Jun 6, 2009 — Installed 3,691 times.

script is broken

in
Subscribe to script is broken 6 posts, 5 voices



Kahil Young Scriptwright

I love this script, but unfortunately it is now broken due to a facebook update. would love to have this back up and running. one of the best facebook scripts out there.

 
whytee User

They just changed a couple of element class names:

// ==UserScript==

// @name Facebook Highlights Remove

// @namespace http://tech.karbassi.com

// @homepage http://tech.karbassi.com

// @author Ali Karbassi

// @description Removes the annoying hightlights part of the new facebook design. Works in Firefox and Safari.

// @include http://*.facebook.com/*

// ==/UserScript==

// Comment out the header you don't want removed.

var toRemove = [

//"Today",

//"Tomorrow",

"Suggestions",

"Highlights",

"People you might know",

"Connect with friends"

];

// Do not touch if you have no clue what you're doing :D

// This function is from Dustin Diaz

function getElementsByClass(searchClass,node,tag) {

var classElements = new Array();

if ( node == null ) node = document;

if ( tag == null ) tag = '*';

var els = node.getElementsByTagName(tag);

var elsLen = els.length;

var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');

for (i = 0, j = 0; i < elsLen; i++) {

if ( pattern.test(els[i].className) ) {

classElements[j] = els[i];

j++;

}

}

return classElements;

}

Array.prototype.inArray = function (value) {

for (var i=0; i < this.length; i++) {

if (this[i] === value) {

return true;

}

}

return false;

};

var el = getElementsByClass('UITitledBox_Title');

for( var i = 0; i < el.length; i++ ) {

var temp = el[i];

if (toRemove.inArray(temp.innerHTML)) {

// Let's fine the top level div that holds all of the content

while ((temp.className != 'UIHomeBox UITitledBox') && (temp.className.indexOf('UIHomeBox UITitledBox') <= 0)){

temp = temp.parentNode;

}

// Remove this box

var t = temp;

t.parentNode.removeChild(t);

}

}

// Nothing is left, let's remove the sidebar and expand.

el = document.getElementById('home_sidebar');

if (el.childNodes.length == 0) {

// Remove the sidebar

el = document.getElementById('home_sidebar');

el.parentNode.removeChild(el);

// Expand the main content

document.getElementById('home_left_column').style.width = '940px';

document.getElementById('home_stream').style.width = '800px';

// Expand the individual messages now. Woot!

el = getElementsByClass('UIIntentionalStory_Message');

for (i = el.length - 1; i >= 0; i--){

el[i].style.width = "730px";

};

}

 
Ali Karbassi Script's Author

Updated the code. Should work. If it doesn't I will try to watch this topic more often and fix the code.

 
Steve Ashley User

I have noticed an interesting little thing with the script. I have changed the user portion of the script such that I can still access "Events" and "Friend Suggestions". If I click on "See All" for either "Events" or "Friends" and then back on "Home", the sections containing "Highlights" and "Sponsored Links" return. It also occurs if I select an application that is bookmarked, or if I select an item from the top-menu bar and then click Home. However, it appears to work fine when an non-bookmarked application is used and the "Home" button on the top-menu is clicked. Sadly, I am too inexperienced with JavaScript to have a rootle through the script and to offer suggestions but I thought I'd bring it to your attention. Would be interested to know how this comes about. I should say that I am using the script on Firefox v3.0.10.

 
Steve Ashley User

Further to my previous note, I think I can gather partly what it is. The problem is that when the main Facebook page is reloaded (after using a Facebook application) rather than having (http://www.facebook.com/home.php?) one ends up with something more like (http://www.facebook.com/home.php?ref=home#/home...) and I think that the Greasemonkey cannot handle web addresses which have # in the URL. So I suppose the question is how should the "included pages" section be modified such that it works on all reloads?

 
Scott Reeves Scriptwright
SafariMacintosh

Recent changes to Facebook's markup mean another update is needed.

Change this:
var el = getElementsByClass('UITitledBox_Title');

To this:
var el = getElementsByClass('UITitle UITitle_h5');