Friday, December 19th, 2008

DLINK: automatic link annotation

Category: JavaScript, Showcase

David King has created a small JavaScript library dlink that styles your links to let the user know if the link is internal, external, a subdomain, an anchor on the same page, or an email link.

To setup, you can simply:

  1. <script type="text/javascript" src=""></script>
  3. <!-- use class=dlink -->
  4. <div class="dlink">
  5. your <a href="#">link filled</a> content...
  6. </div>
  8. <!-- change styles
  9. a.internal  {color: #D47700;}
  10. a.external  {color: #0074D4;}
  11. a.subdomain {color: #D43500;}
  12.     {color: #00B235;}
  13. -->

Posted by Dion Almaer at 12:01 am

4.3 rating from 41 votes


Comments feed TrackBack URI

That is very cute!

Admirable as it is that David offers to continually update and host the script for the audience, I would recommend against hotlinking scripts from servers outside your control. It’d be extremely simple for David to create a specialized version of his script, specifically tailored for each site to steal the secrets of it’s audience.

Now, I doubt that David would do such a thing, especially after an honorable mention here, but can YOU or YOUR clients afford to take such risks?

Hosting it on your own servers, and skimming the source code before using it, you have no worries :-)

Good work David, looks really nice!

Comment by MorganRoderick — December 18, 2008

Awesome, I’m really rather happy I’m on here! Cheers Dion!

@MorganRoderick – I kinda agree with you about hotlinking scripts from relatively unknown coders (ie me), but when you consider that a good programmers career is largely based around trust and reputation it would be suicide to do something so bad. Consider, the Twitter API and the many stats scripts too, most of which I really respect.

With that said, I can hand-on-heart promise not to abuse the trust. And thank you for the kind words, it means a lot to me!

Comment by oopstudios — December 19, 2008

Oh also, the site is running on a rock-solid RackSpace server, so it’s not going to “go down” at any point ;-)

Comment by oopstudios — December 19, 2008

Congrats David. Its about time your work was recognized.
Morgan, you bring up valid points. However David has gotten me out of more than a few jams in my coding career. He’s about as real as they come. Still amazed at what this code can do! Thanks for sharing with “the rest of us”

Comment by Acts7 — December 19, 2008

con gradual ations jerone. looks like you put a lot of time into that. However we’re here to congradulate David. But thanks for sharing your link as well.

… great work there david.

Comment by Acts7 — December 19, 2008

Cheers for the heads-up jerome, I’ll definately take a good look through your coding and whatnot. I see on your site it says “I’m not sure if all works for everybody” Can I recommend running it through If you see a pattern it’s usually pretty straightforward figuring out where the problem lies.

Comment by oopstudios — December 20, 2008

I am really excited by this! I just finished integrating dlink into my RSS reader, and it is really sweet (esp. on Ajaxian of course) seeing the favicons integrated with the link text; no more manual hovering!!!!
Also, integration was so painless I had to laugh (I render via XSLT) and dance the Jig!
I am making a release this week, just polishing off a few more defects for Xmas.
Thanks again so much!

Comment by escapellc — December 26, 2008

Cheers escapellc! I appreciate your kind words!

Comment by oopstudios — January 4, 2009

Leave a comment

You must be logged in to post a comment.