Auto-completer for my blog comments

Posted by Dr Nic on June 30, 2007

It took 4 hours to return from the town of Strängnäs to Stockholm via train. Normally, its 40 minutes. The train never turned up. 4 * 60 - 40 = 200 minutes of non-travel.

Stuck in a train station for 200 minutes I tackled a problem that has irked me for some time.

In my blog comments, when I reply to someone else’s comment I’ll normally use the syntax: “@chris - thanks for the kind feedback, I’ll send the money via paypal“.

And then Chris says “@Dr Nic - yeah, send it to the usual account; the tax man will never find it“.

And then I say “@chris - no problem“.

Its not that “@chris” is difficult to spell, but I’ve used IRC and Gmail long enough that I like auto-completion. The absence of auto-completion in Skype irks me too.

What I really want is:

“@c” + TAB expands to “@chris - “

So that’s what I now have. And its neat.

Demo of auto-completer

Unfortunately, the first person to leave a comment below won’t have anyone to reply to, and so theoretically wouldn’t get to experience the joys of the feature, that is so awesome and sexy that my very own wife called:

“That’s nice dear, now help with dinner”.

So, by default “Nic”, “Dr Nic”, “drnic” are available. The 2nd commenter will get these + the name of the 1st commenter. The 3rd commenter will get… hehe, you thought I was going to type that out.

Here’s what you’ll see when you save your comments:

Testing Autocompleter

Public release

Its currently implemented for Wordpress, using Prototype/Scriptaculous. Well it works on my Wordpress theme. It figures out the auto-completion list from the HTML, not from the blog/forum server.

I’m not sure how different everyone’s HTML is for their comment blocks. That makes it tricky to release the conde at the moment for general consumption. You might be an HTML guru and make it work, but your sister isn’t.

So, can you please comment below (wink wink) with the name of your blog software, and include your blog url in the URL field. I might be asking for grief here, but I’ll scope out everyone’s blog comment HTML and see how different/similar they are.

BUT!…

If someone in the comments has already mentioned your blog software (Wordpress, Mephisto, etc) then you MUST reply to their comment. If you are first to comment with your blog software, then use “@Dr Nic” instead.

This is life-or-death critical as it gives you an excuse to play with the auto-completer thingy. Lives are at stake here people!

Don’t have a blog, but want to comment anyway to play with it in all its snazziness? Go for gold.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. johan Sat, 30 Jun 2007 00:56:02 UTC

    first post!

  2. Dr Nic Sat, 30 Jun 2007 00:56:18 UTC

    @Dr Nic - bwahaha. I am first!

  3. Dr Nic Sat, 30 Jun 2007 00:57:08 UTC

    @johan [via] - damn, wasn’t even first on my own blog.

  4. Paul Dix Sat, 30 Jun 2007 00:59:08 UTC

    @Dr Nic [via] - That’s hawt

  5. AndyKram Sat, 30 Jun 2007 04:21:15 UTC

    @Dr Nic [via] - You perpetually increase your hero rating in my book. Right now you’re DHH - 2. Any more amazing feats anytime soon could rank you at DHH - 1. Be careful, that much amazingness could have side effects.

    PS - The submit button doesn’t display in Firefox for me, so I had to IETab to IE in order to submit this comment ;). The auto-complete, though, is still complete ownage.

  6. Herry Sat, 30 Jun 2007 07:31:33 UTC

    Ah..this is revolutionary…really sweet. Btw, has some issues on IE 6, auto-complete doesn’t work, and Safari on Windows, submit button is missing too.

  7. Dr Nic Sat, 30 Jun 2007 08:12:06 UTC

    @AndyKram [via] + @Herry [via] - I must have broken that whilst trying to fix a Safari bug (read: prototype.js bug). So I’ve reverted it back. Now Safari on OSX is broken, but everyone has a submit button.

  8. Steve Tooke Sat, 30 Jun 2007 09:16:29 UTC

    @Dr Nic [via] - Very nice! Would be very neat for Mephisto - just need to write some more interesting stuff so people have something to comment about!

  9. Dr Nic Sat, 30 Jun 2007 10:23:26 UTC

    @Steve Tooke [via] - do you know if mephisto templates have similar or widely different comment HTML?

  10. Dr Nic Sat, 30 Jun 2007 10:28:01 UTC

    @Steve Tooke [via] - actually, looking at your blog theme, the HTML for each comment (not the textarea but the resulting display HTML for comments) is similar to my Wordpress theme:

    <li id="comment-8" class="alt">
    			<cite><a href="http://theedgecase.com">Joe OBrien</a></cite>
    

    The <li> class is different, but the <cite> structure is the same.

  11. JoNtE Sat, 30 Jun 2007 12:54:27 UTC

    @JoNtE Sweet!!

  12. piggy Sat, 30 Jun 2007 13:24:22 UTC

    @johan this is a test

  13. piggy Sat, 30 Jun 2007 13:29:24 UTC

    @piggy [via] - Sorry for the extra comment - I just think this is REALLY neat!

  14. Henrik N Sat, 30 Jun 2007 14:18:39 UTC

    Cool hack. Perhaps add per-comment “reply” links that populate the comment box with “@person via - ” and scroll down to it?

  15. Henrik N Sat, 30 Jun 2007 14:19:29 UTC

    Seems your time zone settings are off. Says “14:18 UTC”, but it’s currently 14:18 CEST.

  16. Dr Nic Sat, 30 Jun 2007 14:31:32 UTC

    @Henrik [via] - “reply” is a nice idea. I guess it could be dynamically placed at the end of the comment <li> element (so that its generic for all blog templates that its applied to).

  17. Chris Sat, 30 Jun 2007 16:14:00 UTC

    @Dr Nic: That money never arrived.

  18. Dr Nic Sat, 30 Jun 2007 23:12:34 UTC

    @Henrik N [via] - new “reply” links now available. Thanks for the idea.

  19. David Parker Sun, 01 Jul 2007 00:45:01 UTC

    @Dr Nic [via] - Pretty cool Dr Nic! Now should this link go to the most bottom comment from you or to the original link? Hmmm…

  20. jk Sun, 01 Jul 2007 07:38:39 UTC

    @Dr Nic [via] -
    oh,cool!

  21. jk Sun, 01 Jul 2007 07:40:59 UTC

    @jk [via] -
    test too

  22. Dr Nic Sun, 01 Jul 2007 07:48:56 UTC

    @David Parker [via] - sorry, you mean the “via” link? Currently its pointing to the “reply” comment, or the latest comment from the person you auto-completed from. Should it do something different?

  23. Dr Nic Sun, 01 Jul 2007 07:58:57 UTC

    @David Parker [via] - Ok, I noticed that some of the “via” urls had multiple “#comment-XXXX” values. I’ve cleaned these up and the code no longer generates them.

  24. jk Sun, 01 Jul 2007 08:28:26 UTC

    @Henrik N [via] - good idea

  25. Peter Burns Sun, 01 Jul 2007 12:40:03 UTC

    @Dr Nic [via] - I’m happily on Wordpress as well, though I stole my theme.

    [I'm on Camino, which uses the Firefox's Gecko rendering engine. The submit button appears, but the autocomplete doesn't.]

  26. Dr Nic Sun, 01 Jul 2007 13:20:20 UTC

    @Peter Burns [via] - in Camino it doesn’t appear to be doing anything at all. At least in Safari/WebKit the “reply” links are working.

    How do I debug Camino javascript? I’m not seeing any tools etc on Google.

  27. Robert Tue, 03 Jul 2007 16:46:40 UTC

    @Nic, have you tried using Firebug Lite? - http://www.getfirebug.com/lite.html

  28. Dr Nic Tue, 03 Jul 2007 18:48:32 UTC

    @Robert [via] - Its very cool. Now that you mention it I’ve retested the “reply” and “auto-complete” and it appears to be working for Camino now. Yipeee.

  29. Rick DeNatale Fri, 06 Jul 2007 06:36:48 UTC

    @Dr Nic [via] - I’m using typo 4.1.1 for my blog which means that the blog commenting probably won’t work.

  30. Dr Nic Fri, 06 Jul 2007 06:45:29 UTC

    @Rick DeNatale [via] - Looking at your HTML, I think it could be made to work for your template:

    <ol class="comment-list" id="commentList">
      <li id="comment-120">
      <cite><strong>Chui Tey</strong> </cite> said 6 days later:
    

    Here we’d find the comment <li> with $$('ol.comment-list li'), and the author names with $$('cite').first() inside that.

    Finally, your textarea is $(’comment_body’) where as mine is $(’comment’).

    Its different from mine, but basically the same and should be workable with some modifications.

  31. zapnap Sat, 07 Jul 2007 21:26:24 UTC

    hrmm pretty cool stuff. thanks!

  32. Peter Krantz Mon, 09 Jul 2007 20:21:46 UTC

    @Dr Nic [via] - This is very nice. From an accessibility perspective there are bit too many “via” links I guess. Maybe display of those could be a configuration option?

  33. Dr Nic Mon, 09 Jul 2007 20:56:54 UTC

    @Peter Krantz [via] - hmm; can you think of a nicer way to represent the link back?

    Ultimately I want to use the link data as a model for comment threads. Hide the [via], and indent the comment somehow. Or have arrows pointing all over the place. I’m not sure how it will look.

  34. Martijn Tue, 10 Jul 2007 16:55:02 UTC

    @Dr Nic [via] - That’s a cool idea. Thank you.

  35. Sam Nardoni Fri, 13 Jul 2007 13:30:30 UTC

    @Dr Nic [via] - This is actually amazing

  36. Bob Wed, 08 Aug 2007 04:44:50 UTC

    @Dr Nic - What about making the name the link instead of adding [via] everywhere?

  37. Dr Nic Wed, 08 Aug 2007 09:50:03 UTC

    @Bob - sounds fair and looks ok. I’ll investigate updating the script later.

  38. Paul Sat, 24 Nov 2007 01:18:26 UTC

    @Dr N

    I can’t figure out how to use this…It’s probably some stupid mistake, but what keys do I press and when for the autocomplete?

  39. Dr Nic Mon, 26 Nov 2007 04:33:48 UTC

    @Paul [via] - yeah, it seems to be broken somehow. Haven’t had time to play/fix it lately, so I just use the “reply” links.

  40. feng Thu, 10 Apr 2008 17:25:07 UTC

    You don’t have to register or login to comment, but it’s easier if you do so. We don’t censor comment based on your point of view but comments that are abusive, use excessive profanity, or contain off-topic links may get edited or deleted. On some posts, it may take up several minutes for you comment to show up.

  41. completer trackback url Fri, 02 May 2008 18:35:32 UTC

    [...] in the url field. … Use this link to trackback from your own site. Comments. Leave a response …http://drnicwilliams.com/2007/06/30/autocompleter-for-blog-comments/Open finds, minds, conversations…: Kevin Anderson hired for …TrackBack url for this entry: [...]

  42. regülatör Fri, 02 May 2008 19:10:12 UTC

    Nice website thanks

  43. dizi izle Mon, 05 May 2008 18:20:36 UTC

    On some posts, it may take up several minutes for you comment to show up.

Comments