1/* global penciBlock */ 2/* global penciBlocksArray */ 3jQuery(document).ready(function ($) { 4 var nav = []; 5 $('.penci-latest-posts-sc').each(function () { 6 var elID = $(this).attr('id'); 7 if ($(this).find('.pcflx-nav').length > 0) { 8 var maxnum = $(this).find('.pcflx li.all a').attr('data-maxp'); 9 if (parseInt(maxnum) <= 1) { 10 $(this).find('.pcflx-nav .pcaj-nav-link').addClass('disable'); 11 } 12 } 13 if($(this).find('.penci-ajax-more').length) { 14 nav[elID] = $(this).find('.penci-ajax-more').prop('outerHTML'); 15 } 16 }); 17 jQuery('body').on('click', '.penci-latest-posts-sc .pc-ajaxfil-link', function (event) { 18 event.preventDefault(); 19 if (!$(this).hasClass('loading-posts')) { 20 var $this = $(this), 21 $navthis = $this, 22 parentID = $(this).closest('.penci-latest-posts-sc').attr('id'), 23 parentclass = $(this).closest('.pcnav-lgroup'), 24 wrapper = $(this).closest('.penci-latest-posts-sc').find('.penci-wrapper-posts-ajax'), 25 wrapId = $this.data('id'), 26 layout = parentclass.data('layout'), 27 ppp = parentclass.data('number'), 28 offset = parentclass.attr('data-offset'), 29 exclude = parentclass.data('exclude'), 30 from = parentclass.data('from'), 31 comeFrom = parentclass.data('come_from'), 32 mixed = parentclass.data('mixed'), 33 query = parentclass.data('query'), 34 infeedads = parentclass.data('infeedads'), 35 number = parentclass.data('number'), 36 query_type = parentclass.data('query_type'), 37 archivetype = parentclass.data('archivetype'), 38 archivevalue = parentclass.data('archivevalue'), 39 tag = $this.data('tag'), 40 cat = $this.data('cat'), 41 author = $this.data('author'), 42 template = parentclass.data('template'), 43 navlink = false, 44 prev, 45 pagednum = parseInt($this.attr('data-paged')), 46 curpaged = pagednum, 47 $wrap_content_id = wrapper.find('.pwid-' + wrapId); 48 49 50 wrapper.addClass('loading-posts pcftaj-ld'); 51 $this.addClass('loading-posts'); 52 53 if ($this.hasClass('pcaj-nav-link')) { 54 navlink = true; 55 } 56 57 if (navlink && $this.hasClass('prev')) { 58 prev = true; 59 } 60 61 if (navlink) { 62 $this = parentclass.find('.current-item'); 63 wrapId = $this.data('id'); 64 cat = $this.data('cat'); 65 tag = $this.data('tag'); 66 curpaged = parseInt($this.attr('data-paged')); 67 68 if (prev) { 69 pagednum = curpaged - 1; 70 } else { 71 pagednum = curpaged + 1; 72 } 73 } 74 75 if (!navlink) { 76 parentclass.find('.pc-ajaxfil-link').removeClass('current-item'); 77 $this.addClass('current-item'); 78 } 79 80 if (wrapId === 'default' && !navlink) { 81 wrapper.find('.penci-wrapper-posts-content').hide(); 82 wrapper.find('.pwid-default').show(); 83 wrapper.removeClass('loading-posts pcftaj-ld'); 84 $this.removeClass('loading-posts'); 85 $navthis.removeClass('loading-posts'); 86 87 var maxp = $(this).attr('data-maxp'); 88 89 if (curpaged <= 1) { 90 parentclass.find('.pc-ajaxfil-link.prev').addClass('disable'); 91 } else { 92 parentclass.find('.pc-ajaxfil-link.prev').removeClass('disable'); 93 } 94 95 if ($wrap_content_id.find('.pc-nomorepost').length || maxp <= 1) { 96 parentclass.find('.pc-ajaxfil-link.next').addClass('disable'); 97 } else { 98 parentclass.find('.pc-ajaxfil-link.next').removeClass('disable'); 99 } 100 101 var o = 0; 102 $wrap_content_id.find('.list-post,.grid-style,.grid-masonry').each(function () { 103 o++; 104 $(this).addClass('penci-ajrs-animate').attr('style', 'animation-delay:' + o / 10 + 's') 105 }); 106 } else if ($wrap_content_id.length && !navlink) { 107 wrapper.find('.penci-wrapper-posts-content').hide(); 108 $wrap_content_id.show(); 109 wrapper.removeClass('loading-posts pcftaj-ld'); 110 $this.removeClass('loading-posts'); 111 $navthis.removeClass('loading-posts'); 112 113 if (curpaged <= 1) { 114 parentclass.find('.pc-ajaxfil-link.prev').addClass('disable'); 115 } else { 116 parentclass.find('.pc-ajaxfil-link.prev').removeClass('disable'); 117 } 118 119 if ($wrap_content_id.find('.pc-nomorepost').length) { 120 parentclass.find('.pc-ajaxfil-link.next').addClass('disable'); 121 } else { 122 parentclass.find('.pc-ajaxfil-link.next').removeClass('disable'); 123 } 124 125 var o = 0; 126 $wrap_content_id.find('.list-post,.grid-style,.grid-masonry').each(function () { 127 o++; 128 $(this).addClass('penci-ajrs-animate').attr('style', 'animation-delay:' + o / 10 + 's') 129 }); 130 } else { 131 132 var OBjBlockData = penciGetOBjBlockData(parentclass.data('blockid')), 133 dataFilter = OBjBlockData.atts_json ? JSON.parse(OBjBlockData.atts_json) : OBjBlockData.atts_json; 134 135 var data = { 136 action: 'penci_more_post_ajax', 137 query: query, 138 offset: offset, 139 mixed: mixed, 140 layout: layout, 141 exclude: exclude, 142 from: from, 143 comefrom: comeFrom, 144 datafilter: dataFilter, 145 template: template, 146 ppp: ppp, 147 number: number, 148 infeedads: infeedads, 149 query_type: query_type, 150 archivetype: archivetype, 151 archivevalue: archivevalue, 152 tag: tag, 153 cat: cat, 154 author: author, 155 pagednum: pagednum, 156 qtype: 'ajaxtab', 157 nonce: pclatest_ajax.nonce, 158 }; 159 160 161 $.ajax({
162 type: "POST", 163 dataType: "html", 164 url: ajax_var_more.url, 165 data: data, 166 success: function (data) { 167 168 var data_offset = parseInt(offset) + ppp, 169 data_paded = curpaged, 170 $wrap_content, 171 $check_class = false, 172 $check_masonry = false; 173 174 if (wrapper.find('.penci-wrapper-posts-content .penci-wrapper-data').hasClass('penci-grid')) { 175 $check_class = true; 176 } 177 178 if (wrapper.find('.penci-wrapper-posts-content .penci-wrapper-data').hasClass('masonry')) { 179 $check_masonry = true; 180 } 181 182 if (navlink) { 183 wrapper.find('.pwid-' + wrapId).remove(); 184 data_paded = curpaged + 1; 185 } 186 187 if (prev) { 188 data_paded = curpaged - 1; 189 } 190 191 if ($check_class) { 192 wrapper.append('<div class="penci-wrapper-posts-content pwcustom pwid-' + wrapId + '"><ul class="penci-wrapper-data penci-grid penci-shortcode-render"></ul></div>'); 193 } else if ($check_masonry) { 194 wrapper.append('<div class="penci-wrapper-posts-content pwcustom pwid-' + wrapId + '"><div class="penci-wrap-masonry"><div class="penci-wrapper-data masonry penci-masonry"></div></div></div>'); 195 } else { 196 wrapper.append('<div class="penci-wrapper-posts-content pwcustom pwid-' + wrapId + '"><div class="penci-wrapper-data"></div></div>'); 197 } 198 199 $wrap_content = wrapper.find('.pwid-' + wrapId + ' .penci-wrapper-data'); 200 201 if (data) { 202 $this.attr('data-paged', data_paded); 203 $this.attr('data-offset', data_offset); 204 205 if (data_paded <= 1) { 206 parentclass.find('.pc-ajaxfil-link.prev').addClass('disable'); 207 } else { 208 parentclass.find('.pc-ajaxfil-link.prev').removeClass('disable'); 209 } 210 211 if (layout === 'masonry' || layout === 'masonry-2') { 212 var $data = $(data); 213 $wrap_content.append($data).imagesLoaded(function () { 214 $wrap_content.isotope({ 215 itemSelector: '.item-masonry', 216 transitionDuration: '.55s', 217 layoutMode: 'masonry' 218 }); 219 }); 220 221 $(".container").fitVids(); 222 223 $('body').trigger( 'penci_swiper_sliders' ); 224 225 if ($().easyPieChart) { 226 $('.penci-piechart').each(function () { 227 var $this = $(this); 228 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 229 var chart_args = { 230 barColor: $this.data('color'), 231 trackColor: $this.data('trackcolor'), 232 scaleColor: false, 233 lineWidth: $this.data('thickness'), 234 size: $this.data('size'), 235 animate: 1000 236 }; 237 $this.easyPieChart(chart_args); 238 }); // bind inview 239 }); // each 240 } 241 242 } else { 243 var $data = $(data); 244 $wrap_content.append($data); 245 246 $(".container").fitVids(); 247 248 $('body').trigger( 'penci_swiper_sliders' ); 249 250 if ($().easyPieChart) { 251 $('.penci-piechart').each(function () { 252 var $this = $(this); 253 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 254 var chart_args = { 255 barColor: $this.data('color'), 256 trackColor: $this.data('trackcolor'), 257 scaleColor: false, 258 lineWidth: $this.data('thickness'), 259 size: $this.data('size'), 260 animate: 1000 261 }; 262 $this.easyPieChart(chart_args); 263 }); // bind inview 264 }); // each 265 } 266 267 var $justified_gallery = $('.penci-post-gallery-container.justified'); 268 var $masonry_gallery = $('.penci-post-gallery-container.masonry'); 269 if ($().justifiedGallery && $justified_gallery.length) { 270 $('.penci-post-gallery-container.justified').each(function () { 271 var $this = $(this); 272 $this.justifiedGallery({ 273 rowHeight: $this.data('height'), 274 lastRow: 'nojustify', 275 margins: $this.data('margin'), 276 randomize: false 277 }); 278 }); // each .penci-post-gallery-container 279 } 280 281 if ($().isotope && $masonry_gallery.length) { 282 283 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () { 284 var $this = $(this); 285 if ($this.attr('title')) { 286 var $title = $this.attr('title'); 287 $this.children().append('<div class="caption">' + $title + '</div>'); 288 } 289 }); 290 } 291 292 if ($masonry_gallery.length) { 293 $masonry_gallery.each(function () { 294 var $this = $(this); 295 $this.imagesLoaded(function () { 296 // initialize isotope 297 $this.isotope({ 298 itemSelector: '.item-gallery-masonry', 299 transitionDuration: '.55s', 300 layoutMode: 'masonry' 301 }); 302 303 $this.addClass('loaded'); 304 305 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () { 306 var $this = $(this); 307 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 308 $this.addClass('animated'); 309 }); // inview 310 }); // each 311 }); 312 }); 313 } 314 315 if ($().theiaStickySidebar) { 316 var top_margin = 90; 317 if ($('body').hasClass('admin-bar')) { 318 top_margin = 122; 319 } 320 $('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar').theiaStickySidebar({ 321 // settings 322 additionalMarginTop: top_margin 323 }); 324 } // if sticky 325 } 326 327 if ($('.pwid-' + wrapId ).find('.pc-nomorepost').length) { 328 parentclass.find('.pc-ajaxfil-link.next').addClass('disable'); 329 } else { 330 parentclass.find('.pc-ajaxfil-link.next').removeClass('disable'); 331 } 332 333 if (nav[parentID] !== undefined) { 334 wrapper.find('.pwid-' + wrapId).append($(nav[parentID])); 335 336 wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button') 337 .removeAttr('data-cat') 338 .removeAttr('data-tag') 339 .removeAttr('data-author'); 340 341 if (cat) { 342 wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-cat', cat); 343 } 344 if (tag) { 345 wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-tag', tag); 346 } 347 if (author) { 348 wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-author', author); 349 } 350 wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-offset', number); 351 } 352 353 wrapper.find('.penci-wrapper-posts-content').hide(); 354 wrapper.find('.pwid-' + wrapId).show(); 355 wrapper.removeClass('loading-posts pcftaj-ld'); 356 $this.removeClass('loading-posts'); 357 $navthis.removeClass('loading-posts'); 358 var o = 0; 359 wrapper.find('.pwid-' + wrapId + ' .list-post, .pwid-' + wrapId + ' .grid-style, .pwid-' + wrapId + ' .grid-masonry').each(function () { 360 o++; 361 $(this).addClass('penci-ajrs-animate').attr('style', 'animation-delay:' + o / 10 + 's') 362 }); 363 $(document).trigger('pcajax_loaded'); 364 $(document).trigger('penci_bf_check'); 365 } else { 366 wrapper.find('.penci-wrapper-posts-content').hide(); 367 wrapper.find('.pwid-' + wrapId).show(); 368 wrapper.find('.pwid-' + wrapId).append('<div class="pcajx-nopost"><span>No post found !</span></div>'); 369 wrapper.removeClass('loading-posts pcftaj-ld'); 370 $this.removeClass('loading-posts'); 371 $navthis.removeClass('loading-posts'); 372 } 373 }, 374 error: function (jqXHR, textStatus, errorThrown) { 375 console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown); 376 } 377 378 }); 379 } 380 } 381 });
382 383 function penciGetOBjBlockData($blockID) { 384 var $obj = new penciBlock(); 385 386 jQuery.each(penciBlocksArray, function (index, block) { 387 388 if (block.blockID === $blockID) { 389 $obj = penciBlocksArray[index]; 390 } 391 }); 392 393 return $obj; 394 } 395});
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.