Fluid 0.8.5 with More JS API
Ok, lots of JavaScript goodies in this release.
First, this release should finally fix the Usercript persistence across launches bug! :0]
Now… on to the JavaScript API. First, the easy stuff:
- window.fluid.log(obj). Logs to system log. Accepts any datatype, calls .toString() method.
- window.fluid.beep(). Sounds system beep.
- window.fluid.playSoundNamed(nameString). Plays system sound if name is valid.
- window.fluid.setDockBadge(obj). Now accepts any datatype and calls .toString() on it.
Also, some improvements to window.fluid.showGrowlNotification(). There are two additional optional properties on the parameter argument object: indentifier and onclick. These are from the Growl API. identifier is a string and will cause multiple Growl notifications called quickly in succession with the same identifier to be coalesced. onclick is a JavaScript callback function that will be called if the user clicks on the Growl Notification. So:
window.fluid.showGrowlNotification({
title: "title",
description: "description",
priority: 1,
sticky: false,
identifier: "foo",
onclick: callbackFunc
})
And last, but certainly not least, two major (but experimental) JavaScript API additions:
- Experimental JavaScript libxml2 API. New in Fluid 0.8.5, an experimental native JavaScript implementation of libxml2’s XmlTextReader pull XML parser API. This is a first-of-its-kind, full-blown XML pull parser API for JavaScript. libxml2’s API itself was heavily inspired by Microsoft’s .NET XmlTextReader API.
Under the hood, Fluid’s JavaScript XmlTextReader API is implemented using Apple’s new JavaScript Core framework in Leopard. JavaScript Core allows you to implement new native JavaScript types and expose them to a WebView’s JavaScript runtime. That’s what I’ve done here. See the JSDoc Class Documentation. This class has not been thoroughly tested.
Example usage:
var reader = new XmlTextReader("http://example.com/data.xml"); while (reader.read()) { alert(reader.nodeType); alert(reader.name); alert(reader.localName); alert(reader.value); // etc... } - Experimental implementation of Mozilla’s JavaScript SOAP API. New in Fluid 0.8.5, an experimental native JavaScript implementation of Mozilla’s JavaScript SOAP API.
Enjoy!
March 7th, 2008 at 02:25 am
Yes, the persistence of Userscripts across launches works for me now! Thanks a lot.
March 7th, 2008 at 02:56 am
*does a small jig and dance at not having to reload all these user scripts after each start*
Thank you Todd. Feel kissed !
March 7th, 2008 at 12:36 pm
@Rheta Shan smooooooch! :0]
March 7th, 2008 at 15:07 pm
Userscripts related bug finally solved! (And GreaseKit also works normally, after Fluid is fixed! I think former versions of fluid might influence the GreaseKit, though I never add any fluid apps to GreaseKit apps. Anyway, it’s now fixed and I’m so happy!) Thanks a lot, Todd!
March 7th, 2008 at 16:33 pm
@Byungho Min It might take me a few releases, but eventually i can fix these things apparently.
March 8th, 2008 at 06:51 am
Very nice, but it still suffers from an old issue:
When using Google Reader with an HTTPS URL as base (https://www.google.com/reader/view/#), hitting “v” to view the original item on a feed results in my getting two new windows:
- A new Fluid window with the #stream URL (https://www.google.com/reader/view/#stream)
- A new Safari tab with the desired link
…I can’t seem to be able to get rid of the new Fluid windows (I’ve been trying the userscripts I can find, but so far nothing works).
Also, Fluid opens new windows for Gmail and Docs (when clicked from Reader) no matter what I try to do to make them open in Safari.
March 11th, 2008 at 04:15 am
great updates so far, i love your program!
you said you like the idea of a windows port of fluid… this could be interesting for that
http://www.fullphat.net/
it’s like growl for windows i think…