slayeroffice - web experiments gone horribly awry

11.11.2004 - Color Palette Konfabulated

I first heard of Konfabulator earlier this year during a segment on The Screen Savers. It peaked my interest to be sure - a javascript runtime engine!

The problem, of course, was that until the other day it was OS X only - and while I do have occasional access to a powerbook through Kate, I still can't bring myself to use a Mac for anything other than browsing and checking email. I won't go into the details of why as most of the reasons are stupid and easily refuted -- it really just boils down to my being more comfortable developing on a Windows machine.

Anyway, now it's out for Windows and I've spent the past couple of days playing with it. Overall, I like it. I have a few issues, but for the most part I found it very easy to learn -- if you know javascript and have seen an xml file before, you'll get it.

A list of some of the things I don't like - if I'm wrong about any of these, absolutely let me know.

  • No "this" object, as in this.property
  • No support for anonymous functions: object.onMouseUp = function() { fooBar(x,y); }
  • Divergence from the more common attribute names. For example - vOffset instead of "top" or "y".
  • No means of importing a text file. There is an interface for deleting files, but nothing that I could find to read them.
  • Limited to one window object per widget.
  • bgOpacity property has a default value of 0. This should default to 255 when a bgColor is specified.
  • No means to hide objects. I can set the opacity of a textarea to 0, but it's still there. I guess I could muck with the zOrder, but I want to be able to display:none; the object.

I also encountered a bug where if a textarea object overlaps the transparent areas of a window object, the entire application freezes - debug window and all, and I have a few other small irks with it, like the inability to give a textarea a border.

Outside of these things, and admitedly several of them are just my own personal preference, its very, very cool.

Now that the rant is out of the way, here's my first Konfabulator effort: a "slightly less functional than its web based sister and written purely from an experimental stance" version of the Color Palette Creator.

  • Download the widget here: Color Palette Creator (47k)
  • Download the runtimes if you need them from here: Runtimes
  • Check out the modest help file I threw together, which also has a screen shot, here: Help File

Update: This doesnt work under OS X and I haven't a clue why. The debug window opens and then immediately closes with no error or anything. I tried everything I could think of to get it to run, from saving with different character encodings to changing textareas to text objects. If anyone knows why the "cross-platform bliss" isn't happening for me, please let me know.

fyi, your link to konfabulator is broken: http://www.konfabulator.com/
Posted by rick on November 12, 2004 @ 9:25 am
Thanks, Rick - fixed.
Posted by Steve on November 12, 2004 @ 10:24 am
If you don't mind my asking, where do you find out how to develop a widget? I'm pretty good at Javascript so I'd like to try my hand, but I couldn't find any development tools or documentation on the konfabulator website... Thanks!
Posted by Andre on November 12, 2004 @ 7:44 pm
Here is a PDF that was a good starting point:

http://www.konfabulator.com/workshop/Konfabulator_Ref_1.8.pdf

When that didnt answer my questions, I just looked at the source code for the widgets that konfabulator installs (the stock ticker specifically). The .widget files are just .zip's renamed, so just right click and do an "open with" to winzip.

The ,kon files are the xml files - everything else is self explanatory.
Posted by Steve on November 12, 2004 @ 11:49 pm


I wonder if you can use a regular js file to read the files and the process them into a format that you want...

Looking at this example you can just do an onLoad on a regular js file that is in the Contents folder:

http://g7awz.users.btopenworld.com/Konfabulator/WidgetMaker.zip

also this code:

<pre>

// readFile

// retrieves the contents of a local file as a JS string.

// NS4 requires Java enabled.

// Works in Mozilla 0.9.5 +

function readFile(url)

{

var req;

if (document.all){

req = new ActiveXObject("Microsoft.XMLHTTP");

}

else if (netscape){

if (document.getElementById){

req = new XMLHttpRequest();

}

else {

req = new NS4HttpRequest();

}

}

req.open("GET",url,false);

req.send(null);

return req.responseText;

}

function NS4HttpRequest()

{

this.url = "";

this.responseText = "";

}

NS4HttpRequest.prototype.open = function(method,url)

{

this.url = url;

this.method = method||get;

}

NS4HttpRequest.prototype.send = function()

{

// thank you Mr. Pemberton

if (this.url=="") return false;

var line,buffer;

this.responseText = "";

buffer = new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(this.url).openStream()));

while ((line = buffer.readLine())!=null) this.responseText+=line + " ";

if (buffer!=null) buffer.close();

return true;

}

</pre>

BTW: this widget is for all those that dont want to hard code the widget themselves, found it in the forums on the site....

Have fun.
Posted by Ilya on November 17, 2004 @ 11:14 am


Comments have been closed for this post.