Archive for the ‘Code Releases’ Category

MooTools 1.1 > 1.2 Upgrade Helper

December 31st, 2009 by Aaron N.

Several weeks ago I had the pleasure of addressing a large crowd of Joomla developers at their conference in New York. The Joomla community is a fantastic bunch and the time I spent there talking about MooTools was perhaps some of the best I’ve had. The people present were very interested in MooTools and as well they should be. Joomla ships with MooTools built in and there is a large community of Joomla plugin developers who end up using MooTools because of it. Unfortunately, it still ships with 1.1.

A few months ago we, the MooTools team, decided to start focusing more on helping the Joomla community with their upgrade woes and began to re-address the compatibility code for 1.1 to 1.2 in earnest. When I spoke in New York to the Joomla team there and said that our goal was to have something to help them upgrade available by the end of the year, there was, dare I say, rawkus applause.

Well, here it is, Dec 31, and I’ve kept my promise. With the help of many of the MooTools Dev team (Chris Pojer, Darren Waddell, Nathan White, and others) we’ve finally got a compatibility layer that actually works and, more importantly, helpes you upgrade.

First, it logs warnings to the console (such as Firebug) and helps you find the places in your code that need updating. The script is not a compatibility layer as much as it is an upgrade helper. Hopefully this will help us retire 1.1 for good.

Secondly, easily half of the work, if not more, was spent creating a test environment for it. When MooTools 1.1 came out, we didn’t have a test framework to run against the code. When we released MooTools 1.2, we did, and it shipped with tests for most of the functionality included. So to make this compatibility layer, we had to go write tests for all of 1.1 (about 400 individual tests), then write the upgrade helper, compatibility code, and then run the tests from 1.1 against the 1.2 code base with the upgrade helper loaded. Creating the tests for a deprecated code base is no fun but I’m glad we did, otherwise the compatibility code would be in far worse shape.

But as a result of all that work by the MooTools Dev team, I can say that the helper script we released today is likely to cover about 95% of all the changes between 1.1 and 1.2; the other 5% being essentially un-hackable. Still, for most developers, it should cover all their work.

Seeing 2010 roll in with people dropping 1.1 is a great way to start it. If you’re still running 1.1, now is the time to move on.

You can find out more about the upgrade helper on the MooTools Blog.

Clientcide 2.2.0 Released

November 9th, 2009 by Aaron N.

2009 has been a very busy year for MooTools and I’ve spent much of my time working on things other than Clientcide (like MooTools and Cloudera Desktop). MooTools More continues to grow – the latest releases (1.2.4.1 and 1.2.4.2) are full of all sorts of new features (over 50 plugins if you exclude all the date localization files), but you’ll probably recognize some old friends. Mask looks a lot like Modalizer, Spinner like Waiter, Form.Request like Fupdate, etc. That’s because in an effort to make MooTools more feature rich I and the other MooTools developers have been moving our work into the official project.

As such, Clientcide 2.2.0 is really a bug fix and compatibility release. There are very few new features but that’s because, in a way, all the new features are in MooTools More.

Here’s what’s new in 2.2.0:

  • Modalizer is deprecated in favor of Mask
    • compat file is just the deprecated library; does not convert to Mask instances but rather just returns Modalizer as it always did
  • StickyWin.Modal has new options for Mask; this is a breaking change
  • Removed Element.Delegation (now in MooTools More; unchanged)
  • Deprecated DollarE
  • Deprecated DollarG
  • Fupdate is now Form.Request in MooTools More; see compat files
    • Fupdate.Prompt is now Form.Request.Prompt
    • Fupdate.Append.Prompt is now Form.Request.Append.Prompt
    • Fupdate.AjaxPrompt is now Form.Request.AjaxPrompt
    • Fupdate.Append.AjaxPrompt are now Form.Request.Append.AjaxPrompt
  • FormValidator got renamed in MooTools More to Form.Validator (the old name is preserved); updated FormValidator.Tips to Form.Validator.Tips (again, the old name still works).
  • Collapsable is now Collapsible (that’s correct, I cannot spell). The old name is preserved (though the file name itself changed; update your build scripts).
  • HtmlTable moved to MooTools More. No breaking changes, but the -more version has new features.
  • Added Italian, Spanish translations for Simple Editor
  • New StickyWin features
    • Z-index Ordering!
    • changing default value for allowMultipleByClass in StickyWin to true
    • Added setCaption method to StickyWin.UI
    • onUpdate event for StickyWin.Ajax
  • added detach method to MooScroller
  • dbug should now work in IE8
  • offset options are now additive for pointy tip
  • numerous bug fixes

For the most part compatibility is preserved. There’s that one breaking change in StickyWin.Modal where the options for the modal layer are different. I can only test this so much, so if you find areas where the compat files don’t provide coverages, please file a ticket.

I’ve also updated the download builder on Clientcide to use the now open source builder called MooTools Depender. Check out the blog post on MooTools.net if you want to know more about it. One cool thing about that you might find useful it is the ability to re-download a script you created with a given url. Now, when you download a script, the header includes a url to re-download the library with the same selections. This should make upgrading libraries a little easier.

MooTools 1.2.4, Clientcide Libs, and What I’ve Been Up To

October 19th, 2009 by Aaron N.

I know what you’re thinking. It’s been 3 months since I last posted. My last post was all about how you can pay it back to MooTools, and since then I’ve been taking my own medicine.

MooTools 1.2.4 released today along with MooTools More 1.2.4.1. In this release, I’ve pushed 274 commits into the codebase (out of 398). There’s a LOT of new features in it, but some should look familiar.

For instance, my Waiter class is there, now called Spinner. And my Modalizer class is there, now called Mask. Oh, and Fupdate finally got a decent name; it’s Form.Request.

But there’s a lot of other stuff in there, and that’s not even the only place I’ve been cranking. There’s also a dependency loader for lazy loading MooTools scripts called Depender. There’s an all-JavaScript version and a server side implementation (that’s way faster; available as PHP or Python/Django).

And then there’s MooTools ART, which is awesome. It’s the beginning of a UI system for MooTools plugins.

Rather than go over all this stuff in detail though, I’ll just point you to the blog post I wrote over on the Cloudera Blog, which outlines all the cool stuff we’ve been building with all these new toys. There’s even a fancy screencast.

The Clientcide Libs and MooTools 1.2.4

But you’re probably asking yourself, what about the Clientcide plugins? Well, obviously I haven’t forgotten about them. First and foremost, it should be rather obvious by now that much of my work is now being pushed into MooTools instead of released here. It makes sense mostly, as the plugins get reviewed by the other MooTools dev team members and the result is always better. There are still a few plugins here that don’t belong in MooTools More and to that end I’ve been maintaining them, occasionally adding features.

The current version of Clientcide – 2.1.0 – should work fine with 1.2.4. The catch is that the upgrade path to switch to the new instances of the things that moved (for instance, Waiter moving to MooTools More and now being called Spinner), isn’t super duper easy. I do plan on authoring compat layers for some of these scripts, but not all of them.

What does this mean if you’re using these libraries? Well, you can keep using them. But I’m not going to maintain Waiter, for instance. I’ll focus on Spinner. Converting from one to the other should be relatively straight forward, but since they both work in the same space (because they have different names), you should be able to use either one or both.

Look for a release in a week or so of the next version of Clientcide for MooTools 1.2.4. There are several bug fixes and I will have some compatibility layers for some of the plugins. In the mean time, you should be able to update to 1.2.4 without any issues.

The Exceptions

The only exception here is that MooToosl More 1.2.4 includes a few plugins that are almost direct copies of what I have in 2.1.0, namely HtmlTable and Element.Delegation. If you’re using either of these scripts, you can just ditch the copy you get from me and use the ones in 1.2.4.

Clientcide 2.1.0: updated for MooTools 1.2.3, bug fixes, a few new features

June 19th, 2009 by Aaron N.

Today we released MooTools 1.2.3 and MooTools More 1.2.3.1. Both of these are, for the most part, bug fix releases with a few small features included. The big change is the deprecation of $ which is now replaced by document.id. This is a big change, and I suggest that you go read up on the MooTools blog about the details. It’s important to note that it won’t affect any of your code; all of these updates include no breaking changes.

The removal of $ as a dependency means that you can use MooTools with other frameworks (like jQuery) and MooTools won’t break. But if your code still uses $ then nothing will change unless you want to use MooTools with another framework that also uses $. Then you might want to consider using document.id, too.

For plugin authors, such as myself, you should update your code to use document.id. This will ensure that if someone using your plugins is using another library that overwrites $, then your plugin will still work. Note that you can easily upgrade an existing plugin by either searching and replacing $() for document.id() (be cautious that your search doesn’t catch $$()) or you can wrap your plugin in an enclosure:

var Widget = (function($){
    return new Class({
       initialize: function(element) {
           this.element = $(element);
           //...etc
       }
    });
})(document.id)

With the Clientcide conversion, I’ve opted for the former (to replace $ with document.id). In addition to this big change, the following other changes and features are included in 2.1.0:

  • Universal: replacing all $() with document.id() (see MooTools 1.2.3)
  • Autocompleter: defining splitter based on separator
  • Autocompleter: Fixing autocompleter for Opera
  • Class.Occlude, Class.ToElement: adding a compat layer for ToElement and Occlude
  • Element.Delegation: Tweaked event delegation check to not extend elements unless match is found.
  • Element.Delegation: Added an over 100x faster event delegation check that walks up the DOM tree from the target checking against the selector. Also removed mouseover and mouseout logic that seemed to be unnecessary.
  • FixPNG: adding alternate fixpng suggestion (in docs)
  • Fupdate: adding caption option to Fupdate
  • Fupdate: adding method and emulation to fupdate request
  • Fupdate.Prompt: making fupdate ajax prompt work with formvalidators applied inline in the html
  • MenuSlider: adding isVisible method for MenuSlider
  • SimpleSlideShow.Carousel: fixing overflow in SimpleSlideShow.Carousel for IE6
  • StickyWin: added click-out and escape options for closing stickywin
  • StickyWin: adding onDestroy event to StickyWin
  • StickyWin.Alert: updating reference to StickyWin.alert > StickyWin.Alert
  • StickyWin.Alert, StickyWin.Confirm, StickyWin.Prompt: refactoring the stickywin alert, confirm and (new) prompt shortcuts into classes
  • StickyWin.Prompt: new class!
  • StickyWin.UI.Pointy: several css and code tweaks to manage IE layout issues; making background image properties in StickyWin.UI.Pointy css attributes (in a <style> tag) to avoid this crazy bug: http://davidovitz.blogspot.com/2006/09/https-bug-in-ie.html

Jira Awesomizer

May 18th, 2009 by Aaron N.

We use Jira for issue tracking where I work. It’s interface…. leaves something to be desired.

I hacked together a greasemonkeyscript that makes it a little less painful. If you use Jira, you might want to check it out.

FancyUpload 3.0 Released

April 30th, 2009 by Aaron N.

Harald Kirshner (a.k.a. digitarald) released the latest incarnation of his (awesome) flash / js based file uploader, FancyUpload.

Despite the delay, the completely rewritten version ofFancyUpload, version 3.0, got pushed to github today. This new version is more stable, has betterdocumentation and more showcases than ever. I even added two download packages with runnable installations, like many developers requested. This article introduces the new features and showcases, impatient readers can jump directly to the comprehensive project page or fork on github.

New Features

There are a lot of new features and fixed bugs in this new release, so let me distill the most important ones for you:

  • The API with, separated uploader and file classes, allows an easy implementation in all kind of interfaces
  • Events are dispatched for every step of the uploading process, to keep the interface as responsive as possible
  • Progress tracks the loaded size, upload-rate, estimated time and other values for every file and for the batch as a whole
  • File uploads can be stopped, restarted or removed anytime
  • New Iframe-based class for multiple, asynchronous uploads without dependency on Flash
  • Compatible with Flash 9 and 10 with the browse button as a transparent overlay or as an interactive image sprite
  • Ability to change the upload URL and add POST/GET data on runtime, customized for every file or the whole process

Link »

A MooTools File Manager

April 29th, 2009 by Aaron N.

Chris Pojer, one of the MooTools developers, just released his FileManager plugin and it’s worth checking out.

  • Browse through Files and Folders on your Server
  • Rename, Delete, Move (Drag&Drop), Copy (Drag + hold CTRL) and Download Files
  • View detailed Previews of Images, Text-Files, Compressed-Files or Audio Content
  • Nice User Interface
  • Upload Files via FancyUpload (integrated Feature)
  • Option to automatically resize big Images when uploading
  • Use it to select a File anywhere you need to specify one inside your Application’s Backend
  • Use as a FileManager in TinyMCE
  • Provides your Client with the most possible convenience

Be sure to check out the demos:

Clientcide 2.0.2: Event Delegation Updated for MooTools 2.0 Compatibility

April 27th, 2009 by Aaron N.

I’ve just made an update to the Clientcide libs. Aside from a few minor tweaks and fixes, the big change is that I’ve updated my Event.Delegation.js beta plugin.

MooTools 2.0 features built in event delegation (among many, many other enhancements) but the syntax is a little different than the previous version of my beta plugin. While my previous version had the syntax like this:

element.addEvent('click(a)', function(){...});

MooTools 2.0 currently has the syntax as:

element.addEvent('click:relay(a)', function(){...});

I’ve updated my version to use this new syntax which should make it a little safer to use. For starters, assuming the syntax doesn’t change in 2.0 (which it totally could), you won’t have to do anything when you upgrade. But the other benefit is that, if the syntax changes, it’ll be easier to find them. My previous version is basically impossible to search for in your code, which means that if you’ve been using it in your work and need to update the syntax, it’s going to be hard to find them all.

Warning!

To help with this migration I’ve added a little logic to the code so that if it sees you trying to add an event with the old syntax (‘click(a)’) it’ll post a console warning that the selector is no longer valid. This should make it possible for you to browse around your application(s) and see if there are any warnings.

Still Not Perfect

It’s also worth noting that my plugin still suffers from the same problems it had before. Namely, you can’t monitor the blur and focus events and some custom events might not work for you (I haven’t tested them all, but I suspect some won’t work).

Other than that, I’m going to upgrade this from “academic exercise” to “totally usable but might mean some work to upgrade later.”

MooTools 1.2.2, More 1.0 and Clientcide

April 25th, 2009 by Aaron N.

Today after many months of work, the latest version of MooTools Core and the shiny new MooTools More have launched. If you haven’t read up on that, you best get on it. But, you ask, what about all the goodies on Clientcide? Obviously you’ll want to upgrade to the latest MooTools (it’s pretty painless – no big breaking changes). Looking at the new MooTools More you’ll see a lot of familiar classes – FormValidator, OverText, Class.Binds, etc. Well, while the changes to Core don’t require you to do anything to upgrade, the changes from Clientcide to More aren’t so simple.

Core and More

There aren’t a ton of new features in 1.2.2; mostly bug fixes and whatnot, but I will say that Class.js got an overhaul and has a whole new kind of awesome that most people probably won’t notice. It’s a humble awesomeness, if that’s possible.

And then there’s MooTools More. As I wrote back in the beginning of February, the new MooTools More features a ton of new functionality, much of it from the Clientcide libraries run through the meat grinder of the MooTools dev team making it much cleaner and more consistent than I ever did. This also lead to a lot of changes.

The Clientcide Libs

A lot of things have changed, actually. Here’s the high-level list:

  • MultipleOpenAccordion
    • now only takes options
    • openAll defaults to false
  • CiUI (iPhone code)
  • Browser.Extras
    • methods now either part of URI class or stand alone string methods
    • Browser.qs deprecated entirely; use new URI().getData()
  • Class.Binds
    • mutator is now upper case (Binds instead of binds)
  • Class.Refactor
    • no longer an instance method (you can’d to Foo.refactor({props}) – you must do Foo = Class.refactor(Foo, props))
  • Element.Forms
    • deprecated Element property inputValue; too confusing!
  • Element.Position
    • Element.setPosition is now Element.position and vice versa. I.e. Element.position (which in MooTools 1.2.1 took an object with x/y coords for top/left) is now Element.setPosition. Element.setPosition (which in the previous Clientcide libs took options for relative positioning) is now Element.position.
  • Element.Shortcuts
    • Element.isVisible is Element.isDisplayed
  • IframeShim
    • options:zindex renamed to zIndex
  • OverText
    • no longer takes a collection of inputs.
    • .showTxt > .show, .hideTxt > .hide
    • .hide and .show no longer take the element and ‘focus’ arguments.
    • .repositionAll is gone; .repositionOverTxt is now just .reposition; it does not take an argument
  • String.Extras
    • findAllEmails gone, too specific
  • Date
    • deprecated String.zeroise
  • JsonP
    • renamed to Request.JSONP
    • constructor/send/prepareUrl take options hash, no longer an url directly (like Request)
    • user can change options on the fly when calling send() with a new hash, reusing the object
    • added check method. support for link: ignore, cancel, chain (like Request)
    • added success, request and cancel events
    • data can be a hash or string now (like Request)
    • queryString option gone
    • makeUrl logic now moved to new getScript(), which directly returns the script
    • changed how it essentially works. instead of storing the object reference, we store a new function every time a request is made, that keeps a reference of the script element and the object instance.
    • abortAfter and timeout gone. there’s now a single timeout for retries and for when retries run out.
    • globalFunction gone, deemed useless
  • Request.Queue
    • event names all renamed; onRequestStart >> onRequest, onRequestSuccess >> onSuccess, etc
  • StickyWin
    • StickyWin.Fx is now just StickyWin.
  • MultipleOpenAccordion
    • Now only takes an options argument; container argument is deprecated.

Don’t Freak Out

The good news is that I’ve authored compatibility for all of these things. In theory you should be able to download the 1.2.2 core, the new More, the latest Clientcide and include the compatibility scripts and go about your business. At some point you’re going to want to refactor things with the changes above in mind so that you can remove the compat files of course, but in theory you should be ok (and if not, file a bug).

There’s three changes that I can’t really write a compatibility file for

  • FormValidator
    • The base FormValidator class no longer injects advice into the document. You must use FormValidator.Inline for this behavior.
  • Class.refactor
    • this.parent is no longer useful; you must use this.previous
  • String.cleanQueryString
    • if you specify a custom message its arguments are now key, value (before it was set where set was “key=value”).

FormValidator now has been split into FormValidator and FormValidator.Inline. FormValidator just validates forms but doesn’t really do anything; it just fires events when inputs and forms are validated. FormValidator.Inline is what the Clientcide FormValidator used to be with the advice injected into the document after each input. So if you’re using FormValidator, you’ll need to do a quick search and replace for “new FormValidator” and replace it with “new FormValidator.Inline” and you should be fine.

Class.refactor no longer has access to this.parent, only this.previous. You’ll need to find these references and change them.

String.cleanQueryString, which accepts an optional function, now passes different arguments to that function.

Hopefully these 3 changes won’t represent a huge burden for you.

Clientcide Organizational Changes

I’m moving the libs here over to github. This should make it easier for others to get involved and fix bugs and now that MooTools is on git I want to consolidate my workflow. This means that, as of today, the google code svn is basically no longer in use. I’ll be updating it shortly to reflect this.

I’m also moving the ticketing for Clientcide. I was going to move it to lighthouse but now I’m thinking I’ll use the new issues system that’s on github. It’s not very robust, but it should do for my purposes. I’ll leave the open tickets that are on google there for now and close them out as I can.

Feedback on all this stuff is, as always, greatly appreciated.

More!

March 9th, 2009 by Aaron N.

I just posted a long writeup on today’s launch of the new MooTools More – the beta (RC1) is up and ready for you to dive into. What are you waiting for? GET TO IT!