var vcGridStyleLoadMore=null;(function($){vcGridStyleLoadMore=function(grid){this.grid=grid;this.settings=grid.settings;this.$loadMoreBtn=false;this.$el=false;this.filterValue=null;this.$content=false;this.isLoading=false;this.$loader=$('
');this.init();};vcGridStyleLoadMore.prototype.setIsLoading=function(){this.$loadMoreBtn&&this.$loadMoreBtn.hide();this.isLoading=true;};vcGridStyleLoadMore.prototype.unsetIsLoading=function(){this.isLoading=false;this.setLoadMoreBtn();};vcGridStyleLoadMore.prototype.init=function(){_.bindAll(this,'addItems');};vcGridStyleLoadMore.prototype.render=function(){this.$el=this.grid.$el;this.$content=this.$el;this.setIsLoading();this.$content.append(this.$loader);this.grid.ajax({},this.addItems);};vcGridStyleLoadMore.prototype.showItems=function(){var $els=this.$content.find('.vc_grid_filter-item:not(.vc_visible-item):lt('+ this.settings.items_per_page+')');this.setIsLoading();$els.addClass('vc_visible-item '+ vcGridSettings.addItemsAnimation+' animated');this.unsetIsLoading();jQuery(window).trigger('grid:items:added',this.$el);};vcGridStyleLoadMore.prototype.filter=function(filter){filter=_.isUndefined(filter)||'*'===filter?'':filter;if(this.filterValue==filter){return false;} this.$content.find('.vc_visible-item, .vc_grid_filter-item').removeClass('vc_visible-item vc_grid_filter-item ' +('none'!==vcGridSettings.addItemsAnimation?vcGridSettings.addItemsAnimation+' animated':''));this.filterValue=filter;this.$content.find('.vc_grid-item'+ this.filterValue).addClass('vc_grid_filter-item');this.showItems();};vcGridStyleLoadMore.prototype.addItems=function(html){var els=$(html);this.$el.append(els);this.unsetIsLoading();this.$content=els.find('[data-vc-grid-content="true"]');this.$loadMoreBtn=els.find('[data-vc-grid-load-more-btn="true"] .vc_btn');var self=this;this.$loadMoreBtn.click(function(e){e.preventDefault();self.showItems();});this.$loadMoreBtn.hide();this.grid.initFilter();this.filter();this.$loader.remove();window.vc_prettyPhoto();};vcGridStyleLoadMore.prototype.setLoadMoreBtn=function(){if(!$('.vc_grid_filter-item:not(".vc_visible-item")',this.$content).length||!$('.vc_grid_filter-item',this.$content).length){this.$loadMoreBtn&&this.$loadMoreBtn.hide();}else{this.$loadMoreBtn&&this.$loadMoreBtn.show();}};})(window.jQuery);