(function(jQuery,window,undefined){var $event=jQuery.event,$special,resizeTimeout;$special=$event.special.debouncedresize={setup:function(){jQuery(this).on("resize",$special.handler);},teardown:function(){jQuery(this).off("resize",$special.handler);},handler:function(event,execAsap){var context=this,args=arguments,dispatch=function(){event.type="debouncedresize";$event.dispatch.apply(context,args);};if(resizeTimeout){clearTimeout(resizeTimeout);}execAsap?dispatch():resizeTimeout=setTimeout(dispatch,$special.threshold);},threshold:100};Array.prototype.shuffle=function(){var i=this.length,p,t;while(i--){p=Math.floor(Math.random()*i);t=this[i];this[i]=this[p];this[p]=t;}return this;};function getHiddenProp(){var prefixes=["webkit","moz","ms","o"];if("hidden" in document){return"hidden";}for(var i=0;i").load(function(){++loaded;$img.parent().css("background-image","url("+src+")");if(loaded===count){$imgs.remove();self.$el.removeClass("ri-grid-loading");self.$items=self.$list.children("li");self.$itemsCache=self.$items.clone();self.itemsTotal=self.$items.length;self.outItems=[];self._layout(function(){self._initEvents();});self._start();}}).attr("src",src);});},_layout:function(callback){var self=this;this._setGridDim();this.$list.empty();this.$items=this.$itemsCache.clone().appendTo(this.$list);var $outItems=this.$items.filter(":gt("+(this.showTotal-1)+")"),$outAItems=$outItems.children("span");this.outItems.length=0;$outAItems.each(function(i){self.outItems.push(jQuery(this));});$outItems.remove();var containerWidth=(document.defaultView)?parseInt(document.defaultView.getComputedStyle(this.$el.get(0),null).width):this.$el.width(),itemWidth=Math.floor(containerWidth/this.columns),gapWidth=containerWidth-(this.columns*Math.floor(itemWidth));for(var i=0;iself.showTotal){max=self.showTotal;}var nmbOut=step==="random"?Math.floor(Math.random()*max+min):Math.min(Math.abs(step),max),randArr=self._getRandom(nmbOut,self.showTotal);for(var i=0;i