By r8
—
Last update
Mar 1, 2008
—
Installed
177 times.
// FriendFeed FilterIcons Version 1.0
// ==UserScript==
// @name FriendFeed FilterIcons
// @namespace http://r8.com.ua
// @description Adds service filters to the top of Friendfeed page
// @include http://friendfeed.com/*
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('div#feedfilter { margin-bottom: 15px; font-weight: bold; font-size: 1.2em;} div#feedfilter a {margin-left: 8px;}');
function addIcons() {
var topdiv = document.getElementById('body').firstChild;
if (topdiv) {
var icons = document.evaluate(
"//div[@class='icon']/a",
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
);
var filterIcons = [];
for (var i = 0; i < icons.snapshotLength; i++) {
icon = icons.snapshotItem(i);
filterIcons[icon.href] = icon.innerHTML;
}
var div = document.createElement('div');
div.id = 'feedfilter';
var span = document.createElement('span');
span.innerHTML = 'Filter: ';
div.appendChild(span);
for (url in filterIcons) {
var a = document.createElement('a');
a.href = url;
a.innerHTML = filterIcons[url];
div.appendChild(a);
}
topdiv.parentNode.insertBefore(div, topdiv);
}
}
window.addEventListener(
'load', addIcons, false);