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