Archive for the 'JavaScript' Category

Widget Doodad

Answers.com says that doodad is a synonym for widget. It also lists gimmick and contrivance, but I don’t want to complain as much as my last post.

Last Friday I took the time to update my computer to OS X 10.4, which brings with it Dashboard. I don’t have much to say about how new or not new putting JavaScriptlets on your desktop is or is not, but the installation and moving over of my files went smoothly enough that I decided to make my own Widget. I started trying to make a widget that displays a Flickr badge by generating the request that you get from their nice badge creation page, but the problem with that is it comes in as javascript code that you embed in a page, which is not easy to dynamically update. After only having something partly working I decided to rethink the whole thing. Now I use our friend the XMLHttpRequest to pull the RSS 2.0 feed and pull the title, image, and link out of that. Easy. Well, mostly easy.

Whatever part of OS X that does the HTML/CSS/JavaScript, I think it’s WebKit, is a little quirky to my understanding of xhtml. It seems that <div/> is not the same as <div></div> which is also treated differently than a div followed by a new line followed by the closing div.

Hmm, how about some of this drag and drop magic in a Dashboard Widget?

Published in: JavaScript, OS X | on May 2nd, 2005 | No Comments »

What a Drop

I spent some time recently investigating drag and drop with JavaScript. First I found a script for making anything drag-able, which is called DOM-Drag. Then, putting that to work with modifying the sibling nodes of an ordered list is Simon Cozens. Following on his success is Tim Taylor with several examples.

My own adaptation of that is to allow you to move items from one list to another. This could also be expanded from lists to just about any container. The lists are nice because you get good snap-to positioning when you drop your drag, but this combined with those fake floating windows and you could make a File Explorer or Finder simulation and be pretty happy. I haven’t done that yet, but the simple version is over here.

Published in: JavaScript | on April 14th, 2005 | 78 Comments »