Browsing Tag »jquery«

FluentPath: a fluent wrapper around System.IO

March 10, 2010

.NET is now more than eight years old, and some of its APIs got old with more grace than others. System.IO in particular has always been a little awkward. It’s mostly static method calls ( Path.* , Directory.* , etc.) and some stateful classes ( DirectoryInfo , FileInfo ). In these APIs, paths are plain strings. Since .NET v1, lots of good things happened to C#: lambda expressions, extension methods, optional parameters to name just a few. Outside of .NET, other interesting things happened as well. For example, you might have heard about this JavaScript library that had some success introducing a fluent API to handle the hierarchical structure of the HTML DOM. You know? jQuery . Knowing all that, every time I need to use the stuff in System...(read more)

Death to confirmation dialogs with jquery.undoable

January 2, 2010

Confirmation dialogs were designed by masochists intent on making users of the web miserable. At least that’s how I feel when I run into too many of them. And yes, if you take a look at Subtext, you can see I’m a perpetrator. Well no longer! I was managing my Netflix queue recently when I accidentally added a movie I did not intend to add (click on the image for a larger view). Naturally, I clicked on the blue “x” to remove it from the queue and saw this. Notice that there’s no confirmation dialog that I’m most likely to ignore questioning my intent requiring me to take yet one more action to remove the movie. No, the movie is removed immediately from my queue just as I requested. I love it when software does what I tell it to do and doesn’t...(read more)

jQuery Hide/Close Link

December 26, 2009

It’s Christmas day, and yes, I’m partaking in the usual holiday fun such as watching Basketball, hanging out with the family and eating our traditional Alaskan king crab Christmas dinner. But of course it wouldn’t be a complete day without writing a tiny bit of code! Today I’ve been working on improving the UI here and there in Subtext. One common task I run into over and over is using an anchor tag to trigger the hiding of another element such as a DIV . It happens so often that I get pretty tired of hooking up each and very link to the element it must hide. Being the lazy *** that I am, I thought I’d try to come up with a way to do this once and for all with jQuery and a bit of convention. Here’s what I came up with. The following HTML shows...(read more)

Live Preview jQuery Plugin

December 15, 2009

Many web applications (such as this blog) allow users to enter HTML as a comment. For security reasons, the set of allowed tags is tightly constrained by logic running on the server. Because of this, it’s helpful to provide a preview of what the comment will look like as the user is typing the comment. That’s exactly what my live preview jQuery plugin does. See it in action This is the first jQuery Plugin I’ve written, so I welcome feedback. I was in the process of converting a bunch of JavaScript code in Subtext to make use of jQuery, significantly reducing the amount of hand-written code in the project. Needless to say, it was a lot of fun. I decided to take our existing live preview code and completely rewrite it using JavaScript. All you...(read more)