PageSourceSearch

https://astrodaiva.com/wp-content/themes/scape/library/js/module-grid-general.js?ver=1.5.8

js astrodaiva.com collected 2026-10-01 15:02:19 UTC 8,480 bytes, 208 lines download raw bytes

1(function() {
2	"use strict";
3	window.SCAPE = window.SCAPE || {};
4	var $ = jQuery.noConflict();
5
6	SCAPE.gridGeneral = {
7
8		init: function($container, type, postType) {
9			$($container).each(function(){
10				$container = $(this);
11				SCAPE.gridGeneral.setup($container, type, postType);
12				SCAPE.gridGeneral.lazyScroll($container, type, postType);
13
14				$(window).scroll(function() {
15					SCAPE.gridGeneral.lazyScroll($container, type, postType);
16				});
17
18				$container.find('.wtbx-element-reveal:not(.wtbx-element-visible)').each(function(index) {
19					var $that = $(this).closest('.wtbx-grid-entry');
20					setTimeout(function() {
21						SCAPE.revealNoImage($that);
22					}, index * 100);
23				});
24
25			});
26		},
27
28		getOptions: function($container, type, postType) {
29			var objName = 'wtbx_' + type + '_';
30			return window[objName + $container.data('id')];
31		},
32
33		setup: function($container, type, postType) {
34			$container.each(function(){
35				SCAPE.filterGrid.filter($container);
36
37				$(this).siblings('.wtbx-loadmore-container').find('.wtbx-loadmore').on(SCAPE.click, function() {
38					if ( SCAPE.gridGeneral.loadBusy === false ) {
39						SCAPE.gridGeneral.loadPosts($container, type, postType);
40						var $button = $(this),
41							$loader = $button.find('.wtbx-loadmore-loader');
42						$loader.css({
43							height	: $button.height(),
44							width	: $button.height()
45						});
46						setTimeout(function() {
47							$button.addClass('wtbx-loadmore-loading');
48						});
49						setTimeout(function() {
50							SCAPE.transitionEvent() && $loader.one(SCAPE.transitionEvent(), function(e) {
51								$loader.addClass('loading-animate');
52							});
53						}, 600);
54					}
55				});
56			});
57		},
58
59		loadBusy: false,
60
61		limit: function($container, type, postType) {
62			var limit		= parseInt($container.data('limit')),
63				allowLoad	= true;
64			if ( limit > 0 && limit >= SCAPE.gridGeneral.getOptions($container, type, postType).current_page ) {
65				allowLoad = false;
66			}
67			return allowLoad;
68		},
69
70		loadPosts: function($container, type, postType) {
71			SCAPE.gridGeneral.loadBusy = true;
72			var data = {};
73
74			if ( postType === 'blog' ) {
75				data = {
76					'action'			: 'loadmore_blog_' + type,
77					'wpnonce'			: SCAPE.gridGeneral.getOptions($container, type, postType).wpnonce,
78					'query'				: SCAPE.gridGeneral.getOptions($container, type, postType).query,
79					'page'				: SCAPE.gridGeneral.getOptions($container, type, postType).current_page,
80					'excerpt'			: SCAPE.gridGeneral.getOptions($container, type, postType).excerpt,
81					'meta_array'		: SCAPE.gridGeneral.getOptions($container, type, postType).meta_array,
82					'meta_class'		: SCAPE.gridGeneral.getOptions($container, type, postType).meta_class,
83					'columns'			: SCAPE.gridGeneral.getOptions($container, type, postType).columns_minimal,
84					'animation'			: SCAPE.gridGeneral.getOptions($container, type, postType).animation,
85					'preview'			: SCAPE.gridGeneral.getOptions($container, type, postType).preview
86				};
87			} else if ( postType === 'portfolio' ) {
88				data = {
89					'action'			: 'loadmore_portfolio_' + type,
90					'wpnonce'			: SCAPE.gridGeneral.getOptions($container, type, postType).wpnonce,
91					'query'				: SCAPE.gridGeneral.getOptions($container, type, postType).query,
92					'page'				: SCAPE.gridGeneral.getOptions($container, type, postType).current_page,
93					'aspect_ratio'		: SCAPE.gridGeneral.getOptions($container, type, postType).aspect_ratio,
94					'animation'			: SCAPE.gridGeneral.getOptions($container, type, postType).animation,
95					'meta_primary'		: SCAPE.gridGeneral.getOptions($container, type, postType).meta_primary,
96					'meta_secondary'	: SCAPE.gridGeneral.getOptions($container, type, postType).meta_secondary,
97					'excerpt_length'	: SCAPE.gridGeneral.getOptions($container, type, postType).excerpt_length,
98					'loadmore'          : SCAPE.gridGeneral.getOptions($container, type, postType).loadmore
99				};
100			}
101
102			$.ajax({
103				url		: SCAPE.gridGeneral.getOptions($container, type, postType).ajaxurl,
104				data	: data,
105				type	: 'POST',
106				success	: function(data) {
107					if ( data ) {
108						var $loadmore = $container.siblings('.wtbx-loadmore-container');
109						$loadmore.removeClass('loadmore-visible');
110
111						// Process and insert new posts
112						setTimeout(function() {
113							$loadmore.find('.wtbx-loadmore').removeClass('wtbx-loadmore-loading');
114							$loadmore.find('.wtbx-loadmore-loader').removeClass('loading-animate');
115							$loadmore.find('.wtbx-loadmore-loader').css({
116								height	: $loadmore.find('.wtbx-loadmore').outerHeight(),
117								width	: $loadmore.find('.wtbx-loadmore').outerWidth()
118							});
119
120							data = $.trim(data);
121							data = $.parseHTML(data);
122							$container.append(data);
123							SCAPE.prettyLike();
124
125							$container.find('.wtbx-element-reveal:not(.wtbx-element-visible)').each(function(index) {
126								var $that = $(this).closest('.wtbx-grid-entry');
127								setTimeout(function() {
128									SCAPE.revealNoImage($that);
129								}, index * 100);
130							});
131
132							SCAPE.filterGrid.filter($container);
133							SCAPE.filterGrid.filterHideShow($container);
134							SCAPE.filterGrid.filterKnob($container.closest('.filter-slider').find('.wtbx-filter'), $container.closest('.filter-slider').find('.wtbx-filter-button').filter('.active'));
135
136							SCAPE.mediaplayer($container.find('.wtbx_video_player_embed, .wtbx-media-selfhosted video, .wtbx-media-selfhosted audio'));
137							SCAPE.waypoints($container.find('.wtbx-element-reveal:not(.wtbx-element-visible)'));
138							SCAPE.gridGeneral.getOptions($container, type, postType).current_page++;
139
140							var allLoadedTimer = setInterval(function() {
141								if ( !$container.find('.wtbx-element-reveal:not(.wtbx-element-visible)').length ) {
142									SCAPE.gridGeneral.loadBusy = false;
143									SCAPE.gridGeneral.lazyScroll($container, type, postType);
144									clearInterval(allLoadedTimer);
145								}
146							}, 200);
147
148						}, 300);
149					}
150				}
151			});
152		},
153
154		lazyScroll: function($container, type, postType) {
155			if ( SCAPE.gridGeneral.getOptions($container, type, postType) ) {
156				if ( SCAPE.gridGeneral.getOptions($container, type, postType).loadmore !== '' ) {
157					if ( SCAPE.gridGeneral.getOptions($container, type, postType).max_pages > SCAPE.gridGeneral.getOptions($container, type, postType).current_page && SCAPE.gridGeneral.limit($container, type, postType) ) {
158						if ( SCAPE.gridGeneral.loadBusy === false ) {
159							var pages		= SCAPE.gridGeneral.getOptions($container, type, postType).current_page,
160								loadmore	= SCAPE.gridGeneral.getOptions($container, type, postType).loadmore;
161
162							if ( pages % loadmore === 0 ) {
163								$container.parent().children('.wtbx-loadmore-container').addClass('loadmore-visible');
164							} else {
165								$container.parent().children('.wtbx-loadmore-container').removeClass('loadmore-visible');
166
167								var scrollTop		= SCAPE.scrollTop.get,
168									windowH			= SCAPE.viewport().height,
169									containerTop	= $container.offset().top,
170									containerH		= $container.outerHeight();
171
172								if ( scrollTop + windowH > containerTop + containerH ) {
173									SCAPE.gridGeneral.loadPosts($container, type, postType);
174								}
175							}
176						}
177					} else {
178						$container.parent().children('.wtbx-loadmore-container').addClass('loadmore-hidden');
179					}
180				} else {
181					if ( SCAPE.gridGeneral.getOptions($container, type, postType).max_pages > SCAPE.gridGeneral.getOptions($container, type, postType).current_page && SCAPE.gridGeneral.limit($container, type, postType) ) {
182						if (SCAPE.gridGeneral.loadBusy === false) {
183							var scrollTop		= SCAPE.scrollTop.get,
184								windowH			= SCAPE.viewport().height,
185								containerTop	= $container.offset().top,
186								containerH		= $container.outerHeight();
187							if ( scrollTop + windowH > containerTop + containerH ) {
188								SCAPE.gridGeneral.loadPosts($container, type, postType);
189								$container.parent().children('.wtbx-loadmore-container').addClass('loadmore-visible');
190							}
191						}
192					} else {
193						$container.parent().children('.wtbx-loadmore-container').addClass('loadmore-hidden');
194					}
195				}
196			}
197		}
198
199	};
200
201	jQuery(document).ready(function($) {
202		SCAPE.gridGeneral.init($('.wtbx-grid-column'), 'column', 'blog');
203		SCAPE.gridGeneral.init($('.wtbx-grid-magazine'), 'magazine', 'blog');
204		SCAPE.gridGeneral.init($('.blog-grid.wtbx-grid-boxed'), 'boxed', 'blog');
205		SCAPE.gridGeneral.init($('.wtbx-grid-overlap'), 'overlap', 'portfolio');
206	});
207
208})(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.