/*
* FaviconLinkMarker
* von Olaf Bosch http://olaf-bosch.de
* Demo: http://olaf-bosch.de/wp-content/obosch/templates/juery/faviconlinkmarker/
* Copyright (c) 2007 Olaf Bosch
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* $Date: 2007-01-24
* $Rev: 1.0.1
**************** Example ****************************
$(document).ready(function () {
$("#YOUR-ID a").favicon("externer Link:","after","","favicon.gif");
});
* first used for the TITLE on the link, second "after" for image after, third for img or css,
* fourth parameter must give a path/to/default.gif at your Domain for favicon fails, 15x15px
* you cane use all JQuery-Selectors, $("a.classname") or $("a[@rel=external]") and so on
*/
jQuery.fn.favicon = function (titletxt,place,tag,errorgif) {
var opstyle = ""; // helper for Opera
if ($.browser.opera) {
var opstyle = "vertical-align:middle;";
}
return this.each(function() {
var hoststring = /^http:/;
var hrefvalue = this.getAttribute("href");
if (hrefvalue && hrefvalue.search(hoststring) != -1) {
var domain = this.hostname;
var host = document.location.hostname
if (domain != host) {
var cuesrc = "http://"+domain+"/favicon.ico";
if (tag == "img") {
var cue = "";
var spantag ="<\/span>";
if (place != "after") {
jQuery(this).wrap(spantag).before(cue);
} else {
jQuery(this).wrap(spantag).after(cue);
}
} else {
var dir = place == "after" ? 'right' : 'left';
if($.browser.msie) {
jQuery(this).wrap("<\/span>");
var spantag = "<\/span>";
if (dir == "left") {
jQuery(this).before(spantag);
} else {
jQuery(this).after(spantag);
}
} else {
var css = { background: "url("+cuesrc+") no-repeat "+dir+" center" };
css["padding-"+dir] = '19px';
jQuery(this).wrap("<\/span>")
.css(css);
}
}
}
}
});
};