What a productive day!

You know how sometimes you have those awesome productive days? Well, mine has been one of those… Got up at 6:45am (yeah, thank my little boy for that one! :-P) and figured I might as well stay up, so unloaded the dishwasher, put in another load, cleaned the house from top to bottom, entertained friends for lunch, wrote my first jQuery plug-in, wrote my first set of PHPUnit test cases for a new app I’m working on, write two blog posts (OK; so one of them is this one, but it counts, damn it!), and posted my first proper twitter message!

Now if I can squeeze in a little tv watching or Overload playing, I’ll be golden!

Did you like this? Share it:

jQuery plug-in – highlight external links

I’m pretty new to the whole jQuery game, having really only started to look at in a number of weeks ago. Until then I have been happily using Prototype and Scriptaculous, and as I knew them I didn’t see a point to move to another library. However, the more examples I saw of jQuery the more elegant I thought it was, and so now am in the process of learning it more, converting some code over and trying my hand at plug-ins. So here’s introducing my first jQuery plug-in!

This plug-in allows you to automatically append a class and title to any external resources. You can pass in multiple domains that are thought of as ‘local’, and anything else with a protocol that doesn’t belong on the passed local domains will be flagged as external. If no domains are passed then the current domain in the url will be used as-is (with the www., etc., if present).

That probably doesn’t make much sense, but I’m sure it will when using it…

So here’s the code:

Continue reading “jQuery plug-in – highlight external links”

Did you like this? Share it: