My First jQuery Plugin
Let’s cut to the chase: I wrote my first jQuery plugin!
I have written some scripts that I have used across various projects I’ve worked on. I have thought frequently about making them into actual plugins, but until now have not done so. It was pretty easy and kind of fun.
This plugin shows a user a dialog box when they click links that link away from a given website. I’ve seen this sort of functionality around the web and, as I said, implemented it a few times myself. Hopefully, this plugin will make things easier for people.
Check it out and let me know what you think!
Comments (2)
You can follow any comments to this entry through the RSS 2.0 feed.
from Brian
16 Feb–2010 at about 1pm
Thanks for the handy plug-in!
I changed one thing, maybe you can add it to the next release.
Some of the URL’s are long and ugly. So I added:
var href=el.attr(‘href’);
var linkTitle=el.text();
var title=el.attr(‘title’);
if (title!=”) {
linkTitle=title;
}
if (linkTitle==”) {
linkTitle=href;
}
and modified this line…
msgContent=preFilteredContent.replace(/\{URL\}/g, ‘‘+linkTitle+’‘);
from Rewdy
16 Feb–2010 at about 3pm
Nice work!
Content writing conventions might make that not the best solution for everyone, but it’s great if that works best for your implementation.
Glad to see you’re using the plug in.