Goodbye, Ugly
Thursday, July 26, 2007 — 14:13
I’ve got a new blog design. It looks many, many times better. I would describe it, but it’s probably easier for both of us if you just play around with it. I’ll change a few things in the next few days, but the basic design is there.
Widget Preferences
Saturday, July 21, 2007 — 17:16
Anyone who has programmed widgets knows that it can be a pain to implement preferences. You have to:
- Load the preference value, taking care to check for a null value.
- If it’s null, set the default value.
- Create the necessary DOM elements through HTML.
- Set the appropriate value on said DOM elements based on the preference value.
- Monitor the DOM elements for changes so you can update the preference value.
You get the idea. Wouldn’t it be nice if you could just instantiate a class to do the work for you, much like you do with the AppleGlassButton. If you’re saying “Golly gee, Galen, that’d be great!”, keep reading. (But first stop watching those 50’s films.)
Over the past few weeks, I’ve been working (intermittently) on a chunk of code to do just that. It’s all part of a larger chunk of code that will go into an even larger chunk of code which is our next big widget. I decided that it just wouldn’t be fair if I didn’t offer it to all my faithful readers too (all 4 of them).
Here’s the JavaScript: widg_prefs.js.
And, here’s a demo widget that uses these preference types: draft.zip.
If the demo widget doesn’t quite explain it for you, there’s some documentation at the top of widg_prefs.js. These classes require prototype and script.aculo.us.
Now, before you go and plop this into your next big widget, take a look at the demo widget. You see those three examples? Two of them are commented out. (Only one works at a time. You can tell how much time I spent on this demo.) That constitutes the entirety of the testing done. I’m not kidding.
As I use these classes in our next big widget I’m sure that I’ll find and (hopefully) fix bugs in them. I’ll put up the revised version when that widget comes out. Until then if you use these classes and find a bug, feel free to tell me all about it: galen dot winey at tacowidgets dot com.
The fine print: Use this at your own risk, free of charge. Credit to me and/or Taco Widgets would be nice. Don’t sue me.
Wednesday, July 18, 2007 — 14:16
So… after being stubborn as usual, Austin finally talked me into getting a Twitter account. You can follow the latest from the lead Taco developer (that’s me, people!) at twitter.com/galendw.