资源说明:Adds a site's favicon to an external link on your page. ( Packager compatible)
Element.getFavicons =========== Update 5: This plugin now uses the data- attribute instead of the class attribute to define absolute links to alternate images. Update 4: Ability to specify the favicon image size. I've changed the way the favicon is displayed, it used to be set as the `` background image but now that I'm seeing sites (ex. twitter) using larger favicons I felt that using an actual image tag would be best in order to keep all favicon images the same size. So now instead of applying the favicon to the `` background the `` is wrapped in a span tag and the image is injected into this span with the `` allowing you to set a specific size of the image via CSS. Update 3: Now checks for https external links as well. Update 2: You can now specify a specific location to look for a favicon per link, via a class naming convention: favicon[http://full.path.to/the/image.png]. Update 1: This plugin is now Packager compatible and will now look in the subdomain root dir if the external link points to a link with a subdomain. Goes out and grabs a site's favicon and adds it to the left of the external link. As of now this plugin will only get the favicon IF it is located at the root folder AND is using the standard naming convention "favicon" ![Screenshot](http://github.com/subhaze/mootools-external-favicon/raw/master/logo.png) How to use ---------- JavaScript #JS // You can execute from the body to get all external favicons on the page. $(document.body).getFavicons(); // You can add a prefix to the internal class names applied to the span wrapper // and image to prevent class name conflicts $(document.body).getFavicons('myPrefix-'); // result would be: , // *Note* If you add a space at the end of the class name you can apply it as another class instead // of a prefix to the internal class name $(document.body).getFavicons('newClass '); // result would be: , //You can add an array of image extensions that you wish to check for from external sites //By default it will try to find a ico, bmp, gif, or png file. $(document.body).getFavicons( null, ['png','ico'] ); HTML - Before favicon function is applied #HTML
github.com/subhaze HTML - After favicon function is applied #HTML google.com
flickr.com
twitter.com
github.com/subhaze CSS #CSS /* adjust styling of favicon image */ .favicon-img { height:16px; margin-right:4px; position:relative; top:4px; width:16px; } /* adjust styling of span wrapper if needed */ .favicon-wrapper {}
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。