/** * jQuery.Collection - Extensible and inheritable jQuery-like collections * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php). * Date: 1/28/2008 * @author Ariel Flesler * @version 1.0.3 */ ;(function($){var f=function(){},g='constructor',u='_'+g,d='prototype',z=function(c){f[d]=(c[u]||c)[d];return new f()},w=function(a,b){return a.init.apply(z(a),b)},k=function(){return(function(a){var h=arguments.callee,obj=this instanceof h?this:z(h);if(a&&a[u]===h)return obj.setArray(a.get());return obj.init.apply(obj,arguments)})};var g=$.collection=k();$.extend(g,{extend:$.extend,fn:g[d],statics:'extend,build,include,implement',build:function(){var a=k();this.include(a,this,g.statics);a[d]=a.fn=z(this);a[u]=a.fn[u]=a;return a},include:function(b,c,d,e){if(!d||!d.slice){[].unshift.call(arguments,this);return this.include.apply(this,arguments)}$.each(d.split?d.split(/\s?,\s?/):d,function(i,a){b[a]=e?e(c[a],a,c):c[a]});return b},implement:function(c,d){this.fn.include(c,d,function(b){return function(){var a=arguments;return this.map(function(){return b.apply(this,a)})}})}});g.extend(g.fn,{extend:g.extend,include:g.include,init:function(a){var b=typeof a=='object'&&'length'in a?a:arguments;return this.setArray(b)},filter:function(a){if(typeof a!='function'){var b=a[g]==Array?a:[a];a=function(){return $.inArray(this,b)!=-1}}return this.pushStack($.grep(this,function(e,i){return a.call(e,i)}))},not:function(a){a=this.filter(a);return this.filter(function(){return $.inArray(this,a)==-1})},is:function(s){return!!(s&&this.filter(s).length)},add:function(){return this.pushStack($.merge(this.get(),w(this,arguments)))},pushStack:function(a){var b=z(this).setArray(a.get?a.get():a);b.prevObject=this;return b},end:function(){return this.prevObject||w(this)},attr:function(a,b){return b===undefined?this[0]!=null&&this[0][a]:this.each(function(){this[a]=b})}});g.fn.include($.fn,'each,extend,index,setArray,get,size,eq,slice,map,andSelf')})(jQuery);