// ==UserScript==
// @name          Facebook news feed filter
// @namespace     http://users.ox.ac.uk/
// @description   Filter Facebook news feed entries
// @include       http://*.facebook.com/home.php*
// ==/UserScript==

var postTypes=new Array();
postTypes[3]="Group change";
postTypes[5]="Wall post";
postTypes[6]="Relationship change";
postTypes[9]="Interests";
postTypes[11]="Status";
postTypes[12]="Tagging";

var allItems,thisLink;
allItems = document.evaluate(
    "//div[contains(@class,'feed_item')]",
    document.getElementById("home_main"),
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < allItems.snapshotLength; i++) {
    thisLink = allItems.snapshotItem(i);
    // do something with thisLink

    var pt=postType(thisLink);
    GM_log(postTypes[pt]+":"+thisLink.textContent);
switch(pt) {
case 3:thisLink.style.display="none";break;
case 9:thisLink.style.display="none";break;
}
    } 

function postType(domObj) {
var icons = document.evaluate(
    "div[contains(@class,'feed_icon')]/a[contains(@href,'filter=')]",
    domObj,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
if (icons.snapshotLength>0) {
var uri=icons.snapshotItem(0).href;
/filter=(\d+)/.exec(uri);
return parseInt(RegExp.$1);
}
return 0;
}
