PageSourceSearch

https://ibirapuera.org/wp-content/themes/soledad/js/archive-more-post.js?ver=8.7.2

js ibirapuera.org collected 2026-10-02 18:09:11 UTC 6,391 bytes, 215 lines download raw bytes

1/* global ajax_var_more */
2jQuery( function ( $ ) {
3	'use strict'
4
5	function buttonClick() {
6		$( 'body' ).on( 'click', '.penci-ajax-arch .penci-ajax-more-button', function ( event ) {
7			event.preventDefault()
8			loadMorePostRun( $( this ) )
9		} )
10	}
11
12	function infiniteScroll() {
13		var $handle = $( '.penci-ajax-arch' ),
14			$button_load = $handle.find( '.penci-ajax-more-button' )
15
16		if ( $handle.hasClass( 'penci-infinite-scroll' ) ) {
17			$( window ).on( 'scroll', function () {
18
19				var hT = $button_load.offset().top,
20					hH = $button_load.outerHeight(),
21					wH = $( window ).height(),
22					wS = $( this ).scrollTop()
23
24				if ( (
25					     wS > (
26						        hT + hH - wH
27					        )
28				     ) && $button_load.length ) {
29					loadMorePostRun( $button_load )
30				}
31			} ).trigger( 'scroll' )
32		}
33	}
34
35	function loadMorePostRun( $button_load ) {
36		if ( $button_load.hasClass( 'loading-posts' ) ) {
37			return false
38		}
39
40		var layout = $button_load.data( 'layout' ),
41			ppp = $button_load.data( 'number' ),
42			mes = $button_load.data( 'mes' ),
43			offset = $button_load.attr( 'data-offset' ),
44			exclude = $button_load.data( 'exclude' ),
45			from = $button_load.data( 'from' ),
46			template = $button_load.data( 'template' ),
47			archiveType = $button_load.data( 'archivetype' ),
48			archiveValue = $button_load.data( 'archivevalue' ),
49			archiveOrder = $button_load.data( 'order' )
50
51		$button_load.addClass( 'loading-posts' )
52
53		var dataAjax = 'order=' + archiveOrder + '&offset=' + offset + '&layout=' + layout + '&from=' + from +
54		               '&template=' + template + '&ppp=' + ppp +
55		               '&archivetype=' + archiveType + '&archivevalue=' + archiveValue +
56		               '&action=penci_archive_more_post_ajax&nonce=' + pcajaxamore_scroll.nonce
57
58		$.ajax( {
59			type: 'POST',
60			dataType: 'html',
61			url: ajax_var_more.archive_more_url,
62			data: dataAjax,
63			success: function ( data ) {
64
65				if ( !data ) {
66					$button_load.find( '.ajax-more-text' ).text( mes )
67					$button_load.find( 'i' ).remove()
68					$button_load.removeClass( 'loading-posts' )
69					setTimeout( function () {
70						$button_load.parent().remove()
71					}, 1200 )
72
73					return false
74				}
75
76				var data_offset = parseInt( offset ) + ppp,
77					$wrap_content = $button_load.parent().parent().find( '.penci-wrapper-data' ),
78					$data
79
80					try {
81						// Try parsing the data
82						$data = JSON.parse(data);
83					} catch (e) {
84						// If parsing fails, assume data is a jQuery selector or HTML string
85						$data = $(data);
86					}
87
88				$button_load.attr( 'data-offset', data_offset )
89
90				if ( layout === 'masonry' || layout === 'masonry-2' ) {
91					
92
93					$wrap_content.append( $data ).isotope( 'appended', $data ).imagesLoaded( function () {
94						$wrap_content.isotope( 'layout' )
95					} )
96
97					$( '.container' ).fitVids()
98
99					if ( $().easyPieChart ) {
100						$( '.penci-piechart' ).each( function () {
101							var $this = $( this )
102							$this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) {
103								var chart_args = {
104									barColor: $this.data( 'color' ),
105									trackColor: $this.data( 'trackcolor' ),
106									scaleColor: false,
107									lineWidth: $this.data( 'thickness' ),
108									size: $this.data( 'size' ),
109									animate: 1000,
110								}
111								$this.easyPieChart( chart_args )
112							} ) // bind inview
113						} ) // each
114					}
115
116				} else {
117
118					$wrap_content.append( $data )
119
120					$( '.container' ).fitVids()
121
122					$( 'body' ).trigger( 'penci_swiper_sliders' )
123
124					if ( $().easyPieChart ) {
125						$( '.penci-piechart' ).each( function () {
126							var $this = $( this )
127							$this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) {
128								var chart_args = {
129									barColor: $this.data( 'color' ),
130									trackColor: $this.data( 'trackcolor' ),
131									scaleColor: false,
132									lineWidth: $this.data( 'thickness' ),
133									size: $this.data( 'size' ),
134									animate: 1000,
135								}
136								$this.easyPieChart( chart_args )
137							} ) // bind inview
138						} ) // each
139					}
140
141					var $justified_gallery = $( '.penci-post-gallery-container.justified' )
142					var $masonry_gallery = $( '.penci-post-gallery-container.masonry' )
143					if ( $().justifiedGallery && $justified_gallery.length ) {
144						$( '.penci-post-gallery-container.justified' ).each( function () {
145							var $this = $( this )
146							$this.justifiedGallery( {
147								rowHeight: $this.data( 'height' ),
148								lastRow: 'nojustify',
149								margins: $this.data( 'margin' ),
150								randomize: false,
151							} )
152						} ) // each .penci-post-gallery-container
153					}
154
155					if ( $().isotope && $masonry_gallery.length ) {
156
157						$( '.penci-post-gallery-container.masonry .item-gallery-masonry' ).each( function () {
158							var $this = $( this )
159							if ( $this.attr( 'title' ) ) {
160								var $title = $this.attr( 'title' )
161								$this.children().append( '<div class="caption">' + $title + '</div>' )
162							}
163						} )
164					}
165
166					if ( $masonry_gallery.length ) {
167						$masonry_gallery.each( function () {
168							var $this = $( this )
169							$this.imagesLoaded( function () {
170								// initialize isotope
171								$this.isotope( {
172									itemSelector: '.item-gallery-masonry',
173									transitionDuration: '.55s',
174									layoutMode: 'masonry',
175								} )
176
177								$this.addClass( 'loaded' )
178
179								$( '.penci-post-gallery-container.masonry .item-gallery-masonry' ).each( function () {
180									var $this = $( this )
181									$this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) {
182										$this.addClass( 'animated' )
183									} ) // inview
184								} ) // each
185							} )
186						} )
187					}
188
189					if ( $().theiaStickySidebar ) {
190						var top_margin = 90
191						if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
192							top_margin = 122
193						}
194						$( '#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ).the
194iaStickySidebar( {
195							// settings
196							additionalMarginTop: top_margin,
197						} )
198					} // if sticky
199				}
200				$( 'body' ).trigger( 'penci_swiper_sliders' )
201				$button_load.removeClass( 'loading-posts' )
202				$( document ).trigger( 'penci_bf_check' )
203			},
204			error: function ( jqXHR, textStatus, errorThrown ) {
205				console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown )
206			},
207
208		} )
209	}
210
211	$( document ).ready( function () {
212		buttonClick()
213		infiniteScroll()
214	} )
215} )

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.