PageSourceSearch

https://propuestaciudadana.org.pe/wp-content/themes/soledad/js/ajax-filter-latest.js?ver=8.4.3

js propuestaciudadana.org.pe collected 2026-10-02 05:19:21 UTC 23,244 bytes, 452 lines download raw bytes

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                                $('.penci-wrapper-data .penci-owl-carousel-slider').each(function () {
224                                    var $this = $(this),
225                                        $rtl = false;
226                                    if ($('html').attr('dir') === 'rtl') {
227                                        $rtl = true;
228                                    }
229                                    var owl_args = {
230                                        rtl: $rtl,
231                                        loop: true,
232                                        margin: 0,
233                                        items: 1,
234                                        navSpeed: 600,
235                                        lazyLoad: true,
236                                        dotsSpeed: 600,
237                                        nav: true,
238                                        dots: false,
239                                        navText: ['<i class="penciicon-left-chevron"></i>', '<i class="penciicon-right-chevron"></i>'],
240                                        autoplay: true,
241                                        autoplayTimeout: 5000,
242                                        autoHeight: true,
243                                        autoplayHoverPause: true,
244                                        autoplaySpeed: 600
245                                    };
246
247                                    $this.owlCarousel(owl_args);
248                                });
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                            } else {
268                                var $data = $(data);
269                                $wrap_content.append($data);
270
271                                $(".container").fitVids();
272
273                                $('.penci-wrapper-data .penci-owl-carousel-slider').each(function () {
274                                    var $this = $(this),
275                                        $datalazy = false,
276                                        $rtl = false;
277
278                                    if ($('html').attr('dir') === 'rtl') {
279                                        $rtl = true;
280                                    }
281                                    if ($this.attr('data-lazy')) {
282                                        $datalazy = true;
283                                    }
284                                    var owl_args = {
285                                        rtl: $rtl,
286                                        loop: true,
287                                        margin: 0,
288                                        items: 1,
289                                        navSpeed: 600,
290                                        dotsSpeed: 600,
291                                        lazyLoad: $datalazy,
292                                        nav: true,
293                                        dots: false,
294                                        navText: ['<i class="penciicon-left-chevron"></i>', '<i class="penciicon-right-chevron"></i>'],
295                                        autoplay: true,
296                                        autoplayTimeout: 5000,
297                                        autoHeight: true,
298                                        autoplayHoverPause: true,
299                                        autoplaySpeed: 600
300                                    };
301
302                                    $this.imagesLoaded(function () {
303                                        $this.owlCarousel(owl_args);
304                                    });
305                                });
306
307                                if ($().easyPieChart) {
308                                    $('.penci-piechart').each(function () {
309                                        var $this = $(this);
310                                        $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) {
311                                            var chart_args = {
312                                                barColor: $this.data('color'),
313                                                trackColor: $this.data('trackcolor'),
314                                                scaleColor: false,
315                                                lineWidth: $this.data('thickness'),
316                                                size: $this.data('size'),
317                                                animate: 1000
318                                            };
319                                            $this.easyPieChart(chart_args);
320                                        }); // bind inview
321                                    }); // each
322                                }
323
324                                var $justified_gallery = $('.penci-post-gallery-container.justified');
325                                var $masonry_gallery = $('.penci-post-gallery-container.masonry');
326                                if ($().justifiedGallery && $justified_gallery.length) {
327                                    $('.penci-post-gallery-container.justified').each(function () {
328                                        var $this = $(this);
329                                        $this.justifiedGallery({
330                                            rowHeight: $this.data('height'),
331                                            lastRow: 'nojustify',
332                                            margins: $this.data('margin'),
333                                            randomize: false
334                                        });
335                                    }); // each .penci-post-gallery-container
336                                }
337
338                                if ($().isotope && $masonry_gallery.length) {
339
340                                    $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () {
341                                        var $this = $(this);
342                                        if ($this.attr('title')) {
343                                            var $title = $this.attr('title');
344                                            $this.children().append('<div class="caption">' + $title + '</div>');
345                                        }
346                                    });
347                                }
348
349                                if ($masonry_gallery.length) {
350                                    $masonry_gallery.each(function () {
351                                        var $this = $(this);
352                                        $this.imagesLoaded(function () {
353                                            // initialize isotope
354                                            $this.isotope({
355                                                itemSelector: '.item-gallery-masonry',
356                                                transitionDuration: '.55s',
357                                                layoutMode: 'masonry'
358                                            });
359
360                                            $this.addClass('loaded');
361
362                                            $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () {
363                                                var $this = $(this);
364                                                $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) {
365                                                    $this.addClass('animated');
366                                                }); // inview
367                                            }); // each
368                                        });
369                                    });
370                                }
371
372                                if ($().theiaStickySidebar) {
373                                    var top_margin = 90;
374                                    if ($('body').hasClass('admin-bar')) {
375                                        top_margin = 122;
376                                    }
377                                    $('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar').theiaStickySidebar({
378                                        // settings
379                                        additionalMarginTop: top_margin
380                                    });
381                                } // if sticky
382                            }
383
384                            if ($('.pwid-' + wrapId ).find('.pc-nomorepost').length) {
385                                parentclass.find('.pc-ajaxfil-link.next').addClass('disable');
386                            } else {
387                                parentclass.find('.pc-ajaxfil-link.next').removeClass('disable');
388                            }
389
390                            if (nav[parentID] !== undefined) {
391                                wrapper.find('.pwid-' + wrapId).append($(nav[parentID]));
392
393                                wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button')
394                                    .removeAttr('data-cat')
395                                    .removeAttr('data-tag')
396                                    .removeAttr('data-author');
397
398                                if (cat) {
399                                    wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-cat', cat);
400                                }
401                                if (tag) {
402                                    wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-tag', tag);
403                                }
404                                if (author) {
405                                    wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-author', author);
406                                }
407                                wrapper.find('.pwid-' + wrapId + ' .penci-ajax-more .penci-ajax-more-button').attr('data-offset', number);
408                            }
409
410                            wrapper.find('.penci-wrapper-posts-content').hide();
411                            wrapper.find('.pwid-' + wrapId).show();
412                            wrapper.removeClass('loading-posts pcftaj-ld');
413                            $this.removeClass('loading-posts');
414                            $navthis.removeClass('loading-posts');
415                            var o = 0;
416                            wrapper.find('.pwid-' + wrapId + ' .list-post, .pwid-' + wrapId + ' .grid-style, .pwid-' + wrapId + ' .grid-masonry').each(function () {
417                                o++;
418                                $(this).addClass('penci-ajrs-animate').attr('style', 'animation-delay:' + o / 10 + 's')
419                            });
420                            $(document).trigger('pcajax_loaded');
421                            $(document).trigger('penci_bf_check');
422                        } else {
423                            wrapper.find('.penci-wrapper-posts-content').hide();
424                            wrapper.find('.pwid-' + wrapId).show();
425                            wrapper.find('.pwid-' + wrapId).append('<div class="pcajx-nopost"><span>No post found !</span></div>');
426                            wrapper.removeClass('loading-posts pcftaj-ld');
427                            $this.removeClass('loading-posts');
428                            $navthis.removeClass('loading-posts');
429                        }
430                    },
431                    error: function (jqXHR, textStatus, errorThrown) {
432                        console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
433                    }
434
435                });
436            }
437        }
438    });
439
440    function penciGetOBjBlockData($blockID) {
441        var $obj = new penciBlock();
442
443        jQuery.each(penciBlocksArray, function (index, block) {
444
445            if (block.blockID === $blockID) {
446                $obj = penciBlocksArray[index];
447            }
448        });
449
450        return $obj;
451    }
452});

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.