PageSourceSearch

https://hp-torwartschule.at/wp-content/themes/campo/bold-page-buil…/bt_bb_css_post_grid.js?ver=7.1.2

js hp-torwartschule.at collected 2026-10-02 11:14:13 UTC 4,850 bytes, 150 lines download raw bytes

1(function( $ ) {
2	"use strict";
3	
4	/*var bt_bb_css_post_grid = 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_css_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_css_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_css_post_grid_load_posts( root, offset );
39							return false;
40						}
41					}
42				});
43			}
44		});
45	}
46
47	var bt_bb_css_post_grid_load_posts = function( root, offset ) {
48		if ( offset == 0 ) {
49			root.addClass( 'bt_bb_grid_hide' );
50			root.find( '.bt_bb_grid_item' ).remove();
51		}
52
53		root.parent().find( '.bt_bb_post_grid_loader' ).show();
54
55		var action = 'bt_bb_get_css_grid';
56
57		var root_data_number = root.data( 'number' );
58
59		var data = {
60			'action': action,
61			'number': root_data_number,
62			'category': root.data( 'category' ),
63			'bt-bb-css-post-grid-nonce': root.data( 'bt-bb-css-post-grid-nonce' ),
64			'post-type': root.data( 'post-type' ),
65			'offset': offset,
66			'show': root.data( 'show' ),
67			'show_superheadline': root.data( 'show-superheadline' ),
68			'show_subheadline': root.data( 'show-subheadline' ),
69			'format': root.data( 'format' ),
70		};
71
72		root.data( 'loading', 'loading' );
73		
74		$.ajax({
75			type: 'POST',
76			url: ajax_object.ajax_url,
77			data: data,
78			async: true,
79			success: function( response ) {
80	
81				if ( response == '' ) {
82					root.data( 'loading', 'no_more' );
83					root.parent().find( '.bt_bb_post_grid_loader' ).hide();
84					return;
85				}
86
87				var $content = $( response );
88				root.append( $content );
89				//bt_bb_css_post_grid( root );
90
91				root.data( 'offset', offset );
92
93				root.parent().find( '.bt_bb_post_grid_loader' ).hide();
94				root.removeClass( 'bt_bb_grid_hide' );
95				$( '.bt_bb_grid_container' ).css( 'height', 'auto' );
96
97				bt_bb_css_post_grid_load_images( root );
98
99				if ( root.data( 'auto-loading' ) == 'auto_loading' ) {
100					root.data( 'loading', '' );
101				} else {
102					root.data( 'loading', 'no_more' );
103				}
104
105			},
106			error: function( response ) {
107				root.parent().find( '.bt_bb_post_grid_loader' ).hide();
108				root.removeClass( 'bt_bb_grid_hide' );			
109			}
110		});
111	}
112
113	$( document ).ready(function() {
114		
115		var grid_length = $( '.bt_bb_css_post_grid_content' ).length;
116		var i = 1;
117		$( '.bt_bb_css_post_grid_content' ).each(function() {
118			if ( i < grid_length ) {
119				$( this ).attr( 'data-auto-loading', '' );
120			}
121			i++;
122		});
123
124		$( window ).on( 'resize', function() {
125			//bt_bb_css_post_grid( $( '.bt_bb_css_post_grid_content' ) );
126		});
127
128		$( window ).on( 'scroll', function() {
129			
130			bt_bb_css_post_grid_load_images( $( '.bt_bb_css_post_grid_content' ) );
131			bt_bb_css_post_grid_load_items( $( '.bt_bb_css_post_grid_content' ) );
132		});
133
134		$( '.bt_bb_css_post_grid_content' ).each(function() {
135			var grid_content = $( this );
136			bt_bb_css_post_grid_load_posts( grid_content, 0 );
137		});
138
139		$( '.bt_bb_css_post_grid_filter_item' ).on( 'click', function() {
140			var root = $( this ).closest( '.bt_bb_grid_container' );
141			root.height( root.height() );
142			$( this ).parent().find( '.bt_bb_css_post_grid_filter_item' ).removeClass( 'active' ); 
143			$( this ).addClass( 'active' );
144			var grid_content = $( this ).closest( '.bt_bb_css_post_grid' ).find( '.bt_bb_css_post_grid_content' );
145			grid_content.data( 'category', $( this ).data( 'category' ) );
146			bt_bb_css_post_grid_load_posts( grid_content, 0 );
147		});
148
149	});
150})( 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.