PageSourceSearch

https://decorfusta.com/wp-content/plugins/js_composer4.6.1/assets/…c_grid_style_load_more_masonry.js?ver=4.6.1

js decorfusta.com collected 2026-10-06 09:41:18 UTC 3,188 bytes, 95 lines download raw bytes

1/* =========================================================
2 * vc_grid_style_lazy_masonry.js v1.0
3 * =========================================================
4 * Copyright 2014 Wpbakery
5 *
6 * Basic Grid Style show all
7 * ========================================================= */
8var vcGridStyleLoadMoreMasonry;
9(function ( $ ) {
10	// vcGridStyleAllMasonry = vcGridStyleAll.bind(); // IE 8 not supported
11	vcGridStyleLoadMoreMasonry = function ( grid ) {
12		this.grid = grid;
13		this.settings = grid.settings;
14		this.$loadMoreBtn = false;
15		this.$el = false;
16		this.filterValue = null;
17		this.$content = false;
18		this.isLoading = false;
19		this.filtered = false;
20		this.$loader = $( '<div class="vc_grid-loading"></div>' );
21		this.masonryEnabled = false;
22		_.bindAll( this, 'setMasonry' );
23		this.init();
24	};
25	vcGridStyleLoadMoreMasonry.prototype = _.extend( {}, vcGridStyleLoadMore.prototype, {
26		showItems: function () {
27			if ( this.isLoading === true ) {
28				return false;
29			}
30			this.setIsLoading();
31			var $els = this.$content.find( '.vc_grid_filter-item:not(.vc_visible-item):lt(' + this.settings.items_per_page + ')' );
32			var self = this;
33			$els.imagesLoaded( function () {
34				$els.addClass( 'vc_visible-item' );
35				self.setItems( $els );
36				if ( self.filtered ) {
37					self.filtered = false;
38					self.setMasonry();
39					window.vc_prettyPhoto();
40				}
41				self.unsetIsLoading();
42				jQuery(window).trigger( 'grid:items:added', self.$el );
43			} );
44		},
45		filter: function ( filter ) {
46			filter = _.isUndefined( filter ) || filter === '*' ? '' : filter;
47			if ( this.filterValue == filter ) {
48				return false; // already filtred
49			}
50			this.$content.data( 'masonry' ) && this.$content.masonry( 'destroy' );
51			this.masonryEnabled = false;
52			this.$content.find( '.vc_visible-item, .vc_grid_filter-item' ).removeClass( 'vc_visible-item vc_grid_filter-item '
53			+ ( vcGridSettings.addItemsAnimation != 'none' ? vcGridSettings.addItemsAnimation + ' animated' : '') );
54			this.filterValue = filter;
55			this.$content
56				.find( '.vc_grid-item' + this.filterValue )
57				.addClass( 'vc_grid_filter-item' );
58			this.filtered = true;
59			$( window ).resize( this.setMasonry );
60			this.setMasonry();
61			this.showItems();
62		},
63		setIsLoading: function () {
64			this.$el.append( this.$loader );
65			this.$loadMoreBtn && this.$loadMoreBtn.hide();
66			this.isLoading = true;
67		},
68		unsetIsLoading: function () {
69			this.isLoading = false;
70			this.$loader && this.$loader.remove();
71			this.setLoadMoreBtn();
72		},
73		setItems: function ( els ) {
74			if ( this.masonryEnabled ) {
75				this.$content.masonry( 'appended', els );
76			} else {
77				this.setMasonry();
78			}
79		},
80		setMasonry: function () {
81			var windowWidth = window.innerWidth;
82			if ( windowWidth < vcGridSettings.mobileWindowWidth ) {
83				this.$content.data( 'masonry' ) && this.$content.masonry( 'destroy' );
84				this.masonryEnabled = false;
85			} else if ( this.masonryEnabled ) {
86				this.$content.masonry( 'reloadItems' );
87				this.$content.masonry( 'layout' );
88			} else {
89				this.$content.masonry( { itemSelector: ".vc_visible-item", isResizeBound: false } );
90				this.masonryEnabled = true;
91			}
92		}
93	} );
94
95})( window.jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.