Archived Comments (locked)
|
|
The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008) |
|
|
I really like this script! I tweaked it a bit to pop the favicons over into the date margin. Not everyone will be a fan of increasing the space taken up by the date area, but I like the more left-aligned flow of the page: (function(){
addGlobalStyle(
'ul.bookmarks .dateGroup { left:-80px !important; padding-right: 20px; }' +
'ul.bookmarks .isPrivate .dateGroup { left:-100px !important; padding-right: 120px; }' +
'ul.bookmarks .post img.favicious3 { left:-20px; position: absolute; margin-right: 1ex; border: 0; }' +
'ul.bookmarks .isPrivate img.favicious3 { left:-39px !important; position: absolute; }'
);
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);
}
// apply the function to each element matched by the path
function forEachMatch(path, f, root) {
var el;
var root = (root == null) ? document : root;
var matches = root.evaluate(
path, root, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; el=matches.snapshotItem(i); i++)
f(el);
}
// adds the link favicon before itself
function add_favicon(link) {
var favicon = document.createElement('img');
favicon.className = "favicious3";
favicon.src = "http://" + link.hostname + "/favicon.ico";
favicon.width = 16;
link.parentNode.insertBefore(favicon, link);
}
// apply to all recent links, popular and your bookmarks
forEachMatch(
"//li[contains(@class, 'post')]//h4/a[1]",
add_favicon);
}())
|
|
|
Indispensable. |
|
|
As i said in the previous script comment: Excellent! |