Sorry, there are no scripts tagged sidebar;highly_rated

TwitPic Previewer

By YungSang Last update May 12, 2008 — Installed 2,325 times. Daily Installs: 6, 10, 6, 4, 1, 8, 8, 2, 2, 6, 7, 12, 7, 9, 2, 10, 3, 6, 6, 3, 5, 5, 5, 3, 6, 5, 7, 2, 5, 17, 6, 6
// ==UserScript==
// @name           TwitPic Previewer
// @namespace      http://twitpic.com/
// @description    Previewing twitpic.com/* links on Twitter.
// @include        http://hahlo.com/*
// @include        http://twitter.com/*
// @author         YungSang
// @version        0.2
// ==/UserScript==
// v0.1 : 2008.05.10 : First Release
// v0.2 : 2008.05.11 : Add borders

(function(window) {
	var jquery_js = 'http://yungsang.com/js/jquery.js';
	var $ = null;

log('start');

	function loadScript(url) {
		var script     = document.createElement('script');
		script.type    = 'text/javascript';
		script.charset = 'utf-8';
		script.src     = url;

		document.getElementsByTagName('head')[0].appendChild(script);
	}

	if (typeof window.jQuery == 'undefined') {
		loadScript(jquery_js);
	}

	var loadCheckTimer = setInterval(function() {
		if (typeof window.jQuery != 'undefined') {
			clearInterval(loadCheckTimer);
			$ = window.jQuery;
			setInterval(check, 1000);
		}
	}, 250);

	function check() {
		$('a[@href*=twitpic.com]').each(function() {
			if (!this.title) resolve(this);
		});
	}

	function resolve(a) {
log(a.href);
		a.title = 'resolved';
		image = a.href + '-thumb.jpg';
		$(a.parentNode).css({position: 'relative'});
		var $img = $('<span/>').appendTo(a.parentNode).css({
			position: 'absolute',
			top     : '30px',
			left    : 0,
			display : 'none',
			width  : '150px',
			height : '150px',
			border : '5px #333 solid',
			backgroundImage: 'url(' + image + ')',
			zIndex : 20000
		});
		if ($.browser.safari) {
			$img.css({
				'border-radius': '8px',
//				'-moz-border-radius': '8px',
				'-webkit-border-radius': '8px'
			});
		}
		$(a).hover(function() {
			$img.fadeIn('slow');
		},
		function() {
			$img.fadeOut('slow');
		});
	}

//--============================================================================
//-- Logger
//--============================================================================
	function log(str) {
		if (typeof console != 'undefined') console.log(str);
	}
})((typeof unsafeWindow != 'undefined') ? unsafeWindow : window);