Archive for March, 2008

Fluid Links [Marble of Doom edition]

Saturday, March 8th, 2008

Marble of Doom icon

Fluid 0.8.5 with More JS API

Friday, March 7th, 2008

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!

How to trick out Fluid, brought to you by thoughtbot

Thursday, March 6th, 2008

Chad Pytel of thoughtbot, inc has a great article on his blog describing how they’re using Fluid and Userscripting to enhance 37 Signal’s popular Campfire web-based chat application.

This exactly the kind of stuff I imagined being done with Fluid, and I’m so psyched to see it. I’ve been toiling away at Fluid for months, and it’s finally starting to pay off… Fluid is just getting solid enough so that it’s possible to start doing some really interesting things. And trust me, this is just the beginning.

So check out the article to get some inspiration for what you can do with Fluid and your favorite webapp.

Fluid 0.8.4 Released

Thursday, March 6th, 2008

Fluid.

…with the Userscript bugs you guys brought to my attention:

  • Fluid.app: Window is centered on launch.
  • FluidInstance.app: Fix for schizophrenic Fluid SSB Growl notification Icons.
  • FluidInstance.app: Fix for bug where ‘Enabled/Disabled’ state of Userscripts would not persist across application launches.

Fluid Gmail Userscript

Wednesday, March 5th, 2008

This userscript seems to fix the infamous (and highly annoying) empty popup window bug in Fluid Gmail SSBs when clicking on a link out side of google.com.

Can anyone please take a look, make improvements, and post your version to www.pastie.org? Thanks! Bonus points if you can add Dock badge unread count support, dock menu support, or anything interesting with Growl Notifications (like Jesse did for the Google Reader script). Any improvements you make will likely be included in the release. I’ll certainly add your name to the credits in the About box, and praise your 1337 skillz here and on fluidapp.com (whatever that’s worth! :0p).

Note that I’m planning on shipping the next version Fluid with a small collection of Userscripts to totally replace all site-specific functionality currently in Fluid proper. That would include Gmail, Google Reader, Facebook, Yahoo! Mail and Flickr. If anyone wants to tackle these to help get this release out sooner, I’d be thrilled.

Sooo… feedback on the script below?

// ==UserScript==
// @name        Gmail
// @namespace   http://fluidapp.com
// @description Gmail features for Fluid
// @include     http://mail.google.com/*
// @author      Todd Ditchendorf
// ==/UserScript==

(function () {
    var closeId = null;
    var popUpWindow = null;
    var oldOpen = window.open;    

    window.open = function() {
        var url = arguments[0];
        if (!url) {
            clearTimeout(closeId);
            closeId = setTimeout(closeWindow, 100);
        }
        var res = oldOpen.apply(window, arguments);
        if (res) {
            popUpWindow = res;
        }
        return res;
    };

    function closeWindow() {
        popUpWindow.close();
    }
})();

Fluid 0.8.3 Released

Tuesday, March 4th, 2008

0.8.3 contains a couple of bug fixes. Including one serious, intermittent crasher that was introduced in 0.8.

Also, this release fixed the bug where deselecting “Fluid attempts to show Dock badge labels” didn’t work (the Dock badge labels were erroneously still updated). This fix will allow Userscript hackers to move forward with developing Userscripts for Gmail, Google Reader, Facebook and Flickr that update the Dock Badge.

I’ve also noticed an issue with Gmail SSBs. It seems that upon creation, a Gmail SSB will not load until you reload the page 3- 5 times. After that all seems fine. I don’t know what this is about, but the issue is present at least back to 0.8 and possibly earlier. So I thought I’d at least get these fixes out now, and look into that soon.

Changes in 0.8.3:

  • FluidInstance.app: Bug fix for a common crasher introduced in 0.8 (Crash log will show -[TODAppDelegate fetchHomeURL] in crashed thread).
  • FluidInstance.app: Bugg fix: Disabling Preference: “Fluid attempts to show Dock Badges” actually works now.
  • FluidInstance.app: SSBs are smarter about what URLs match the “home URL”.

Google Reader Fluid Userscript

Monday, March 3rd, 2008

Here’s the result of tinkering with a Google Reader Userscript for Fluid for about 10 minutes… Can somebody please make this better, and post a link to your version in the comments?

Still working on getting a public repository for Fluid Userscripts. Can anyone donate Subversion hosting? :0]

// ==UserScript==
// @name        Google Reader
// @namespace   http://fluidapp.com
// @description Reader features for Fluid
// @include     http://google.com/reader/*
// @include     http://*.google.com/reader/*
// @author      Todd Ditchendorf
// ==/UserScript==

(function() {
    if (!window.fluid) {
        return;
    }
    function updateDockBadge() {
        var badgeString = "";
        var title = document.title;

        if (title && title.length) {
            var start = title.indexOf("(");
            var end = title.indexOf(")");
            if (start > -1 && end > -1) {
                start++;
                badgeString = title.substring(start, end);
                if (badgeString == "0") {
                    badgeString = "";
                }
            }
        }

        window.fluid.setDockBadge(badgeString);
    }
    setInterval(function(){updateDockBadge();}, 3000);
})();

Woopsie… Fluid 0.8.2 Released

Sunday, March 2nd, 2008

Fluid 0.8.1 had a serious issue whenever the “Browse Userscripts.org” menu item was selected. 0.8.2 is the fix.

  • FluidInstance.app: Bug fix for issue where Browse Userscripts.org menu item caused multiple windows to open.
  • FluidInstance.app: SSBs are smarter about what URLs match the “home URL”.
  • FluidInstance.app: URLs that fail to load no longer appear in the address bar autocomplete popup.

Fluidapp.com overhauled

Sunday, March 2nd, 2008

I finally got around to beefing-up the Fluid website a bit…

I added some modest documentation for Fluid’s Userscripting and JS API features.

Fluid 0.8.1 Released.

Sunday, March 2nd, 2008

Fluid 0.8.1 is all about two things: A “real” Preferences window with more preferences available, and a few bug fixes.

0.8 introduced a nasty bug where new tabs would sometimes not load their web content. This release should fix that. 0.8.1 also fixes a long-standing bug where JavaScript calls to window.open() would often not work.

As for the Preferences window, I’m using the excellent OmniAppKit framework, which makes creating these types of windows easy.

Changelog:

  • FluidInstance.app: “Open Userscripts Folder” menu item added so you can easily find the Userscripts directory.
  • FluidInstance.app: Fix for bug introduced in 0.8 where new tabs would sometimes not show any web content.
  • FluidInstance.app: Fix for bug where window.open() would sometimes not result in a new window.
  • FluidInstance.app: New Preferences Window with several tabs for different categories of options.
  • FluidInstance.app: Preference: Enable/Disable PlugIns.
  • FluidInstance.app: Preference: Enable/Disable Java.
  • FluidInstance.app: Preference: Enable/Disable JavaScript.
  • FluidInstance.app: Preference: Configure Cookie Accept policy. (Allows you to say which domains you will accept a cookie from. Still *does not* separate SSB cookie Jars.).
  • FluidInstance.app: Preference: Set “Standard Font” for web content.
  • FluidInstance.app: Preference: Set “Fixed Width Font” for web content.
  • FluidInstance.app: Preference: Enable/Disable image loading.