1/* global SOLEDADLOCALIZE */ 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: SOLEDADLOCALIZE.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 79 $button_load.attr( 'data-offset', data_offset ) 80 81 if ( layout === 'masonry' || layout === 'masonry-2' ) { 82 var $data = $( data ) 83 84 $wrap_content.append( $data ).isotope( 'appended', $data ).imagesLoaded( function () { 85 $wrap_content.isotope( 'layout' ) 86 } ) 87 88 $( '.container' ).fitVids() 89 90 if ( $().easyPieChart ) { 91 $( '.penci-piechart' ).each( function () { 92 var $this = $( this ) 93 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 94 var chart_args = { 95 barColor: $this.data( 'color' ), 96 trackColor: $this.data( 'trackcolor' ), 97 scaleColor: false, 98 lineWidth: $this.data( 'thickness' ), 99 size: $this.data( 'size' ), 100 animate: 1000, 101 } 102 $this.easyPieChart( chart_args ) 103 } ) // bind inview 104 } ) // each 105 } 106 107 } else { 108 var $data = $( data ) 109 $wrap_content.append( $data ) 110 111 $( '.container' ).fitVids() 112 113 $( 'body' ).trigger( 'penci_swiper_sliders' ) 114 115 if ( $().easyPieChart ) { 116 $( '.penci-piechart' ).each( function () { 117 var $this = $( this ) 118 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 119 var chart_args = { 120 barColor: $this.data( 'color' ), 121 trackColor: $this.data( 'trackcolor' ), 122 scaleColor: false, 123 lineWidth: $this.data( 'thickness' ), 124 size: $this.data( 'size' ), 125 animate: 1000, 126 } 127 $this.easyPieChart( chart_args ) 128 } ) // bind inview 129 } ) // each 130 } 131 132 var $justified_gallery = $( '.penci-post-gallery-container.justified' ) 133 var $masonry_gallery = $( '.penci-post-gallery-container.masonry' ) 134 if ( $().justifiedGallery && $justified_gallery.length ) { 135 $( '.penci-post-gallery-container.justified' ).each( function () { 136 var $this = $( this ) 137 $this.justifiedGallery( { 138 rowHeight: $this.data( 'height' ), 139 lastRow: 'nojustify', 140 margins: $this.data( 'margin' ), 141 randomize: false, 142 } ) 143 } ) // each .penci-post-gallery-container 144 } 145 146 if ( $().isotope && $masonry_gallery.length ) { 147 148 $( '.penci-post-gallery-container.masonry .item-gallery-masonry' ).each( function () { 149 var $this = $( this ) 150 if ( $this.attr( 'title' ) ) { 151 var $title = $this.attr( 'title' ) 152 $this.children().append( '<div class="caption">' + $title + '</div>' ) 153 } 154 } ) 155 } 156 157 if ( $masonry_gallery.length ) { 158 $masonry_gallery.each( function () { 159 var $this = $( this ) 160 $this.imagesLoaded( function () { 161 // initialize isotope 162 $this.isotope( { 163 itemSelector: '.item-gallery-masonry', 164 transitionDuration: '.55s', 165 layoutMode: 'masonry', 166 } ) 167 168 $this.addClass( 'loaded' ) 169 170 $( '.penci-post-gallery-container.masonry .item-gallery-masonry' ).each( function () { 171 var $this = $( this ) 172 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 173 $this.addClass( 'animated' ) 174 } ) // inview 175 } ) // each 176 } ) 177 } ) 178 } 179 180 if ( $().theiaStickySidebar ) { 181 var top_margin = 90 182 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 183 top_margin = 122 184 } 185 $( '#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ).the
185iaStickySidebar( { 186 // settings 187 additionalMarginTop: top_margin, 188 } ) 189 } // if sticky 190 } 191 $( 'body' ).trigger( 'penci_swiper_sliders' ) 192 $button_load.removeClass( 'loading-posts' ) 193 $( document ).trigger( 'penci_bf_check' ) 194 }, 195 error: function ( jqXHR, textStatus, errorThrown ) { 196 console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown ) 197 }, 198 199 } ) 200 } 201 202 $( document ).ready( function () { 203 buttonClick() 204 infiniteScroll() 205 } ) 206} )
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.