PageSourceSearch

https://killeverymonster.com/wp-content/themes/podcaster/js/pod-loadmore.js?ver=1

js killeverymonster.com collected 2026-10-04 07:52:43 UTC 5,778 bytes, 191 lines download raw bytes

1"use strict";
2
3jQuery(function($){ // use jQuery code inside this to avoid "$ is not defined" error
4
5	//var $grid = $('.front-page-grid:not(.front-page-fit-grid) .list-of-episodes .row.masonry-container');
6	var $grid = $('.list-of-episodes .row.masonry-container');
7	var isRTL = pod_loadmore_params.originLeft;
8	var epStyle = pod_loadmore_params.fp_ep_style;
9	var originLeft = (isRTL == "1" && epStyle == "front-page-grid") ? false : true;
10
11	var body = $('body');
12	var pSettings = {};
13	
14	if( "front-page-fit-grid" == epStyle ) {
15		$grid = $('.front-page-grid.front-page-fit-grid .list-of-episodes .row.masonry-container');
16	} else if( "front-page-grid" == epStyle ) {
17		$grid = $('.front-page-grid:not(.front-page-fit-grid) .list-of-episodes .row.masonry-container');
18	}
19	
20
21	$grid.imagesLoaded( function() {
22
23		if( "front-page-grid" == epStyle ) {
24			$grid.masonry({
25				itemSelector: '.post',
26				percentPosition: true,
27				columnWidth: '.grid-sizer',
28				gutter: '.gutter-sizer',
29				horizontalOrder: true,
30				originLeft: originLeft,
31				stagger: 30,
32				initLayout: false,
33	        	visibleStyle: { transform: 'translateY(0)', opacity: 1 },
34	        	hiddenStyle: { transform: 'translateY(-50px)', opacity: 0},
35			});
36
37			// bind event listener
38			$grid.on('layoutComplete', function() {
39				$('.front-page-grid #loading_bg').css({
40					"transition-duration": '0.7s',
41					"opacity": "0",
42					"visibility": "hidden"
43				});
44				$grid.css({
45					"transition-duration": '0.7s',
46					"opacity": "1",
47				});
48			});
49			// manually trigger initial layout
50			$grid.masonry();
51		}
52
53
54		
55		$( '.pod_loadmore' ).on( 'click', function() {
56	 		
57			var button = $(this);
58			var data = {
59				'action': 'loadmore',
60				'query': pod_loadmore_params.posts, // that's how we get params from wp_localize_script() function
61				'page' : pod_loadmore_params.current_page
62			};
63	 	
64			$.ajax({ // you can also use $.post here
65				url : pod_loadmore_params.ajaxurl, // AJAX handler
66				data : data,
67				type : 'POST',
68				beforeSend : function ( xhr ) {
69					button.text( pod_loadmore_params.loading_text ); // change the button text, you can also add a preloader image
70				},
71				success : function( data ){
72
73					if( data ) { 
74
75						// Change Text on Button
76						button.text( pod_loadmore_params.load_more_text ); // insert new posts
77						
78	 					// Inside the AJAX success() 
79						var $items = $( data ); // data is the HTML of loaded posts
80						
81						
82
83						if( "front-page-grid" == epStyle ) {
84							// Hide items while they load.
85							$items.css({"opacity": "0"});
86
87							$grid.append( $items ).imagesLoaded(function(){
88								
89								// Apply fitVids() to the new elements.
90								$(".post.format-video").fitVids();
91
92								// Apply mediaelement to the new elements.
93								if (typeof window.wp.mediaelement != "undefined") {
94									$( window.wp.mediaelement.initialize );
95									if( body.hasClass('vertical-audio-vol-active')){
96										pSettings = {
97					                        audioVolume: "vertical"
98					                    }
99					                }
100									$('audio, video').mediaelementplayer(pSettings);
101								}
102
103
104								// Append to Masonry.
105								$grid.masonry( 'appended', $items ).masonry( 'reloadItems' );
106							});
107						} else if( "front-page-fit-grid" == epStyle ) {
108							// Hide items while they load.
109							$items.css({"opacity": "0", "transform" : "translate3d(0,-5%,0)"});
110
111							$grid.append( $items ).imagesLoaded(function(){
112								
113								// Apply fitVids() to the new elements.
114								$(".post.format-video").fitVids();
115
116								// Apply mediaelement to the new elements.
117								if (typeof window.wp.mediaelement != "undefined") {
118									$( window.wp.mediaelement.initialize );
119									
120									if( body.hasClass('vertical-audio-vol-active')){
121										pSettings = {
122					                        audioVolume: "vertical"
123					                    }
124					                }
125									$('audio, video').mediaelementplayer(pSettings);
126								}
127
128								$items.css({
129									"transition-duration": '0.7s',
130									"opacity": "1",
131									"transform" : "translate3d(0,0%,0)"
132								});
133
134							});
135						} else {
136							// Hide items while they load.
137							$items.css({"opacity": "0", "transform" : "translate3d(0,-5%,0)"});
138
139							$grid.append( $items ).imagesLoaded(function(){
140								
141								// Apply fitVids() to the new elements.
142								$(".post.format-video").fitVids();
143
144								// Apply mediaelement to the new elements.
145								if (typeof window.wp.mediaelement != "undefined") {
146									$( window.wp.mediaelement.initialize );
147									
148									if( body.hasClass('vertical-audio-vol-active')){
149										pSettings = {
150					                        audioVolume: "vertical"
151					                    }
152					                }
153									$('audio, video').mediaelementplayer(pSettings);
154								}
155
156								// Fade items in
157								$items.css({
158									"transition-duration": '0.7s',
159									"opacity": "1",
160									"transform" : "translate3d(0,0%,0)"
161								});
162							});
163						}
164
165						// Increase page count
166						pod_loadmore_params.current_page++;
167
168						
169						if ( pod_loadmore_params.current_page == pod_loadmore_params.max_page ) {
170							// Things to be done on the last page come here.
171						}
172
173						// you can also fire the "post-load" event here if you use a plugin that requires it
174						// $( document.body ).trigger( 'post-load' );
175					} else {
176						button.remove(); // if no data, remove the button as well
177						
178						if( pod_loadmore_params.loaded_text ){
179							$( "<p class='loaded-text'>" + pod_loadmore_params.loaded_text + "</p>" ).insertAfter( $grid ).delay(1000).fadeOut( 1000, function(){
180						      $(this).remove();
181						    });
182						}
183						
184					}
185
186				}
187			});
188		});
189	});
190
191});

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.