dist/toolkit.js
function(plugin, callback, collection) {
        var name = plugin;

        // Prefix with toolkit to avoid collisions
        if ($.fn[name]) {
            name = 'toolkit' + name.charAt(0).toUpperCase() + name.slice(1);
        }

        $.fn[name] = collection ?

            // Apply the instance to a collection of elements
            function() {
                var instance = Toolkit.cache[plugin + ':' + this.selector] = callback.apply(this, arguments);

                return this.each(function() {
                    $(this).cache('toolkit.' + plugin, instance);
                });
            } :

            // Apply the instance per element
            function() {
                var args = arguments;

                return this.each(function() {
                    $(this).cache('toolkit.' + plugin, callback.apply(this, args));
                });
            };
    }
function(plugin, callback, collection) {
        var name = plugin;

        // Prefix with toolkit to avoid collisions
        if ($.fn[name]) {
            name = 'toolkit' + name.charAt(0).toUpperCase() + name.slice(1);
        }

        $.fn[name] = collection ?

            // Apply the instance to a collection of elements
            function() {
                var instance = Toolkit.cache[plugin + ':' + this.selector] = callback.apply(this, arguments);

                return this.each(function() {
                    $(this).cache('toolkit.' + plugin, instance);
                });
            } :

            // Apply the instance per element
            function() {
                var args = arguments;

                return this.each(function() {
                    $(this).cache('toolkit.' + plugin, callback.apply(this, args));
                });
            };
    }
function ( plugin , callback , collection ) { var name = plugin ; // Prefix with toolkit to avoid collisions if ( $ . fn [ name ] ) { name = 'toolkit' + name . charAt ( 0 ) . toUpperCase ( ) + name . slice ( 1 ) ; } $ . fn [ name ] = collection ? // Apply the instance to a collection of elements function ( ) { var instance = Toolkit . cache [ plugin + ':' + this . selector ] = callback . apply ( this , arguments ) ; return this . each ( function ( ) { $ ( this ) . cache ( 'toolkit.' + plugin , instance ) ; } ) ; } : // Apply the instance per element function ( ) { var args = arguments ; return this . each ( function ( ) { $ ( this ) . cache ( 'toolkit.' + plugin , callback . apply ( this , args ) ) ; } ) ; } ; }
Creates a jQuery plugin by extending the jQuery prototype with a method definition.
The Toolkit plugin is only initialized if one has not been already.
Plugins are either defined per element, or on a collection of elements.

@param {String} plugin
@param {Function} callback
@param {bool} [collection]
Creates a jQuery plugin by extending the jQuery prototype with a method definition . The Toolkit plugin is only initialized if one has not been already . Plugins are either defined per element or on a collection of elements .