Skip to content

Instantly share code, notes, and snippets.

@mazuhl
Created February 4, 2010 13:52
Show Gist options
  • Save mazuhl/294633 to your computer and use it in GitHub Desktop.
Save mazuhl/294633 to your computer and use it in GitHub Desktop.
jQuery script and accompanying CSS to pull in favicons for URLs
$(document).ready(function(){
jQuery('a.rss-item').filter(function(){
return this.hostname && this.hostname !== location.hostname;
}).each(function() {
var link = jQuery(this);
link.css('backgroundImage', 'url(' + 'http://s2.googleusercontent.com/s2/favicons?domain_url=' + escape('http://' + this.hostname) + ')');
});
});
.rss-box {
border: 2px solid #009BBA;
padding-right: 10px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.rss-items {
padding: 10px;
margin: 0px;
list-style-type: none;
}
li.rss-item {
border-bottom: 1px solid #CCC;
margin-bottom: 10px;
padding-bottom: 10px;
}
.rss-item a {
text-decoration: none;
font-size: larger;
font-weight: bold;
padding-left: 20px;
background: url('http://s2.googleusercontent.com/s2/favicons') left center no-repeat;
}
.rss-item a:hover { text-decoration: underline; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment