$.fn[pluginname] = function()

in themes/kube/static/js/kube.js [107:145]


            $.fn[pluginname] = function(method, options)
            {
                var args = Array.prototype.slice.call(arguments, 1);
                var name = 'fn.' + pluginname;
                var val = [];

                this.each(function()
                {
                    var $this = $(this), data = $this.data(name);
                    options = (typeof method === 'object') ? method : options;

                    if (!data)
                    {
                        // Initialization
                        $this.data(name, {});
                        $this.data(name, (data = new Kube[classname](this, options)));
                    }

                    // Call methods
                    if (typeof method === 'string')
                    {
                        if ($.isFunction(data[method]))
                        {
                            var methodVal = data[method].apply(data, args);
                            if (methodVal !== undefined)
                            {
                                val.push(methodVal);
                            }
                        }
                        else
                        {
                            $.error('No such method "' + method + '" for ' + classname);
                        }
                    }

                });

                return (val.length === 0 || val.length === 1) ? ((val.length === 0) ? this : val[0]) : val;
            };