Delicious.com Thumbs

By Cissy Shi Last update Nov 13, 2008 — Installed 997 times. Daily Installs: 1, 5, 1, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 2, 1, 7, 3, 4, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, 2, 0, 0

There are 2 previous versions of this script.

// ==UserScript==
// @name         Delicious.com Thumbs
// @description  A script to add thumbnails previews to the links posted on the new delicious.com 
// @include      http://delicious.com/*
// @exclude      http://delicious.com/
// @exclude      http://delicious.com/rss/*
// ==/UserScript==

(function(){

function init() {
	if(document.getElementById('bookmark-list-options').getAttribute('class') == 'FULL') {
		add_style();
		var tags = document.getElementsByTagName('a'); 
		for (i = 0; i < tags.length; i++) {
			if(tags[i].getAttribute('class') == 'taggedlink') {
				add_thumbnail(tags[i]);
			}
		}
	}
}
function add_thumbnail(a) {
	var thumb = document.createElement('img');
	thumb.setAttribute('src','http://open.thumbshots.org/image.pxf?url=' + a.href);
	thumb.setAttribute('class','thumb');
	var bm = a.parentNode.parentNode.parentNode;
	bm.parentNode.insertBefore(thumb, bm);
}

function add_style() {
	var style = document.createElement('style');
	style.type = 'text/css';
	style.appendChild(document.createTextNode(
		'ul.bookmarks li.post .meta {clear:none; float:none;}\n'+
		'ul.bookmarks li.post .description {clear:none; width:auto; max-width:100%;}\n'+
		'.thumb {float:left; width:120px; height:90px; margin-right:5px; border-color:#D5D5D5 !important; border-width:0 1px 1px !important;}'
	));
	document.body.appendChild(style);
}

init();
}())