/*** Inspired by:* Ask the CSS Guy (http://www.askthecssguy.com/2006/12/hyperlink_cues_with_favicons.html)** Faviconize (http://www.babylon-design.com/share/faviconize/)* A jQuery plugin for displaying a favicon on an external link.** Version 1.0* March 4th, 2008** Version 1.1* Sept 21, 2008* Chris Blankenship (www.dscoduc.com)* Fixed a bug that showed up by adding line 35, if(r) **/(function($) {
$.fn.faviconize = function(e) {
var e = $.extend({ position: 'after', defaultImage: "/pics/remote.gif", linkable: false, className: "faviconize", exceptions: new Array('http://www.frostyzone.net/') }, e);
function faviconizePlace(a, h) {
switch (e.position) {
case "prepend": a.prepend(h+'&nbsp;&nbsp;'); break;
case "append": a.append('&nbsp;&nbsp;'+h); break;
case "before": a.before(h+'&nbsp;'); break;
case "after": a.after('&nbsp;'+h); break;
default: break;}}
$(this).each(function() {
var a = $(this);
if (a.attr("href")) if (a.attr("href").match(/http:\/\/www\.frostyzone\.net/i)) {
return false;}
var r = a.attr("href").match(/http:\/\/[a-z0-9.-]*(\/)?/i);
if (r) {
var r = r[0]+((r[1] == null) ? "/" : "");
if (r) {
var f = r+'favicon.ico';
var i = new Image(); $(i).attr("src", f);
var h = '<img src="'+f+'" alt="'+((e.linkable) ? a.text() : '')+'" '+((e.className) ? 'class="'+e.className+'"' : '')+' />';
h = (e.linkable) ? '<a href="'+a.attr("href")+'">'+h+'</a>' : h;
$(i).load(function() { faviconizePlace(a, h); });
$(i).error(function() { if (e.defaultImage) { faviconizePlace(a, h.replace(/src="(.*?)"/i, 'src="'+e.defaultImage+'"')); } });}}});}})(jQuery);
