I’ve incorporated editing into the site–both traditional, link-based, and Ajax. I still need to tweak, and I imagine as people use the comments, things will break.
Both types of edits are available for each item, using the philosophy that a person may want to use a traditional edit page over an Ajax editing approach. The hypertext link for editing takes you to the full edit page, where you can also delete the comment. The Ajax approach is accessible through a ‘button’ added to the post using script.
I had planned on pulling my simple custom library for the background functionality, and either using JQuery, or Dean Edwards Base.dom on which to build. However, I’m concerned about the Safari problem with Dean’s library, and I’m not sure that JQuery fits all my needs. What I may end up doing is pulling in Edwards’ library, and creating my own custom intermediate library.
All I’ve done for now is create a singleton where before I had several global functions. The original approach doesn’t impact on performance or cross-browser compatibility, but lots of global variables can cause problems with merged libraries. I’ve also made some attempts at eliminating IE memory links related to removeChild used with elements with assigned event handlers, but this still needs work.
I have one polling operation that checks to see if there are new comments after the page is loaded, and then pulls these in if found. The new comment(s) are added to the end of the list of comments in the page, with a yellow ‘fade’ to signal the addition. I’ve also added an Ajax preview, but not a non-scripted preview. Lots of real issues doing the latter with WordPress. Mayhap someone else has a plugin for it.
Finally, I didn’t incorporate OpenID. I thought about doing this, and had incorporated OpenID for comments via an existing plug-in at one point. However, OpenID is identity, not necessarily trust or ownership. My main interest is identifying the person who just made a comment and perhaps wants to edit typos–that’s it. For now, I’m using a combination of cookies and IP address. It’s not perfect, but it should be relatively safe, and relatively open.
If I had used OpenID, those people who did not want to get one of these, or who write anonymously wouldn’t have been able to edit their comments. Contrary to popular criticism, anonymous comments do have value, at least in this space.
One big problem I ran into, and perhaps I don’t understand XHTML, is that when I created the URL to edit a comment, which uses a traditional GET with two parameters, ala ?action=editcomment&comment=3333, I received a mal-formed XML error with Firefox. The page validated, and also pulled up in every other browser. Did I miss something related to XHTML with this one?
I have a lot more to do with the site, and the underlying libraries, but I’m starting the book this next week, and will have to finish the bits off as I can. I still have my graphics and photo library, and some meta/RDF stuff I want to incorporate. Once the work I’ve published here gets a chance to be decently tested, I’ll look at packaging for other use. It’s not going to be a simple plug-in, but should be able to be packaged.
update
I had forgotten to encode the ampersand in the URL for the link. The validator did not pick it up, because I also forgot that the link wouldn’t show unless the application accessed it with my logged in cookie.
Yes, it was a particularly stupid error on my part. That’s what’s nice about XHTML: it doesn’t hesitate to let you know when you’ve been stupid. Same as anonymous commenters. <smiley />