PageSourceSearch

https://novargonaftes.gr/wp-content/plugins/bold-page-builder/cont…/bt_bb_post_grid.js?ver=4.4.8

js novargonaftes.gr collected 2026-09-24 12:15:55 UTC 5,276 bytes, 170 lines download raw bytes

1(function( $ ) {
2	"use strict";
3	
4	var bt_bb_post_grid_resize = function( root ) {
5		root.each(function() {
6			$( this ).find( '.bt_bb_grid_item' ).each(function() {
7				$( this ).find( '.bt_bb_grid_item_post_thumbnail' ).height( Math.floor( $( this ).width() * $( this ).data( 'hw' ) ) );
8			});
9		});
10	}
11
12	var bt_bb_post_grid_load_images = function( root ) {
13		root.each(function() {
14			var page_bottom = $( window ).scrollTop() + $( window ).height();
15			$( this ).find( '.bt_bb_grid_item' ).each(function() {
16				var this_top = $( this ).offset().top;
17				if ( this_top < page_bottom + $( window ).height() ) {
18					var img_src = $( this ).data( 'src' );
19					if ( img_src !== '' && $( this ).find( '.bt_bb_grid_item_post_thumbnail a' ).html() == '' ) {
20						$( this ).find( '.bt_bb_grid_item_post_thumbnail a' ).html( '<img src="' + img_src + '" alt="' + $( this ).data( 'alt' ) + '">' );
21					}
22				}
23			});
24		});
25	}
26
27	var bt_bb_post_grid_load_items = function( root ) {
28		root.each(function() {
29			var loading = root.data( 'loading' );
30			if ( loading === undefined || ( loading != 'loading' && loading != 'no_more' ) ) {
31				var page_bottom = $( window ).scrollTop() + $( window ).height();
32				$( this ).find( '.bt_bb_grid_item' ).each(function() {
33					var this_top = $( this ).offset().top;
34					if ( this_top < page_bottom + $( window ).height() ) {
35						if ( $( this ).is( ':last-child' ) ) {
36							var root_data_offset = root.data( 'offset' );
37							var offset = parseInt( root_data_offset === undefined ? 0 : root_data_offset ) + parseInt( root.data( 'number' ) );
38							bt_bb_post_grid_load_posts( root, offset );
39							return false;
40						}
41					}
42				});
43			}
44		});
45	}
46
47	var bt_bb_post_grid_load_posts = function( root, offset ) {
48
49		if ( offset == 0 ) {
50			root.addClass( 'bt_bb_grid_hide' );
51			root.find( '.bt_bb_grid_item' ).remove();
52			if ( root.hasClass( 'masonry' ) ) {
53				root.masonry( 'destroy' );
54			}
55		}
56
57		root.parent().find( '.bt_bb_post_grid_loader' ).show();
58
59		var action = 'bt_bb_get_grid';
60
61		var root_data_number = root.data( 'number' );
62
63		var data = {
64			'action': action,
65			'number': root_data_number,
66			'category': root.data( 'category' ),
67			'show': root.data( 'show' ),
68			'bt-bb-masonry-post-grid-nonce': root.data( 'bt-bb-masonry-post-grid-nonce' ),
69			'post-type': root.data( 'post-type' ),
70			'offset': offset
71		};
72
73		root.data( 'loading', 'loading' );
74
75		$.ajax({
76			type: 'POST',
77			url: ajax_object.ajax_url,
78			data: data,
79			async: true,
80			success: function( response ) {
81
82				if ( response == '' ) {
83					root.data( 'loading', 'no_more' );
84					root.parent().find( '.bt_bb_post_grid_loader' ).hide();
85					return;
86				}
87
88				var $content = $( response );
89				root.append( $content );
90				bt_bb_post_grid_resize( root );
91
92				root.data( 'offset', offset );
93
94				if ( offset > 0 ) {
95					root.masonry( 'appended', $content );
96				} else {
97					if ( $( 'html' ).attr( 'dir' ) == 'rtl' ) {
98						root.masonry({
99							columnWidth: '.bt_bb_grid_sizer',
100							itemSelector: '.bt_bb_grid_item',
101							gutter: 0,
102							percentPosition: true,
103							isRTL: true
104						});	
105					} else {
106						root.masonry({
107							columnWidth: '.bt_bb_grid_sizer',
108							itemSelector: '.bt_bb_grid_item',
109							gutter: 0,
110							percentPosition: true
111						});
112					}
113				}
114				root.parent().find( '.bt_bb_post_grid_loader' ).hide();
115				root.removeClass( 'bt_bb_grid_hide' );
116				$( '.bt_bb_grid_container' ).css( 'height', 'auto' );
117
118				bt_bb_post_grid_load_images( root );
119
120				if ( root.data( 'auto-loading' ) == 'auto_loading' ) {
121					root.data( 'loading', '' );
122				} else {
123					root.data( 'loading', 'no_more' );
124				}
125
126			},
127			error: function( response ) {
128				root.parent().find( '.bt_bb_post_grid_loader' ).hide();
129				root.removeClass( 'bt_bb_grid_hide' );			
130			}
131		});
132	}
133
134	$( document ).ready(function() {
135		
136		var grid_length = $( '.bt_bb_masonry_post_grid_content' ).length;
137		var i = 1;
138		$( '.bt_bb_masonry_post_grid_content' ).each(function() {
139			if ( i < grid_length ) {
140				$( this ).attr( 'data-auto-loading', '' );
141			}
142			i++;
143		});
144
145		$( window ).on( 'resize', function() {
146			bt_bb_post_grid_resize( $( '.bt_bb_masonry_post_grid_content' ) );
147		});
148
149		$( window ).on( 'scroll', function() {
150			bt_bb_post_grid_load_images( $( '.bt_bb_masonry_post_grid_content' ) );
151			bt_bb_post_grid_load_items( $( '.bt_bb_masonry_post_grid_content' ) );
152		});
153
154		$( '.bt_bb_masonry_post_grid_content' ).each(function() {
155			var grid_content = $( this );
156			bt_bb_post_grid_load_posts( grid_content, 0 );
157		});
158
159		$( '.bt_bb_post_grid_filter_item' ).on( 'click', function() {
160			var root = $( this ).closest( '.bt_bb_grid_container' );
161			root.height( root.height() );
162			$( this ).parent().find( '.bt_bb_post_grid_filter_item' ).removeClass( 'active' ); 
163			$( this ).addClass( 'active' );
164			var grid_content = $( this ).closest( '.bt_bb_masonry_post_grid' ).find( '.bt_bb_masonry_post_grid_content' );
165			grid_content.data( 'category', $( this ).data( 'category' ) );
166			bt_bb_post_grid_load_posts( grid_content, 0 );
167		});
168
169	});
170})( 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.