PageSourceSearch

https://welovemma.de/wp-content/themes/backstreet/js/wpg-scripts.js?ver=6.4.3

js welovemma.de collected 2026-09-29 11:36:12 UTC 40,367 bytes, 1,116 lines download raw bytes

1(function($) {
2    "use strict";
3
4    var isDuringAjax = false,
5        minWidth;
6
7    $.extend($.easing, {
8        easeInOutQuint: function(x, t, b, c, d) {
9            if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
10            return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
11        }
12    });
13
14    /**
15     * File skip-link-focus-fix.js.
16     *
17     * Helps with accessibility for keyboard only users.
18     *
19     * Learn more: https://git.io/vWdr2
20     */
21    var isIe = /(trident|msie)/i.test(navigator.userAgent);
22
23    if (isIe && document.getElementById && window.addEventListener) {
24        window.addEventListener('hashchange', function() {
25            var id = location.hash.substring(1),
26                element;
27
28            if (!(/^[A-z0-9_-]+$/.test(id))) {
29                return;
30            }
31
32            element = document.getElementById(id);
33
34            if (element) {
35                if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) {
36                    element.tabIndex = -1;
37                }
38
39                element.focus();
40            }
41        }, false);
42    }
43
44    /* Detect Browser Size
45    -------------------------------------------------------*/
46    if (Modernizr.mq('(min-width: 0px)')) {
47        // Browsers that support media queries
48        minWidth = function(width) {
49            return Modernizr.mq('(min-width: ' + width + 'px)');
50        };
51    } else {
52        // Fallback for browsers that does not support media queries
53        minWidth = function(width) {
54            return jQuery(window).width() >= width;
55        };
56    }
57
58    /* Scroll to Top
59    -------------------------------------------------------*/
60    jQuery(window).scroll(function() {
61        var scroll = jQuery(window).scrollTop();
62        var $backToTop = jQuery("#back-to-top");
63        if (scroll >= 50) {
64            $backToTop.addClass("show");
65        } else {
66            $backToTop.removeClass("show");
67        }
68    });
69
70    jQuery('a[href="#top"]').on('click', function() {
71        jQuery('html, body').animate({
72            scrollTop: 0
73        }, 1000, "easeInOutQuint");
74        return false;
75    });
76
77    /* Responsive Video
78    -------------------------------------------------------*/
79    function wpg_responsive_video() {
80        // Gather all videos
81        var $all_videos = jQuery('.site').find('iframe[src*="player.vimeo.com"], iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"], iframe[src*="dailymotion.com"], iframe[src*="kickstarter.com"][src*="video.html"], object, embed');
82
83        // Cycle through each video and add wrapper div with appropriate aspect ratio if required
84        $all_videos.not('object object').each(function() {
85            if (!jQuery(this).parent('.video-container').length && !jQuery(this).parent('.wp-block-embed__wrapper').length) {
86                jQuery(this).wrap('<div class="video-container">');
87            }
88        });
89    }
90    wpg_responsive_video();
91
92    /* Backstretch theme background
93    -------------------------------------------------------*/
94    if (wpg.is_boxed && wpg.theme_bg) {
95        jQuery.backstretch(wpg.theme_bg);
96    }
97
98    /* Lazy Load
99     ---------------------------------------------------------- */
100    if (wpg.is_lazy) {
101        if (jQuery(".lazy-img")[0]) {
102            jQuery(".lazy-img").each(function(e) {
103                var this_element = jQuery(this);
104                this_element.lazy({
105                    effect: 'fadeIn',
106                    effectTime: 300,
107                });
108            });
109        }
110        // fadein post content images in lazyload mode.
111        jQuery('.article-content').find("img[class*='wp-image-']").viewportChecker();
112    }
113
114    /* Sticky Sidebar
115    -------------------------------------------------------*/
116    jQuery(".sticky-col").each(function(e) {
117        var this_element = jQuery(this),
118            stickyBar = jQuery(this).attr("data-stickyCol"),
119            barOffset = wpg.is_sticky ? 50 : 0,
120            stickyOffset = jQuery(this).attr("data-offset");
121
122        if (typeof stickyOffset == "undefined") {
123            stickyOffset = Math.floor(30 + barOffset);
124        }
125        if (typeof stickyBar !== "undefined" && stickyBar !== false && (stickyBar === "yes" || stickyBar === '1')) {
126            this_element.theiaStickySidebar({
127                // Settings
128                additionalMarginTop: parseInt(stickyOffset)
129            });
130        }
131    });
132
133    /* Marquee / Trending News
134    -------------------------------------------------------*/
135    if (wpg.newsticker_active) {
136        jQuery('.breaking-news-ticker').breakingNews({
137            direction: wpg.is_rtl ? 'rtl' : 'ltr',
138            scrollSpeed: 2,
139            height: 44,
140            borderWidth: 0,
141            radius: 0
142        });
143    }
144
145    /* Instagram Feed
146    ---------------------------------------------------------- */
147    jQuery('.instagram-feed').each(function() {
148        var $this = jQuery(this),
149            image_resolution = $this.attr('data-imagesize'),
150            image_number = $this.attr('data-number'),
151            x;
152        jQuery.ajax({
153            url: 'https://api.instagram.com/v1/users/' + wpg.instagram_feed_id + '/media/recent',
154            dataType: 'json',
155            type: 'GET',
156            data: {
157                access_token: wpg.instagram_feed_key,
158                count: image_number
159            },
160            success: function(data) {
161                console.log(data);
162                for (x in data.data) {
163                    if ('low_resolution' == image_resolution) {
164                        $this.append('<li><a target="_blank" href="' + data.data[x].link + '"><img src="' + data.data[x].images.low_resolution.url + '" width="' + data.data[x].images.low_resolution.width + '" height="' + data.data[x].images.low_resolution.height + '"></a></li>');
165                    } else {
166                        $this.append('<li><a target="_blank" href="' + data.data[x].link + '"><img src="' + data.data[x].images.thumbnail.url + '" width="' + data.data[x].images.thumbnail.width + '" height="' + data.data[x].images.thumbnail.height + '"></a></li>');
167                    }
168                }
169            },
170            error: function(data) {
171                console.log(data);
172            }
173        });
174    });
175
176
177    /* Flexmenu
178    -------------------------------------------------------*/
179    jQuery('ul.module-filters').flexMenu({
180        linkText: '<span class="fa fa-ellipsis-h"></span>',
181        showOnHover: false,
182        linkTextAll: wpg.menu_text,
183        linkTitleAll: wpg.menu_text,
184    });
185
186    /* Mobile navigation
187    ----------------------------------------------------------*/
188    var mainNav = jQuery('.nav-menu'),
189        mobileMenu = jQuery('.mobile-menu'),
190        mobileItems = '';
191
192    if (mainNav.length) {
193        var mobileItems = mainNav.clone();
194        mobileItems.removeClass('nav-menu inline-list').addClass('mobile-nav-menu');
195        mobileItems.find('.menu-item.has-submenu').removeClass('has-submenu').addClass('has-submenu-mobile');
196        mobileItems.find('.megamenu').removeClass('megamenu').addClass('megamenu-mobile');
197        mobileItems.find('.menu-item ul').removeClass('submenu bg-dark').addClass('submenu-mobile');
198        mobileItems.find('.row').removeClass('row');
199        mobileItems.find('.col').removeClass('col');
200        mobileItems.find('.megacat').remove();
201        mobileItems.find('.submenu-pointer').remove();
202        mobileItems.find('li.has-submenu-mobile:not(.mega-cat-posts)').prepend('<i class="mobile-arrows fa fa-plus" aria-hidden="true"></i>');
203        mobileMenu.append(mobileItems);
204    }
205
206    jQuery('.mobile-menu li.has-submenu-mobile:not(.mega-cat-posts) .mobile-arrows').click(function() {
207        jQuery(this).toggleClass('is-open').closest('.menu-item').find('ul:first').slideToggle();
208        return false;
209    });
210
211    /* Megamenu content width
212    -------------------------------------------------------*/
213    function megamenu_content_width() {
214        jQuery('.megamenu').each(function() {
215            var $this = jQuery(this);
216            jQuery(this).css('width', jQuery('.container').width());
217            var submenu = $this.closest('.has-submenu'),
218                containerOffset = jQuery(window).width() - jQuery('.container').outerWidth(),
219                offset = submenu.offset().left;
220
221            if (wpg.is_rtl) {
222                offset = (jQuery(window).width() - (offset + submenu.outerWidth()));
223            }
224            containerOffset = containerOffset / 2;
225            offset = offset - containerOffset - 15;
226
227            if (wpg.is_rtl) {
228                jQuery(this).css('right', -offset);
229            } else {
230                jQuery(this).css('left', -offset);
231            }
232        });
233    }
234    megamenu_content_width();
235
236    jQuery(window).resize(function() {
237        megamenu_content_width();
238    });
239
240    /* Dropdown Menu
241    -------------------------------------------------------*/
242    var menu = function(el) {
243        this.target = el;
244        this.target.find('.submenu').css({
245            'dispay': 'none',
246            'opacity': 0
247        });
248        this.target.on({
249            mouseenter: this.reveal,
250            mouseleave: this.conceal
251        }, 'li');
252    };
253
254    // Show
255    menu.prototype.reveal = function() {
256        var target = jQuery(this).children('.submenu');
257        if (target.hasClass('is_open')) {
258            target.velocity('stop').velocity('reverse');
259        } else {
260            target.velocity('stop').velocity(
261                'transition.slideDownIn', {
262                    duration: 250,
263                    delay: 0,
264                    complete: function() {
265                        target.addClass('is_open');
266                    }
267                }
268            );
269        }
270    };
271
272    // Hide
273    menu.prototype.conceal = function() {
274        var target = jQuery(this).children('.submenu');
275        target.velocity('stop').velocity(
276            'transition.fadeOut', {
277                duration: 100,
278                delay: 0,
279                complete: function() {
280                    target.removeClass('is_open');
281                }
282            }
283        );
284    };
285
286    new menu(jQuery('.nav-menu'));
287
288    /* Check URL if an image
289     ---------------------------------------------------------- */
290    var wpg_IsUriImage = function(uri) {
291        // Make sure we remove any nasty GET params
292        uri = uri.split("?")[0];
293        // Moving on now
294        var parts = uri.split("."),
295            extension = parts[parts.length - 1],
296            imageTypes = ["jpg", "jpeg", "tiff", "png", "gif", "bmp"];
297        if (imageTypes.indexOf(extension) !== -1) {
298            return true;
299        } else {
300            return false;
301        }
302    };
303
304    /* Magnific Popup
305    ---------------------------------------------------------- */
306    var conf_lightbox = {
307        closeOnContentClick: true,
308        closeBtnInside: false,
309        tLoading: '',
310        image: {
311            verticalFit: true,
312            titleSrc: function(item) {
313                var current_caption = jQuery(item.el).data("caption"),
314                    has_current_caption = typeof current_caption;
315                if (has_current_caption !== "undefined") {
316                    return current_caption;
317                }
318                return item.el.find("img").attr("alt");
319            }
320        }
321    };
322    /* Check if image have caption */
323    jQuery("figure").each(function() {
324        var caption_text = jQuery(this).find(".wp-caption-text, figcaption").html();
325        jQuery(this).find("a").data("caption", caption_text);
326    });
327
328    /* Post Content Image Popup */
329    if (wpg.lightbox_image) {
330        jQuery('.article-content').find('a').not('.gallery a, .wp-block-gallery a').each(function(i, el) {
331            if (wpg_IsUriImage(el.href)) {
332                jQuery(this).magnificPopup($.extend(true, {
333                    type: "image",
334                    mainClass: "mfp-with-zoom mfp-img-mobile",
335                    zoom: {
336                        enabled: true,
337                        duration: 300
338                    }
339                }, conf_lightbox));
340            }
341        });
342    }
343
344    /* Post Content Gallery Popup */
345    if (wpg.lightbox_gallery) {
346        var group_gallery = {},
347            group_gallery_widget = {};
348
349        jQuery('.article-content').find('.gallery a, .wp-block-gallery a').each(function(e) {
350            var id = jQuery(this).closest('.gallery').attr('id');
351            if (!group_gallery[id]) {
352                group_gallery[id] = [];
353            }
354            group_gallery[id].push(this);
355        });
356        $.each(group_gallery, function() {
357            if (wpg_IsUriImage(jQuery(this).attr("href"))) {
358                jQuery(this).magnificPopup($.extend(true, {
359                    type: "image",
360                    mainClass: "mfp-with-zoom mfp-img-mobile",
361                    zoom: {
362                        enabled: true,
363                        duration: 300
364                    },
365                    gallery: {
366                        enabled: true
367                    }
368                }, conf_lightbox));
369            }
370        });
371    }
372
373    /* Image Popup */
374    if (jQuery(".image-lightbox")[0]) {
375        jQuery(".image-lightbox").each(function(i, el) {
376            if (wpg_IsUriImage(el.href)) {
377                jQuery(this).magnificPopup($.extend(true, {
378                    type: "image",
379                    mainClass: "mfp-with-zoom mfp-img-mobile",
380                    zoom: {
381                        enabled: true,
382                        duration: 300
383                    }
384                }, conf_lightbox));
385            }
386        });
387    }
388
389    /* Gallery Popup */
390    if (jQuery(".slider-lightbox")[0]) {
391        var groups = {};
392        jQuery(".slider-lightbox").each(function(e) {
393            var id = parseInt(jQuery(this).attr("data-group"), 10);
394            if (!groups[id]) {
395                groups[id] = [];
396            }
397            groups[id].push(this);
398        });
399        $.each(groups, function() {
400            jQuery(this).magnificPopup({
401                closeOnContentClick: true,
402                closeBtnInside: false,
403                tLoading: '',
404                type: "image",
405                mainClass: "mfp-fade mfp-img-mobile",
406                gallery: {
407                    enabled: true,
408                    tCounter: ''
409                }
410            });
411        });
412    }
413
414    /* Magnific Popup Inline
415    -------------------------------------------------------*/
416    if (jQuery(".inline-lightbox")[0]) {
417        jQuery(".inline-lightbox").each(function(i, el) {
418            jQuery(this).magnificPopup({
419                removalDelay: 500, //delay removal by X to allow out-animation
420                callbacks: {
421                    beforeOpen: function() {
422                        this.st.mainClass = this.st.el.attr('data-effect');
423                    }
424                },
425                midClick: true,
426                focus: '.input-focus',
427                closeMarkup: '<button title="%title%" type="button" class="popup-close icon-cross mfp-close"></button>',
428            });
429        });
430    }
431
432    /* Megamenu Post Ajax
433    -------------------------------------------------------*/
434    var megaMenuAjax = false;
435
436    jQuery(document).on('mouseenter', '.mega-cat-posts', function() {
437        var menuItem = jQuery(this),
438            thePostsDiv = menuItem.find('.mega-ajax-content');
439
440        wpg_mega_menu_category(menuItem, thePostsDiv);
441    });
442
443    function wpg_mega_menu_category(menuItem, thePostsDiv) {
444        var theCatID = menuItem.attr('data-id'),
445            postsNumber = 5;
446
447        if (theCatID && !menuItem.hasClass('is-loaded')) {
448
449            menuItem.addClass('is-loaded');
450
451            // Cancel the current Ajax request if the user made a new one
452            if (megaMenuAjax && megaMenuAjax.readystate != 4) {
453                megaMenuAjax.abort();
454            }
455
456            // Ajax Call
457            megaMenuAjax = $.ajax({
458                url: wpg.ajaxurl,
459                type: 'post',
460                data: {
461                    action: 'wpg_mega_menu_load_ajax',
462                    id: theCatID,
463                    number: postsNumber,
464                },
465                beforeSend: function(data) {
466                    // Add the loader
467                    if (!thePostsDiv.find('.loader-block').length) {
468
469                        thePostsDiv.addClass('is-loading').append('<div class="loader-show">' + wpg.ajax_loader + '</div>');
470                    }
471                },
472                success: function(data) {
473
474                    var content = '<div class="row loaded-posts">' + data + '</div>';
475
476                    thePostsDiv.append(content);
477
478                    var currentUL = thePostsDiv.find('.post-item');
479
480                    // Animate the loaded items
481                    currentUL.hide().velocity('stop').velocity('transition.slideUpIn', {
482                        stagger: 100,
483                        duration: 500,
484                        complete: function() {
485                            //wpg_animate_element( thePostsDiv );
486                        }
487                    });
488
489                },
490                error: function(data) {
491                    menuItem.removeClass('is-loaded');
492                },
493                complete: function(data) {
494                    thePostsDiv.removeClass('is-loading').find('.loader-show').remove();
495                },
496            });
497        }
498    }
499
500    /* Toggle post content for mobile
501    -------------------------------------------------------*/
502    jQuery(document).on('click', '#toggle-post-button', function() {
503        jQuery('.article-content').toggleClass('is-expanded');
504        jQuery(this).hide();
505        return false;
506    });
507
508    /* Reading Indicator
509    ----------------------------------------------------------*/
510    if (wpg.is_singular_post && wpg.reading_indicator) {
511        var postContent = jQuery('.article-content');
512        if (postContent.length > 0) {
513            postContent.imagesLoaded(function() {
514                var content_height = postContent.height(),
515                    window_height = jQuery(window).height();
516                jQuery(window).scroll(function() {
517                    var percent = 0,
518                        content_offset = postContent.offset().top,
519                        window_offest = jQuery(window).scrollTop();
520
521                    if (window_offest > content_offset) {
522                        percent = 100 * (window_offest - content_offset) / (content_height - window_height);
523                    }
524                    jQuery('#reading-position-indicator').css('width', percent + '%');
525                });
526            });
527        }
528    }
529
530
531    /* Side box / Mobile Menu
532     ---------------------------------------------------------- */
533    var $sidenav = jQuery('.sidenav'),
534        $sidenavIconToggle = jQuery('.sidenav-toggle'),
535        $siteOverlay = jQuery('.site-overlay'),
536        $sidenavCloseButton = jQuery('.sidenav-close');
537
538    $sidenavIconToggle.on('click', function(e) {
539        e.stopPropagation();
540        jQuery(this).toggleClass('sidenav-toggle--is-open');
541        $sidenav.toggleClass('sidenav--is-open');
542        $siteOverlay.toggleClass('site-overlay--is-visible');
543    });
544
545    function resetNav() {
546        $sidenavIconToggle.removeClass('sidenav-toggle--is-open');
547        $sidenav.removeClass('sidenav--is-open');
548        $siteOverlay.removeClass('site-overlay--is-visible');
549    }
550
551    $siteOverlay.on('click', function() {
552        resetNav();
553    });
554
555    $sidenavCloseButton.on('click', function() {
556        resetNav();
557    });
558
559
560    /* Sticky Navigation
561    -------------------------------------------------------*/
562    if (wpg.is_sticky) {
563        var fixed_nav = document.querySelector('.nav-fixed'),
564            fixed_height = jQuery('.nav-fixed').outerHeight(),
565            fixed_from_top = jQuery('body').hasClass('admin-bar') ? jQuery('.nav-fixed').offset().top - 32 : jQuery('.nav-fixed').offset().top;
566
567        var headroom = new Headroom(fixed_nav, {
568            offset: fixed_from_top + fixed_height,
569            tolerance: 0,
570            classes: {
571                pinned: "fixed-nav--pinned",
572                unpinned: "fixed-nav--unpinned",
573                top: "fixed-nav--top",
574                notTop: "fixed-nav--nottop",
575                bottom: "fixed-nav--bottom",
576                notBottom: "fixed-nav--notbottom",
577                initial: "fixed-nav"
578            },
579            onNotTop: function() {
580                jQuery('.mainnav-wrap').wrapInner('<div class="sticky-container container"></div>');
581                megamenu_content_width();
582            },
583            onTop: function() {
584                jQuery('.sticky-container').children().unwrap();
585                megamenu_content_width();
586            },
587        });
588        if (jQuery('.nav-fixed').length > 0 && minWidth(992)) {
589            headroom.init();
590        }
591    }
592
593    /* Archive AJAX Posts
594    -------------------------------------------------------*/
595    /* Infinite Scroll for archives */
596    jQuery('.infinite-scroll-archives').viewportChecker({
597        repeat: true,
598        offset: 60,
599        callbackFunction: function(elem, action) {
600            if (isDuringAjax === false) {
601                isDuringAjax = true;
602                wpg_archive_ajax();
603            }
604        }
605    });
606
607    /*  Load More Button for archives */
608    jQuery(document).on('click', '#load-more-archives', function() {
609        if (isDuringAjax === false) {
610            isDuringAjax = true;
611            wpg_archive_ajax();
612        }
613    });
614
615    function wpg_archive_ajax() {
616        var pagiButton = jQuery('#load-more-archives');
617
618        if (!pagiButton.length) {
619            return false;
620        }
621
622        var theQuery = pagiButton.attr('data-query'),
623            theURL = pagiButton.attr('data-url'),
624            maxPages = pagiButton.attr('data-max'),
625            buttonText = pagiButton.attr('data-text'),
626            currentPage = parseInt(pagiButton.attr('data-page')) + 1,
627            theArchive = jQuery('.posts-archive'),
628            theBlock = theArchive.find('.posts-container'),
629            theBlockList = theBlock.find('.posts-list'),
630            theLayout = theBlock.attr('data-layout'),
631            theSettings = theBlock.attr('data-settings'),
632            displayItem = 'block';
633
634        // Check if the Button Disabled
635        if (pagiButton.hasClass('btn-disabled') || currentPage > maxPages) {
636            return false;
637        }
638
639        // Ajax Call
640        $.ajax({
641            url: wpg.ajaxurl,
642            type: 'post',
643            data: {
644                action: 'wpg_archives_load_more',
645                query: theQuery,
646                max: maxPages,
647                page: currentPage,
648                layout: theLayout,
649                settings: theSettings
650            },
651            beforeSend: function(data) {
652                pagiButton.addClass('pagi-loading');
653            },
654            success: function(data) {
655
656                data = $.parseJSON(data);
657
658                pagiButton.removeClass('pagi-loading');
659
660                // Hide next posts button
661                if (data['hide_next']) {
662                    pagiButton.addClass('btn-disabled');
663                    pagiButton.html(data['button']);
664                } else {
665                    pagiButton.html(buttonText);
666                }
667
668                data = data['code'];
669                data = data.replace(/class="post-item/g, 'class="post-item post-item-' + currentPage + ' ');
670
671                var content = jQuery(data);
672
673                theBlockList.append(content);
674
675                var postsList_item = theBlock.find('.post-item-' + currentPage).hide();
676
677                // Animate the loaded items
678                postsList_item.velocity('stop').velocity('transition.slideUpIn', {
679                    stagger: 100,
680                    duration: 500,
681                    display: displayItem,
682                    complete: function() {
683                        //wpg_animate_element( postsList_item );
684                        //wpg_responsive_video();
685                        isDuringAjax = false;
686                    }
687                });
688
689            }
690        });
691
692        // Change the next page number
693        pagiButton.attr('data-page', currentPage);
694
695        return false;
696    }
697
698
699    /* Block News Ajax Pagination
700    ---------------------------------------------------------- */
701
702    jQuery(document).on('click', '.module-pagi', function() {
703        if (isDuringAjax === false) {
704            isDuringAjax = true;
705            wpg_news_ajax(jQuery(this));
706        }
707    });
708
709    function wpg_news_ajax(pagination) {
710        var theBlock = pagination.closest('.posts-module'),
711            blockID = theBlock.get(0).id,
712            blockTerm = theBlock.attr('data-term'),
713            pageCurrent = theBlock.attr('data-current'),
714            postsCont = theBlock.find('.posts-container'),
715            postsList = theBlock.find('.posts-list'),
716            options = $.extend({}, window['js_' + blockID.replace('wpg-', 'wpg_')]),
717            isLoadMore = false,
718            displayItem = 'block';
719
720        if (pageCurrent && options) {
721
722            if (blockTerm) {
723                if (options['tags']) {
724                    options['tags'] = blockTerm;
725                } else {
726                    options['categories'] = blockTerm;
727                }
728            }
729
730            // Check if the Button Disabled
731            if (pagination.hasClass('btn-disabled')) {
732                return false;
733            }
734
735            // Check if the button type is Load More
736            if (pagination.hasClass('load-more')) {
737                pageCurrent++;
738                isLoadMore = true;
739            }
740
741            // Next page button
742            else if (pagination.hasClass('next-posts')) {
743                pageCurrent++;
744                theBlock.find('.prev-posts').removeClass('btn-disabled');
745            }
746
747            // Prev page button
748            else if (pagination.hasClass('prev-posts')) {
749                pageCurrent--;
750                theBlock.find('.next-posts').removeClass('btn-disabled');
751            }
752
753            // Ajax Call
754            $.ajax({
755                url: wpg.ajaxurl,
756                type: 'post',
757                data: {
758                    action: 'wpg_blocks_load_more',
759                    block: options,
760                    page: pageCurrent
761                },
762                beforeSend: function(data) {
763
764                    pagination.addClass('pagi-loading');
765
766                    // Load More button----------
767                    if (isLoadMore) {
768                        //pagination.addClass('pagi-loading');
769                    }
770
771                    // Other pagination Types
772                    else {
773                        var postsHeight = postsCont.height();
774                        postsCont.append('<div class="loader-show">' + wpg.ajax_loader + '</div>').attr('style', 'min-height:' + postsHeight + 'px');
775                        postsList.addClass('is-loading');
776                    }
777                },
778                success: function(data) {
779
780                    data = $.parseJSON(data);
781
782                    pagination.removeClass('pagi-loading');
783
784                    if (data['hide_next']) {
785                        theBlock.find('.next-posts').addClass('btn-disabled');
786                        if (pagination.hasClass('show-more') || isLoadMore) {
787                            pagination.html(data['button']);
788                        }
789                    }
790
791                    // Hide next posts button
792                    else if (isLoadMore) {
793                        pagination.html(pagination.attr('data-text'));
794                    }
795
796                    // Hide Prev posts button
797                    if (data['hide_prev']) {
798                        theBlock.find('.prev-posts').addClass('btn-disabled');
799                    }
800
801                    // Posts code
802                    data = data['code'];
803
804                    data = data.replace(/class="post-item/g, 'class="post-item post-item-' + pageCurrent + ' ');
805
806                    var content = jQuery(data);
807
808                    // Load More button append the new items
809                    if (isLoadMore) {
810                        postsList.append(content);
811                    }
812
813                    // Other pagination Types
814                    else {
815                        jQuery('.loader-show').remove();
816                        postsList.removeClass('is-loading');
817                        postsList.html(content);
818                    }
819
820                    var postsList_item = theBlock.find('.post-item-' + pageCurrent).hide();
821
822                    // Animate the loaded items
823                    postsList_item.velocity('stop').velocity('transition.slideUpIn', {
824                        stagger: 100,
825                        duration: 500,
826                        complete: function() {
827                            //wpg_animate_element( postsList_item );
828                            //wpg_responsive_video();
829                            postsCont.attr('style', '');
830                            isDuringAjax = false;
831                        }
832                    });
833                }
834            });
835
836            // Change the next page number
837            theBlock.attr('data-current', pageCurrent);
838        }
839        return false;
840    }
841
842
843    /* Blocks Ajax Filters
844    ---------------------------------------------------------- */
845    jQuery(document).on('click', '.module-term', function() {
846        var termButton = jQuery(this),
847            theBlock = termButton.closest('.posts-module'),
848            termID = termButton.attr('data-id'),
849            blockID = theBlock.get(0).id,
850            postsCont = theBlock.find('.posts-container'),
851            postsList = theBlock.find('.posts-list'),
852            options = $.extend({}, window['js_' + blockID.replace('wpg-', 'wpg_')]),
853            displayItem = 'block';
854
855        if (options) {
856            // Set the data attr new values
857            theBlock.attr('data-current', 1);
858
859            if (termID) {
860                if (options['tags']) {
861                    options['tags'] = termID;
862                } else {
863                    options['categories'] = termID;
864                }
865
866                theBlock.attr('data-term', termID);
867            } else {
868                theBlock.removeAttr('data-term');
869            }
870
871            // Ajax Call
872            $.ajax({
873                url: wpg.ajaxurl,
874                type: 'post',
875                data: {
876                    action: 'wpg_blocks_load_more',
877                    block: options,
878                },
879                beforeSend: function(data) {
880                    var postsHeight = postsCont.height();
881                    postsCont.append('<div class="loader-show">' + wpg.ajax_loader + '</div>').attr('style', 'min-height:' + postsHeight + 'px');
882                    postsList.addClass('is-loading');
883                },
884                success: function(data) {
885
886                    data = $.parseJSON(data);
887
888                    // Reset the pagination
889                    theBlock.find('.module-pagi').removeClass('btn-disabled');
890                    var LoadMoreButton = theBlock.find('.show-more');
891                    LoadMoreButton.html(LoadMoreButton.attr('data-text'));
892
893                    // Active the selected term
894                    theBlock.find('.module-term').removeClass('active');
895                    termButton.addClass('active');
896
897                    // Hide next posts button
898                    if (data['hide_next']) {
899                        theBlock.find('.next-posts').addClass('btn-disabled');
900                        theBlock.find('.show-more').html(data['button'])
901                    }
902
903                    // Hide Prev posts button
904                    if (data['hide_prev']) {
905                        theBlock.find('.prev-posts').addClass('btn-disabled');
906                    }
907
908                    // Posts code
909                    data = data['code'];
910
911                    //content = jQuery(data);
912                    jQuery('.loader-show').remove();
913                    postsList.removeClass('is-loading');
914                    postsList.html(jQuery(data));
915
916                    // Animate the loaded items
917                    postsCont.find('.post-item').hide().velocity('stop').velocity('transition.slide
917UpIn', {
918                        stagger: 100,
919                        duration: 500,
920                        complete: function() {
921
922                            postsCont.attr('style', '');
923                        }
924                    });
925                }
926            });
927        }
928        return false;
929    });
930
931    /* Menu Ajax Filters
932    ---------------------------------------------------------- */
933    var megaMenuAjax = false;
934
935    jQuery(document).on('mouseenter', '.mega-cat-posts', function() {
936        var menuItem = jQuery(this),
937            thePostsDiv = menuItem.find('.mega-ajax-content');
938
939        wpg_mega_menu_category(menuItem, thePostsDiv);
940    });
941
942    function wpg_mega_menu_category(menuItem, thePostsDiv) {
943        var theCatID = menuItem.attr('data-id'),
944            postsNumber = 4;
945
946        if (theCatID && !menuItem.hasClass('is-loaded')) {
947
948            menuItem.addClass('is-loaded');
949
950            // Cancel the current Ajax request if the user made a new one
951            if (megaMenuAjax && megaMenuAjax.readystate != 4) {
952                megaMenuAjax.abort();
953            }
954
955            // Ajax Call
956            megaMenuAjax = $.ajax({
957                url: wpg.ajaxurl,
958                type: 'post',
959                data: {
960                    action: 'wpg_mega_menu_load_ajax',
961                    id: theCatID,
962                    number: postsNumber,
963                },
964                beforeSend: function(data) {
965                    // Add the loader
966                    if (!thePostsDiv.find('.loader-block').length) {
967
968                        thePostsDiv.addClass('is-loading').append('<div class="loader-show">' + wpg.ajax_loader + '</div>');
969                    }
970                },
971                success: function(data) {
972
973                    var content = '<div class="row loaded-posts">' + data + '</div>';
974
975                    thePostsDiv.append(content);
976
977                    var currentUL = thePostsDiv.find('.post-item');
978
979                    // Animate the loaded items
980                    currentUL.hide().velocity('stop').velocity('transition.slideUpIn', {
981                        stagger: 100,
982                        duration: 500,
983                        complete: function() {
984                            //wpg_animate_element( thePostsDiv );
985                        }
986                    });
987
988                },
989                error: function(data) {
990                    menuItem.removeClass('is-loaded');
991                },
992                complete: function(data) {
993                    thePostsDiv.removeClass('is-loading').find('.loader-show').remove();
994                },
995            });
996        }
997    }
998
999    /* Slick Slider
1000    ---------------------------------------------------------- */
1001
1002    jQuery(".wpg-slider").each(function() {
1003        var this_element = jQuery(this),
1004            slick_config = {},
1005            v_slidesToShow = jQuery(this).attr("data-slidesToShow"),
1006            v_slidesToScroll = jQuery(this).attr("data-slidesToScroll"),
1007            v_responsive = jQuery(this).attr("data-vresponsive"),
1008            v_deviceXXSmall = jQuery(this).attr("data-devicexxsmall"),
1009            v_deviceXSmall = jQuery(this).attr("data-devicexsmall"),
1010            v_deviceSmall = jQuery(this).attr("data-devicesmall"),
1011            v_deviceMedium = jQuery(this).attr("data-devicemedium"),
1012            v_infinite = jQuery(this).attr("data-infinite"),
1013            v_adaptiveHeight = jQuery(this).attr("data-adaptive_height"),
1014            v_speed = jQuery(this).attr("data-speed"),
1015            v_autoplay = jQuery(this).attr("data-autoplay"),
1016            v_autoplaySpeed = parseInt(jQuery(this).attr("data-autoplaySpeed")),
1017            v_fade = jQuery(this).attr("data-fade"),
1018            v_arrows = jQuery(this).attr("data-arrows"),
1019            v_prevArrow = jQuery(this).attr("data-prevArrow"),
1020            v_nextArrow = jQuery(this).attr("data-nextArrow"),
1021            v_dots = jQuery(this).attr("data-dots");
1022
1023        if (typeof v_slidesToShow !== "undefined" && v_slidesToShow !== false && v_slidesToShow !== 0) {
1024            slick_config["slidesToShow"] = parseInt(v_slidesToShow);
1025        }
1026        if (typeof v_slidesToScroll !== "undefined" && v_slidesToScroll !== false && v_slidesToScroll !== 0) {
1027            slick_config["slidesToScroll"] = parseInt(v_slidesToScroll);
1028        }
1029        if (typeof v_responsive !== "undefined" && v_responsive !== false && v_responsive === "yes") {
1030            slick_config["responsive"] = [{
1031                    breakpoint: 1200,
1032                    settings: {
1033                        slidesToShow: parseInt(v_deviceMedium)
1034                    }
1035                },
1036                {
1037                    breakpoint: 992,
1038                    settings: {
1039                        slidesToShow: parseInt(v_deviceSmall)
1040                    }
1041                },
1042                {
1043                    breakpoint: 768,
1044                    settings: {
1045                        slidesToShow: parseInt(v_deviceXSmall)
1046                    }
1047                },
1048                {
1049                    breakpoint: 480,
1050                    settings: {
1051                        slidesToShow: parseInt(v_deviceXXSmall)
1052                    }
1053                }
1054            ];
1055        }
1056        if (typeof v_infinite !== "undefined" && v_infinite !== false && v_adaptiveHeight === "yes") {
1057            slick_config["infinite"] = true;
1058        }
1059        if (typeof v_adaptiveHeight !== "undefined" && v_adaptiveHeight !== false && v_adaptiveHeight === "yes") {
1060            slick_config["adaptiveHeight"] = true;
1061        }
1062        if (typeof v_speed !== "undefined" && v_speed !== false && v_speed !== 0) {
1063            slick_config["speed"] = parseInt(v_speed);
1064        }
1065        if (typeof v_autoplay !== "undefined" && v_autoplay !== false && v_autoplay === "yes") {
1066            slick_config["autoplay"] = true;
1067            if (typeof v_autoplaySpeed !== "undefined" && v_autoplaySpeed !== false && v_autoplaySpeed !== 0) {
1068                slick_config["autoplaySpeed"] = v_autoplaySpeed;
1069            }
1070        }
1071        if (typeof v_dots !== "undefined" && v_dots !== false && v_dots === "yes") {
1072            slick_config['dots'] = true;
1073        }
1074        if (typeof v_fade !== "undefined" && v_fade !== false && v_fade === "yes") {
1075            slick_config["fade"] = true;
1076            slick_config["cssEase"] = 'linear';
1077        }
1078        if (v_arrows === "yes") {
1079            slick_config["arrows"] = true;
1080            slick_config["prevArrow"] = '<button type="button" class="slick-prev"></button>';
1081            slick_config["nextArrow"] = '<button type="button" class="slick-next"></button>';
1082        } else {
1083            slick_config["arrows"] = false;
1084        }
1085        if (wpg.is_rtl) {
1086            slick_config["rtl"] = true;
1087        }
1088        if (wpg.is_lazy) {
1089            slick_config['lazyLoad'] = 'ondemand';
1090        }
1091
1092        this_element.slick(slick_config);
1093
1094        if (wpg.is_lazy) {
1095            this_element.on('lazyLoaded', function(e, slick, image, imageSource) {
1096                image.attr('src', '');
1097                var slideBg = image.next('.lazy-slide');
1098                slideBg.animate({
1099                    opacity: 0
1100                }, 100, function() {
1101                    slideBg.css('background-image', 'url("' + imageSource + '")').animate({
1102                        opacity: 1
1103                    }, 200);
1104                });
1105            });
1106
1107            this_element.on('beforeChange', function(event, slick, currentSlide, nextSlide) {
1108                this_element.find('.lazy-img').lazy({
1109                    bind: "event",
1110                    delay: 0
1111                });
1112            });
1113        }
1114    });
1115
1116})(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.