Skip to main content

jQuery.favicon - jQuery plugin for adding favicons next to the links

It's easy to add little favicons next to all or external links using CSS's background properties:



a[href ^="http://jquery.com"] {
background: url(http://jquery.com/favicon.ico) center right no-repeat;
padding-right: 16px;
}



But, to automate that for all links in a page, I wrote a nifty jQuery plugin--favicon (posted to jQuery group).

Side note



I don't know of anyway to parse the domain name of a link using JavaScript and so thought of using RFC compliant regexp and had to write a PHP helper to import regexp in JavaScript:



<?php
// Generate JavaScript regexp for matching URL for getting host part
// set user agent; otherwise getting 403
ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11');
echo str_replace(array(
"\n", // remove newline
'/', // escape / to \/
'?:' // remove--we really need mach
) , array(
'',
'\/',
''
) , file_get_contents('http://web.archive.org/web/20070302134659/foad.org/~abigail/Perl/url3.regex'));
?>

Comments

Anonymous said…
This comment has been removed by a blog administrator.

Popular posts from this blog

Save American College, Madurai

This post was written in 2008 and outdated now. For update, please check Save American College, Madurai (Update 2011) Update (2011-01-16) : Save American College, Madurai (Update 2011) I'm highly privileged to have 3 degrees (B.Sc. (Spl. Physics), PGDCA and MCA) from The American College, Madurai, South India . Unlike other "commercial" colleges, American College has given room for poor students and uplifted them. And unlike other "elite" colleges who'd give seat only for "intellectuals", American College has produced geniuses. In the recent months, the saddening thing is that the college is under divide (Principal Vs. Bishop). Here is the email I sent to alumnae lately informing about the informations that I received about the developments: Update (2011-01-16) : Save American College, Madurai (Update 2011) All: I was thinking that the " Save American College " campaign was a FUD . But, when I tried to understand the problem through my...

How to pronounce Opera

To my knowledge, most of the people here in India pronounce Opera as Oh-pe-raah. Some software professionals just started a new version of pronunciation: Oh-pey-raah. Because of the confusion, I decided to ask the Opera developers. To my surprise, they told me the right pronunciation of Opera is the first one in http://www.answers.com/opera That is, the right pronunciation is AH-per-ah Links News:1120107680.833631.5510@g44g2000cwa.googlegroups.com How to pronounce Opera? Opera pronunciation (first audio file) Opera Web Browser

Open source PHP frameworks and problems

I was using CakePHP for sometime and proposed CakePlus , another UIMS toolkit on the top of CakePHP but also altering some problematic core of it. The thread should explain the outcome of the post. And, then I noted Akelos framework has most of the things built in. Issues with frameworks esp. CakePHP Scalability not a priority - Developers aren't aware that we can't throw more and more hardware Excessive use of regular expressions Evangelist isn't aware that the framework throws many queries unnecessarily More memory consumption - 100M would never be enough for a simple project Poor coding standards and practices - Prolong use of extract() often leads to more memory consumption Can't use the native approaches or baked codes. The override approach always lead to hard to debug codes Poor architected codes and no clear defined approaches. People belong to the cult drives the direction and often throws unprofiled codes. No native provision to share codes between M-V-C and...