PageSourceSearch

https://www.polderke.com/wp-content/plugins/wp-post-modules-ell/assets/js/wppm-el.frontend.js?ver=6.8.10

js polderke.com collected 2026-10-02 10:29:24 UTC 13,372 bytes, 311 lines download raw bytes

1/**
2 * wppm.plugin.js
3 * JavaScript functions required by the plugin
4 *
5 * @version 1.5.0
6 */
7(function ($) {
8
9    'use strict';
10
11    var WPPM_Ticker_Handler, WPPM_EL_Slider_Handler, WPPM_EL_Sharing_Handler, WPPM_Ajax_Nav_Handler, WPPM_EL_Sharing_refresh;
12
13    // Category submenu toggle
14    function wppm_cat_dropdown() {
15        $(document).on('click', 'a.wppm-cat-toggle', function (e) {
16            e.preventDefault();
17            var this_cat = $(this).parent().find('ul.submenu');
18            $('.post-cats .cat-sub').not(this_cat).hide();
19            this_cat.toggle();
20            $(this).toggleClass('active-link');
21            return false;
22        });
23    }
24
25    wppm_cat_dropdown();
26
27    $('.wppm-tabber,.wppm-ajax-posts').on('wppm_ajax_content_loaded wppm_ajax_loaded', function () {
28        wppm_cat_dropdown();
29    });
30
31    // Close category submenus when clicking on body
32    $(document).on('click', function () {
33        $('.post-cats .cat-sub').hide();
34        $('a.wppm-cat-toggle').removeClass('active-link');
35    });
36
37    // Stop propagation for various selectors
38    $(document).on('click', 'a.wppm-cat-toggle,a.share-trigger', function (e) {
39        e.stopPropagation();
40    });
41
42    WPPM_Ticker_Handler = function ($scope, $) {
43        var ticker_elem = $scope.find('.wppm-ticker').eq(0);
44        // News Ticker
45        if ($.isFunction($.fn.marquee)) {
46            ticker_elem.marquee({
47                duration: $(this).data('duration'),
48                gap: 0,
49                delayBeforeStart: 0,
50                direction: $('body').is('.rtl') ? 'right' : 'left',
51                startVisible: true,
52                duplicated: true,
53                pauseOnHover: true,
54                allowCss3Support: true
55            });
56        }
57    };
58
59    WPPM_EL_Slider_Handler = function ($scope, $) {
60
61        var slider_elem = $scope.find('.posts-slider').eq(0),
62            params = '';
63
64
65        if (slider_elem.length > 0) {
66            params = slider_elem.data('params');
67
68            slider_elem.find('.owl-carousel').owlCarousel({
69                items: parseInt(params.items.size),
70                loop: 'true' === params.loop ? true : false,
71                margin: parseInt(params.slide_margin.size),
72                autoplay: 'true' === params.autoplay ? true : false,
73                autoplayTimeout: parseInt(params.timeout),
74                autoHeight: 'true' === params.autoheight ? true : false,
75                nav: 'true' === params.nav ? true : false,
76                dots: 'true' === params.dots ? true : false,
77                smartSpeed: parseInt(params.speed),
78                navText: false,
79                rtl: ($("body").is(".rtl")),
80                autoplayHoverPause: true,
81                animateIn: params.animatein,
82                animateOut: params.animateout,
83                //stagePadding: parseInt(params.stagepadding),
84
85                responsive: {
86                    0: {
87                        items: parseInt(params.items_mobile.size),
88                        margin: parseInt(params.slide_margin_mobile.size)
89                    },
90                    426: {
91                        items: parseInt(params.items_tablet.size),
92                        margin: parseInt(params.slide_margin_tablet.size)
93                    },
94                    1025: {
95                        items: parseInt(params.items.size)
96                    }
97                }
98            });
99        }
100    };
101
102    WPPM_EL_Sharing_Handler = function ($scope, $) {
103        var share_btn = $scope.find('a.nn-more'),
104            links = $scope.find('.wppm-el-sharing-list li:not(.no-popup) a, .wppm-el-sharing-inline li:not(.no-popup) a'),
105            close_btn = $scope.find('.wppm-el-sharing-list > li.sharing-modal-handle > a.close-sharing'),
106            share_overlay = $scope.find('.sharing-overlay');
107
108        // Social sharing overlay
109        share_btn.on('click', function (e) {
110            e.preventDefault();
111            $(this).closest('.wppm-el-sharing-container').find('.sharing-overlay').toggleClass('is-open');
112            $('body').toggleClass('overlay-active');
113        });
114
115        close_btn.on('click', function (e) {
116            e.preventDefault();
117            $(this).closest('.sharing-overlay').removeClass('is-open');
118            $('body').removeClass('overlay-active');
119        });
120
121        // Sharing links
122        links.on('click', function (e) {
123            e.preventDefault();
124            var href = $(this).attr('href');
125            window.open(href, '_blank', 'width=600,height=400,menubar=0,resizable=1,scrollbars=0,status=1', true);
126        });
127    };
128
129
130    /* Ajax next/prev links */
131    WPPM_Ajax_Nav_Handler = function ($scope, $) {
132        var ajax_posts = $scope.find('.wppm-ajax-posts');
133        ajax_posts.each(function () {
134            var parent = $(this),
135                requestRunning = false,
136                pagenum = 1,
137                params = $(this).data('params'),
138                maxposts = $(this).data('maxposts'),
139                cont = $(this),
140                cont_id = cont.attr('id'),
141                cont_height = 0,
142                status_text = cont.find('span.nav-status').data('format') || '%current% of %total%',
143                new_status,
144                max_mod,
145                max_div,
146                maxpages,
147                offset,
148                new_offset;
149
150            // Set num if not exists
151            if (!('num' in params)) {
152                params.num = '6';
153            }
154
155            // Set offset if not exists
156            if (!('offset' in params)) {
157                params.offset = 0;
158            }
159
160            offset = params.offset;
161
162            // Re calculate maxposts if there is an offset
163            maxposts = maxposts - parseInt(params.offset);
164            max_mod = parseInt(maxposts) % parseInt(params.num);
165            max_div = parseInt(maxposts / params.num);
166            maxpages = (0 === max_mod) ? max_div : max_div + 1;
167
168            // Update nav status
169            new_status = status_text.replace('%current%', pagenum).replace('%total%', maxpages);
170            $(this).find('span.nav-status').text(status_text.replace('%current%', pagenum).replace('%total%', maxpages));
171
172            // Ajax button click event
173            cont.find('.wppm-ajax-nav,.wppm-ajax-loadmore').on('click', 'a.next-link,a.wppm-more-link', function (e) {
174                e.preventDefault();
175                var nav = $(this).parent(),
176                    btn = $(this),
177                    to_show = cont_id + '-sub-' + parseInt(pagenum + 1);
178                new_offset = parseInt(offset) + parseInt(params.num) * parseInt(pagenum);
179                params.offset = parseInt(new_offset);
180
181                console.log(params.offset);
182
183                if (pagenum > 1) {
184                    $(this).parent().find('a.prev-link').removeClass('disabled');
185                } else {
186                    $(this).parent().find('a.prev-link').addClass('disabled');
187                }
188
189                if ((parseInt(params.num) * pagenum) >= maxposts) {
190                    $(this).addClass('disabled');
191                    return;
192                }
193
194                if (params) {
195                    if (btn.is('.next-link')) {
196                        cont.find('.wppm').removeClass('fade-in-top fade-out-half').addClass('fade-out-half');
197                        cont.addClass('wppm-loading').css({
198                            "min-height": cont_height
199                        });
200                    }
201                    if (btn.is('.wppm-more-link')) {
202                        $(btn).parent().addClass('wppm-loading');
203                    }
204
205                    if ($('#' + to_show).length) {
206                        if (btn.is('.next-link')) {
207                            cont.find('.wppm').removeClass('fade-in-top fade-out-half').addClass('fade-out-full');
208                            cont.removeClass('wppm-loading');
209                            $('#' + to_show).removeClass('fade-out-full').addClass('fade-in-top');
210                            $(this).parent().find('a.prev-link').removeClass('disabled');
211                            pagenum++;
212                            cont.find('span.nav-status').text(status_text.replace('%current%', pagenum).replace('%total%', maxpages));
213                        } else {
214                            $('#' + to_show).removeClass('fade-out-full').addClass('fade-in-top');
215                            $(btn).parent().removeClass('wppm-loading');
216                        }
217                        if ((parseInt(params.num) * pagenum) >= maxposts) {
218                            $(btn).addClass('disabled');
219                        }
220                    } else {
221                        if (requestRunning) { // don't do anything if an AJAX request is pending
222                            return;
223                        }
224
225                        requestRunning = true;
226                        $.ajax({
227                            url: wppm_el_localize.ajax_url,
228                            type: "post",
229
230                            data: {
231                                'action': 'wppm_ajaxnav_action',
232                                'wppm_ajaxnav_content': params
233                            },
234
235                            success: function (response) {
236                                pagenum++;
237
238                                cont.find('span.nav-status').text(status_text.replace('%current%', pagenum).replace('%total%', maxpages));
239                                $(btn).parent().find('a.prev-link').removeClass('disabled');
240
241                                if ((parseInt(params.num) * pagenum) >= maxposts) {
242                                    $(btn).addClass('disabled');
243                                }
244
245                                if (btn.is('.next-link')) {
246                                    cont.find('.wppm').addClass('fade-out-full');
247                                    $(response).find('.wppm').attr('id', cont_id + '-sub-' + pagenum).insertBefore(nav).addClass('fade-in-top');
248                                } else {
249                                    $(response).find('.wppm').attr('id', cont_id + '-sub-' + pagenum).insertBefore(btn.parent()).addClass('fade-in-top');
250                                }
251                                parent.trigger('wppm_ajax_content_loaded');
252                                $(document).trigger('ready wppm_ajax_loaded');
253                            },
254                            complete: function () {
255                                requestRunning = false;
256                                if (btn.is('.next-link')) {
257                                    cont.removeClass('wppm-loading');
258                                } else {
259                                    $(btn).parent().removeClass('wppm-loading');
260                                }
261                            },
262                            error: function (errorThrown) {
263                                console.log(errorThrown);
264                            }
265                        });
266                    }
267                }
268            });
269
270            cont.find('.wppm-ajax-nav').on('click', 'a.prev-link', function (e) {
271                e.preventDefault();
272
273                var to_show = cont_id + '-sub-' + parseInt(pagenum - 1);
274
275                if ($('#' + to_show).length) {
276                    cont.find('.wppm').removeClass('fade-in-top fade-out-half').addClass('fade-out-full');
277                    $('#' + to_show).removeClass('fade-out-full').addClass('fade-in-top');
278                    pagenum--;
279                    cont.find('span.nav-status').text(status_text.replace('%current%', pagenum).replace('%total%', maxpages));
280                    parent.trigger('wppm_ajax_content_loaded');
281                }
282
283                if ((parseInt(params.num) * pagenum) <= maxposts) {
284                    $(this).parent().find('a.next-link').removeClass('disabled');
285                }
286
287                if (pagenum <= 1) {
288                    $(this).addClass('disabled');
289                    return;
290                }
291
292            });
293        });
294    };
295
296    // Executer under Elementor
297    $(window).on('elementor/frontend/init', function () {
298        elementorFrontend.hooks.addAction('frontend/element_ready/wp-post-modules-el.default', WPPM_EL_Slider_Handler);
299        elementorFrontend.hooks.addAction('frontend/element_ready/wp-post-modules-el.default', WPPM_EL_Sharing_Handler);
300        elementorFrontend.hooks.addAction('frontend/element_ready/wp-post-modules-el.default', WPPM_Ajax_Nav_Handler);
301        elementorFrontend.hooks.addAction('frontend/element_ready/wp-post-modules-el.default', WPPM_EL_Sharing_refresh);
302        elementorFrontend.hooks.addAction('frontend/element_ready/wp-post-modules-el.default', WPPM_Ticker_Handler);
303    });
304
305    WPPM_EL_Sharing_refresh = function ($scope, $) {
306        $('.wppm-ajax-posts').on('wppm_ajax_content_loaded', function () {
307            WPPM_EL_Sharing_Handler($(this), $);
308        });
309    };
310
311})(jQuery);

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.