PageSourceSearch

https://www.radioskw.de/wp-content/plugins/the-post-grid-pro/assets/js/rttpg.js?ver=7.9.5

js radioskw.de collected 2026-10-02 14:39:07 UTC 54,637 bytes, 1,200 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    if ($('.tpg-shortcode-main-wrapper').length < 1) {
5        return;
6    }
7
8    window.tpgFixLazyLoad = function () {
9        $('.tpg-shortcode-main-wrapper').each(function () {
10            // jetpack Lazy load
11            $(this).find('img.jetpack-lazy-image:not(.jetpack-lazy-image--handled)').each(function () {
12                $(this).addClass('jetpack-lazy-image--handled').removeAttr('srcset').removeAttr('data-lazy-src').attr('data-lazy-loaded', 1);
13            });
14            //
15            $(this).find('img.lazyload').each(function () {
16                var src = $(this).attr('data-src') || '';
17                if (src) {
18                    $(this).attr('src', src).removeClass('lazyload').addClass('lazyloaded');
19                }
20            });
21        });
22    };
23    window.initTpg = function () {
24        $('.tpg-shortcode-main-wrapper').each(function () {
25            var container = $(this),
26                str = $(this).attr("data-layout"),
27                gridStyle = $(this).attr("data-grid-style"),
28                id = $.trim(container.attr('id')),
29                scID = $.trim(container.attr("data-sc-id")),
30                $default_order_by = $('.rt-order-by-action .order-by-default', container),
31                $default_order = $('.rt-sort-order-action .rt-sort-order-action-arrow', container),
32                $taxonomy_filter = $('.rt-filter-item-wrap.rt-tax-filter', container),
33                author_filter = $('.rt-filter-item-wrap.rt-author-filter', container),
34                $pagination_wrap = $('.rt-pagination-wrap', container),
35                $loadmore = $('.rt-loadmore-action', container),
36                $infinite = $('.rt-infinite-action', container),
37                $page_prev_next = $('.rt-cb-page-prev-next', container),
38                $page_numbers = $('.rt-page-numbers', container),
39                html_loading = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>',
40                preLoader = container.find('.tpg-pre-loader'),
41                loader = container.find(".rt-content-loader"),
42                filter_container = $(".rt-layout-filter-container", container),
43                contentLoader = container.children(".rt-row.rt-content-loader"),
44                search_wrap = container.find(".rt-search-filter-wrap"),
45                tpg_order = '',
46                tpg_order_by = '',
47                tpg_taxonomy = '',
48                tpg_author = '',
49                tpg_term = '',
50                tpg_search = '',
51                tpg_paged = 1,
52                temp_total_pages = parseInt($pagination_wrap.attr('data-total-pages'), 10),
53                tpg_total_pages = typeof (temp_total_pages) != 'undefined' && temp_total_pages != '' ? temp_total_pages : 1,
54                temp_posts_per_page = parseInt($pagination_wrap.attr('data-posts-per-page'), 10),
55                tpg_posta_per_page = typeof (temp_posts_per_page) != 'undefined' && temp_posts_per_page != '' ? temp_posts_per_page : 3,
56                infinite_status = 0,
57                paramsRequest = {},
58                mIsotopWrap = '',
59                IsotopeWrap = '',
60                isMasonary = $('.rt-row.rt-content-loader.tpg-masonry', container),
61                isIsotop = $(".rt-tpg-isotope", container),
62                IsoButton = $(".rt-tpg-isotope-buttons", container),
63                IsoDropdownFilter = $("select.isotope-dropdown-filter", container),
64                isCarousel = $('.rt-swiper-holder', container),
65                placeholder_loading = function () {
66                    if (loader.find('.rt-loading-overlay').length == 0) {
67                        loader.addClass('tpg-pre-loader');
68                        loader.append(html_loading);
69                    }
70                },
71                remove_placeholder_loading = function () {
72                    loader.find('.rt-loading-overlay, .rt-loading').remove();
73                    loader.removeClass('tpg-pre-loader');
74                    $loadmore.removeClass('rt-lm-loading');
75                    $page_numbers.removeClass('rt-lm-loading');
76                    $infinite.removeClass('rt-active-elm');
77                    search_wrap.find('input').prop("disabled", false);
78                },
79                check_query = function () {
80                    if ($taxonomy_filter.length > 0) {
81                        tpg_taxonomy = $taxonomy_filter.attr('data-taxonomy');
82                        var term;
83                        if ($taxonomy_filter.hasClass('rt-filter-button-wrap')) {
84                            term = $("> .sub-button-group .rt-filter-button-item.selected", filter_container).attr('data-term');
85                            if (term === undefined) {
86                                term = $taxonomy_filter.find('.rt-filter-button-item.selected').attr('data-term');
87                            }
88                        } else {
89                            term = $(".rt-filter-wrap > .sub-dropdown-wrap.rt-filter-dropdown-wrap .term-default", filter_container).attr('data-term');
90                            if (term === undefined) {
91                                term = $(".parent-dropdown-wrap.rt-filter-dropdown-wrap .term-default", filter_container).attr('data-term');
92                            }
93                        }
94                        if (typeof (term) != 'undefined' && term != '') {
95                            tpg_term = term;
96                        }
97                    }
98                    if (author_filter.length > 0) {
99                        var author = '';
100                        if (author_filter.hasClass('rt-filter-button-wrap')) {
101                            author = author_filter.find('.rt-filter-button-item.selected').attr('data-author') || '';
102                        } else {
103                            author = $(".rt-filter-dropdown-default.term-default", author_filter).attr('data-term') || '';
104                        }
105                        if (author && author !== '') {
106                            tpg_author = author;
107                        }
108                    }
109
110                    if ($default_order_by.length > 0) {
111                        var order_by_param = $default_order_by.attr('data-order-by');
112                        if (typeof (order_by_param) != 'undefined' && order_by_param != '' && (order_by_param.toLowerCase())) {
113                            tpg_order_by = order_by_param;
114                        }
115                    }
116
117                    if ($default_order.length > 0) {
118                        var order_param = $default_order.attr('data-sort-order');
119                        if (typeof (order_param) != 'undefined' && order_param != '' && (order_param == 'DESC' || order_param == 'ASC')) {
120                            tpg_order = order_param;
121                        }
122                    }
123                    if (search_wrap.length > 0) {
124                        tpg_search = $.trim(search_wrap.find('input').val());
125                    }
126                    var archive = container.data('archive') || '',
127                        archive_value = container.data('archive-value') || '';
128
129                    paramsRequest = {
130                        'scID': scID,
131                        'order': tpg_order,
132                        'order_by': tpg_order_by,
133                        'taxonomy': tpg_taxonomy,
134                        'author': tpg_author,
135                        'term': tpg_term,
136                        'paged': tpg_paged,
137                        'action': 'tpgLayoutAjaxAction',
138                        'search': tpg_search,
139                        'archive': archive,
140                        'archive_value': archive_value,
141                        'rttpg_nonce': rttpg.nonce
142                    };
143                },
144                infinite_scroll = function () {
145                    if (infinite_status == 1 || $infinite.hasClass('rt-hidden-elm') || $pagination_wrap.length == 0) {
146                        return;
147                    }
148                    var ajaxVisible = $pagination_wrap.offset().top,
149                        ajaxScrollTop = $(window).scrollTop() + $(window).height();
150
151                    if (ajaxVisible <= (ajaxScrollTop) && (ajaxVisible + $(window).height()) > ajaxScrollTop) {
152                        infinite_status = 1; //stop inifite scroll
153                        tpg_paged = tpg_paged + 1;
154                        $infinite.addClass('rt-active-elm');
155                        ajax_action(true, true);
156                    }
157                },
158                generateData = function (number) {
159                    var result = [];
160                    for (var i = 1; i < number + 1; i++) {
161                        result.push(i);
162                    }
163                    return result;
164                },
165                createPagination = function () {
166                    if ($page_numbers.length > 0) {
167                        $page_numbers.pagination({
168                            dataSource: generateData(tpg_total_pages * parseFloat(tpg_posta_per_page)),
169                            pageSize: parseFloat(tpg_posta_per_page),
170                            autoHidePrevious: true,
171                            autoHideNext: true,
172                            prevText: '<i class="fa fa-angle-double-left" aria-hidden="true"></i>',
173                            nextText: '<i class="fa fa-angle-double-right" aria-hidden="true"></i>'
174                        });
175                        $page_numbers.addHook('beforePaging', function (pagination) {
176                            infinite_status = 1;
177                            tpg_paged = pagination;
178                            $page_numbers.addClass('rt-lm-loading');
179                            $page_numbers.pagination('disable');
180                            ajax_action(true, false);
181                        });
182                        if (tpg_total_pages <= 1) {
183                            $page_numbers.addClass('rt-hidden-elm');
184                        } else {
185                            $page_numbers.removeClass('rt-hidden-elm');
186                        }
187                    }
188                },
189                load_gallery_image_popup = function () {
190                    container.find('.rt-row.layout17').each(function () {
191                        var self = $(this);
192                        self.magnificPopup({
193                            delegate: 'a.tpg-zoom',
194                            type: 'image',
195                            gallery: {
196                                enabled: true
197                            }
198                        });
199                    });
200
201                },
202                animateAction = function () {
203                    var $postItem = $('.rt-grid-item:not(.rt-ready-animation, .isotope-item)', container);
204                    // $postItem.addClass('rt-ready-animation animated fadeIn');
205                },
206                ajax_action = function (page_request, append) {
207                    page_request = page_request || false;
208                    append = append || false;
209                    if (!page_request) {
210                        tpg_paged = 1;
211                    }
212                    check_query();
213                    if (page_request === true && tpg_total_pages > 1 && paramsRequest.paged > tpg_total_pages) {
214                        remove_placeholder_loading();
215                        return;
216                    }
217                    $.ajax({
218                        url: rttpg.ajaxurl,
219                        type: 'POST',
220                        data: paramsRequest,
221                        cache: false,
222                        beforeSend: function () {
223                            placeholder_loading();
224                        },
225                        success: function (data) {
226                            if (!data.error) {
227                                tpg_paged = data.paged;
228                                tpg_total_pages = data.total_pages;
229                                if (data.paged >= tpg_total_pages) {
230                                    if ($loadmore.length) {
231                                        $loadmore.addClass('rt-hidden-elm');
232                                    }
233                                    if ($infinite.length) {
234                                        infinite_status = 1;
235                                        $infinite.addClass('rt-hidden-elm');
236                                    }
237                                    if ($page_prev_next.length) {
238                                        if (!page_request) {
239                                            $page_prev_next.addClass('rt-hidden-elm');
240                                        } else {
241                                            $page_prev_next.find('.rt-cb-prev-btn').removeClass('rt-disabled');
242                                            $page_prev_next.find('.rt-cb-next-btn').addClass('rt-disabled');
243                                        }
244                                    }
245                                } else {
246                                    if ($loadmore.length) {
247                                        $loadmore.removeClass('rt-hidden-elm');
248                                    }
249                                    if ($infinite.length) {
250                                        infinite_status = 0;
251                                        $infinite.removeClass('rt-hidden-elm');
252                                    }
253                                    if ($page_prev_next.length) {
254                                        if (!page_request) {
255                                            $page_prev_next.removeClass('rt-hidden-elm');
256                                        } else {
257                                            if (data.paged == 1) {
258                                                $page_prev_next.find('.rt-cb-prev-btn').addClass('rt-disabled');
259                                                $page_prev_next.find('.rt-cb-next-btn').removeClass('rt-disabled');
260                                            } else {
261                                                $page_prev_next.find('.rt-cb-prev-btn').removeClass('rt-disabled');
262                                                $page_prev_next.find('.rt-cb-next-btn').removeClass('rt-disabled');
263                                            }
264                                        }
265                                    }
266                                }
267                                if (append) {
268                                    if (isIsotop.length) {
269                                        IsotopeWrap.append(data.data)
270                                            .isotope('appended', data.data)
271                                            .isotope('reloadItems')
272                                            .isotope('updateSortData')
273                                            .isotope();
274                                        container.trigger('tpg_item_before_load');
275                                        tpgFixLazyLoad();
276                                        IsotopeWrap.imagesLoaded(function () {
277                                            preFunction();
278                                            IsotopeWrap.isotope();
279                                            container.trigger('tpg_item_after_load');
280                                        });
281                                        if (IsoButton.attr('data-count')) {
282                                            isoFilterCounter(container, IsotopeWrap);
283                                        }
284                                    } else if (isMasonary.length) {
285                                        container.trigger('tpg_item_before_load');
286                                        tpgFixLazyLoad();
287                                        mIsotopWrap.append(data.data).isotope('appended', data.data).isotope('updateSortData').isotope('reloadItems');
288                                        mIsotopWrap.imagesLoaded(function () {
289                                            mIsotopWrap.isotope();
290                                            container.trigger('tpg_item_after_load');
291                                        });
292                                    } else {
293                       
293                 contentLoader.append(data.data);
294                                        container.trigger('tpg_item_before_load');
295                                        container.trigger('tpg_item_after_load');
296                                    }
297                                } else {
298                                    if (isMasonary.length) {
299                                        mIsotopWrap.html(data.data).isotope('appended', data.data).isotope('reloadItems');
300                                        container.trigger('tpg_item_before_load');
301                                        tpgFixLazyLoad();
302                                        mIsotopWrap.imagesLoaded(function () {
303                                            mIsotopWrap.isotope();
304                                            container.trigger('tpg_item_after_load');
305                                        });
306                                    } else {
307                                        contentLoader.html(data.data);
308                                        container.trigger('tpg_item_before_load');
309                                        container.trigger('tpg_item_after_load');
310                                    }
311                                }
312                                contentLoader.imagesLoaded(function () {
313                                    preFunction();
314                                    remove_placeholder_loading();
315                                    load_gallery_image_popup();
316                                });
317                                if (!page_request) {
318                                    createPagination();
319                                }
320                                animateAction();
321                            } else {
322                                remove_placeholder_loading();
323                            }
324
325                            $(".tpg-shortcode-main-wrapper a.disabled").each(function () {
326                                $(this).prop("disabled", true);
327                                $(this).removeAttr("href");
328                            });
329                        },
330                        error: function (error) {
331                            remove_placeholder_loading();
332                        }
333                    });
334                    if ($('.paginationjs-pages .paginationjs-page', $page_numbers).length > 0) {
335                        $page_numbers.pagination('enable');
336                    }
337                },
338                subTax = function (self) {
339                    var subList = $(".rt-filter-sub-tax", self).clone();
340                    subList.on('click', '.rt-filter-button-item', function () {
341                        $(this).parents('.rt-filter-sub-tax').find('.rt-filter-button-item').removeClass('selected');
342                        $(this).addClass('selected');
343                        ajax_action();
344                    });
345                    if (subList !== undefined) {
346                        filter_container.append(subList);
347                    }
348                };
349
350            switch ($pagination_wrap.attr('data-type')) {
351                case 'load_more':
352                    $loadmore.on('click', function () {
353                        $(this).addClass('rt-lm-loading');
354                        tpg_paged = tpg_paged + 1;
355                        ajax_action(true, true);
356                    });
357                    break;
358                case 'pagination_ajax':
359                    createPagination();
360                    break;
361                case 'pagination':
362                    break;
363                case 'load_on_scroll':
364                    $(window).on('scroll load', function () {
365                        infinite_scroll();
366                    });
367                    break;
368                case 'page_prev_next':
369                    if (tpg_paged == 1) {
370                        $page_prev_next.find('.rt-cb-prev-btn').addClass('rt-disabled');
371                    }
372                    if (tpg_paged == tpg_total_pages) {
373                        $page_prev_next.find('.rt-cb-next-btn').addClass('rt-disabled');
374                    }
375                    if (tpg_total_pages == 1) {
376                        $page_prev_next.addClass('rt-hidden-elm');
377                    }
378                    break;
379            }
380
381            if (str) {
382                var qsRegex,
383                    buttonFilter;
384                if (preLoader.find('.rt-loading-overlay').length == 0) {
385                    preLoader.append(html_loading);
386                }
387
388                if (isCarousel.length) {
389                    isCarousel.imagesLoaded(function () {
390                        if (typeof Swiper == 'undefined') {
391                            return;
392                        }
393
394                        $(".rt-swiper-holder").each(function () {
395
396                            var rtSwiperSlider = $(this).get(0),
397                                prevButton = $(this).parent().children().find(".swiper-button-prev").get(0),
398                                nextButton = $(this).parent().children().find(".swiper-button-next").get(0),
399                                dotPagination = $(this).parent().find(".swiper-pagination").get(0),
400                                dItem = parseInt(container.attr('data-desktop-col'), 10),
401                                tItem = parseInt(container.attr('data-tab-col'), 10),
402                                mItem = parseInt(container.attr('data-mobile-col'), 10),
403                                options = isCarousel.data('rtowl-options'),
404                                rtSwiperData = {
405                                    slidesPerView: mItem ? mItem : 1,
406                                    spaceBetween: 24,
407                                    loop: options.loop,
408                                    // slideToClickedSlide: true,
409                                    lazy: options.lazy,
410                                    speed: options.speed,
411                                    autoHeight: options.autoHeight,
412
413                                    breakpoints: {
414                                        0: {
415                                            slidesPerView: mItem ? mItem : 1,
416                                        },
417                                        768: {
418                                            slidesPerView: tItem ? tItem : 2,
419                                        },
420                                        992: {
421                                            slidesPerView: dItem ? dItem : 3,
422                                        },
423                                    }
424                                };
425
426
427                            if (options.autoPlay) {
428                                Object.assign(rtSwiperData, {
429                                    autoplay: {
430                                        delay: options.autoPlayTimeOut,
431                                    }
432                                });
433                            }
434                            if (options.nav) {
435                                Object.assign(rtSwiperData, {
436                                    navigation: {
437                                        nextEl: nextButton,
438                                        prevEl: prevButton,
439                                    }
440                                });
441                            }
442                            if (options.dots) {
443                                Object.assign(rtSwiperData, {
444                                    pagination: {
445                                        el: dotPagination,
446                                        clickable: true,
447                                        dynamicBullets: true,
448                                    }
449                                });
450                            }
451
452                            new Swiper(rtSwiperSlider, rtSwiperData);
453                            remove_placeholder_loading();
454                        });
455
456                    });
457                } else if (isIsotop.length) {
458                    var IsoURL = IsoButton.attr('data-url'),
459                        IsoCount = IsoButton.attr('data-count');
460
461                    if (!buttonFilter) {
462                        if (IsoButton.length) {
463                            buttonFilter = IsoButton.find('button.selected').data('filter');
464                        } else if (IsoDropdownFilter.length) {
465                            IsoURL = IsoDropdownFilter.attr('data-url');
466                            buttonFilter = IsoDropdownFilter.val();
467                        }
468                    }
469
470                    container.trigger('tpg_item_before_load');
471                    tpgFixLazyLoad();
472                    IsotopeWrap = isIsotop.imagesLoaded(function () {
473                        preFunction();
474                        IsotopeWrap.isotope({
475                            itemSelector: '.isotope-item',
476                            masonry: {columnWidth: '.isotope-item'},
477                            layoutMode: gridStyle === 'even' ? 'fitRows' : 'masonry',
478                            filter: function () {
479                                var $this = $(this);
480                                var searchResult = qsRegex ? $this.text().match(qsRegex) : true;
481                                var buttonResult = buttonFilter ? $this.is(buttonFilter) : true;
482                                return searchResult && buttonResult;
483                            }
484                        });
485                        setTimeout(function () {
486                            IsotopeWrap.isotope();
487                            container.trigger('tpg_item_after_load');
488                            remove_placeholder_loading();
489                        }, 100);
490                    });
491
492                    IsotopeWrap.on('arrangeComplete', function (event, filteredItems) {
493                        if ($(".isotope-item", IsotopeWrap).is(":visible")) {
494                            IsotopeWrap.parent().find('.isotope-term-no-post p').hide();
495                        } else {
496                            IsotopeWrap.parent().find('.isotope-term-no-post p').show();
497                        }
498                    });
499
500                    // use value of search field to filter
501                    var $quicksearch = container.find('.iso-search-input').keyup(debounce(function () {
502                        qsRegex = new RegExp($quicksearch.val(), 'gi');
503                        IsotopeWrap.isotope();
504                    }));
505
506
507                    if (IsoDropdownFilter.length) {
508
509                        //Dropdown Filter on change
510                        IsoDropdownFilter.on('change', function (e) {
511                            e.preventDefault();
512                            buttonFilter = $(this).val();
513                            if (IsoURL) {
514                                location.hash = "filter=" + encodeURIComponent(buttonFilter);
515                            } else {
516                                IsotopeWrap.isotope();
517                                // $(this).parent().find('.selected').removeClass('selected');
518                                // $(this).addClass('selected');
519                            }
520
521                        })
522
523                        if (IsoURL) {
524                            $(document).ready(function () {
525                                setTimeout(function () {
526                                    windowDropdownHashChange(IsotopeWrap, IsoDropdownFilter);
527                                }, 500)
528                            });
529                            $(window).on("change", IsoDropdownFilter, function () {
530                                windowDropdownHashChange(IsotopeWrap, IsoDropdownFilter);
531                            });
532                        }
533
534                    } else {
535                        //Button Filter onchage
536                        IsoButton.on('click touchstart', 'button', function (e) {
537                            e.preventDefault();
538                            buttonFilter = $(this).attr('data-filter');
539                            if (IsoURL) {
540                                location.hash = "filter=" + encodeURIComponent(buttonFilter);
541                            } else {
542                                IsotopeWrap.isotope();
543                                $(this).parent().find('.selected').removeClass('selected');
544                                $(this).addClass('selected');
545                            }
546                        });
547
548                        if (IsoURL) {
549                            $(document).ready(function () {
550                                setTimeout(function () {
551                                    windowHashChange(IsotopeWrap, IsoButton);
552                                }, 400)
553                            });
554
555                            $(window).on("hashchange", function () {
556                                windowHashChange(IsotopeWrap, IsoButton);
557                            });
558                        }
559                    }
560
561
562                    if (IsoCount) {
563                        isoFilterCounter(container, IsotopeWrap);
564                    }
565                    IsoDropdownFilter.on('change', function (e) {
566                        e.preventDefault();
567                        buttonFilter = $(this).val();
568                        IsotopeWrap.isotope();
569                    });
570                } else if (container.find('.rt-row.rt-content-loader.tpg-masonry').length) {
571                    var masonryTarget = $('.rt-row.rt-content-loader.tpg-masonry', container);
572                    container.trigger('tpg_item_before_load');
573                    tpgFixLazyLoad();
574                    mIsotopWrap = masonryTarget.imagesLoaded(function () {
575                        preFunction();
576                        mIsotopWrap.isotope({
577                            itemSelector: '.masonry-grid-item',
578                            masonry: {columnWidth: '.masonry-grid-item'}
579                        });
580                        container.trigger('tpg_item_after_load');
581                        remove_placeholder_loading();
582                    });
583                }
584                animateAction();
585            }
586
587            $('#' + id).on('click', '.rt-search-filter-wrap .rt-action', function (e) {
588                search_wrap.find('input').prop("disabled", true);
589                ajax_action();
590            });
591            $('#' + id).on('keypress', '.rt-search-filter-wrap .rt-search-input', function (e) {
592                if (e.which == 13) {
593                    search_wrap.find('input').prop("disabled", true);
594                    ajax_action();
595                }
596            });
597            $('#' + id).on('click', '.rt-filter-dropdown-wrap', function (event) {
598                var self = $(this);
599                self.toggleClass('active-dropdown');
600            });// Dropdown click
601
602            $('#' + id).on('click', '.term-dropdown-item', function (event) {
603                $loadmore.addClass('rt-lm-loading');
604                var $this_item = $(this),
605                    dropDownWrap = $this_item.parents('.rt-filter-dropdown-wrap'),
606                    dropDown = $this_item.parent('.rt-filter-dropdown'),
607                    default_target = dropDownWrap.find('>.rt-filter-dropdown-default'),
608                    subTerms = $(".sub-dropdown-wrap", $this_item).clone();
609                dropDownWrap.removeClass('active-dropdown');
610                dropDownWrap.toggleClass('active-dropdown');
611                default_target.attr('data-term', $this_item.attr('data-term'));
612                default_target.find('>.rt-text').html($this_item.find('>.rt-text').html());
613                dropDown.find('.rt-filter-dropdown-item').removeClass('selected');
614                $this_item.addClass('selected');
615                if (dropDownWrap.data('taxonomy')) {
616                    $this_item.parents('.rt-filter-wrap').find('>.sub-dropdown-wrap').remove();
617                }
618                if (subTerms.length) {
619                    subTerms.insertAfter(dropDownWrap);
620                }
621                ajax_action();
622            });//term
623
624            $('#' + id).on('click', '.order-by-dropdown-item', function (event) {
625                $loadmore.addClass('rt-lm-loading');
626                var $this_item = $(this),
627                    old_param = $default_order_by.attr('data-order-by'),
628                    old_text = $default_order_by.find('.rt-text-order-by').html();
629
630                $this_item.parents('.rt-order-by-action').removeClass('active-dropdown');
631                $this_item.parents('.rt-order-by-action').toggleClass('active-dropdown');
632                $default_order_by.attr('data-order-by', $this_item.attr('data-order-by'));
633                $default_order_by.find('.rt-text-order-by').html($this_item.html());
634                $this_item.attr('data-order-by', old_param);
635                $this_item.html(old_text);
636                ajax_action();
637            });//Order By
638
639            //Sort Order
640            $('#' + id).on('click', '.rt-sort-order-action', function (event) {
641                $loadmore.addClass('rt-lm-loading');
642                var $this_item = $(this),
643                    $sort_order_elm = $('.rt-sort-order-action-arrow', $this_item),
644                    sort_order_param = $sort_order_elm.attr('data-sort-order');
645                if (typeof (sort_order_param) != 'undefined' && sort_order_param.toLowerCase() == 'desc') {
646                    $default_order.attr('data-sort-order', 'ASC');
647                } else {
648                    $default_order.attr('data-sort-order', 'DESC');
649                }
650                ajax_action();
651            });//Sort Order
652
653            $taxonomy_filter.on('click', '.rt-filter-button-item', function () {
654                var self = $(this);
655                self.parents('.rt-filter-button-wrap').find('.rt-filter-button-item').removeClass('selected');
656                self.addClass('selected');
657                $("> .rt-filter-sub-tax", filter_container).remove();
658                subTax(self);
659                ajax_action();
660            });
661
662            author_filter.on('click', '.rt-filter-button-item', function () {
663                var self = $(this);
664                self.parents('.rt-filter-button-wrap').find('.rt-filter-button-item').removeClass('selected');
665                self.addClass('selected');
666                ajax_action();
667            });
668
669            $page_prev_next.on('click', '.rt-cb-prev-btn', function (event) {
670                if (tpg_paged <= 1) {
671                    return;
672                }
673                tpg_paged = tpg_paged - 1;
674                ajax_action(true, false);
675            });
676            $page_prev_next.on('click', '.rt-cb-next-btn', function (event) {
677                if (tpg_paged >= tpg_total_pages) {
678                    return;
679                }
680                tpg_paged = tpg_paged + 1;
681                ajax_action(true, false);
682            });
683            load_gallery_image_popup();
684            container.trigger("tpg_loaded");
685        });
686    };
687
688    // initTpg();
689
690    setTimeout(initTpg, 500);
691
692    $(window).on('load resize', function () {
693        tpgBottomScriptLoader()
694        var win = $(this);
695        if (win.width() >= 992) {
696            overlayIconResizeTpg();
697            mdPopUpResize();
698            rtAlertPosition();
699        }
700    });
701
702    function tpgBottomScriptLoader() {
703        $(".bottom-script-loader").fadeOut(500, function () {
704            // fadeOut complete. Remove the loading div
705            $(".bottom-script-loader").remove(); //makes page more lightweight
706        });
707    }
708
709    $(document).on({
710        mouseenter: function () {
711            var $this = $(this);
712            var $parent = $(this).parents('.tpg-shortcode-main-wrapper');
713            var id = $parent.attr('id').replace("rt-tpg-container-", "");
714            var $title = $this.attr('title');
715            $tooltip = '<div class="rt-tooltip" id="rt-tooltip-' 
715+ id + '">' +
716                '<div class="rt-tooltip-content">' + $title + '</div>' +
717                '<div class="rt-tooltip-bottom"></div>' +
718                '</div>';
719            $('body').append($tooltip);
720            var $tooltip = $('body > .rt-tooltip');
721            var tHeight = $tooltip.outerHeight();
722            var tBottomHeight = $tooltip.find('.rt-tooltip-bottom').outerHeight();
723            var tWidth = $tooltip.outerWidth();
724            var tHolderWidth = $this.outerWidth();
725            var top = $this.offset().top - (tHeight + tBottomHeight) + 14;
726            var left = $this.offset().left;
727            $tooltip.css('top', top + 'px');
728            $tooltip.css('left', left + 'px');
729            $tooltip.css('opacity', 1);
730            $tooltip.show();
731            if (tWidth <= tHolderWidth) {
732                var itemLeft = (tHolderWidth - tWidth) / 2;
733                left = left + itemLeft;
734                $tooltip.css('left', left + 'px');
735            } else {
736                var itemLeft = (tWidth - tHolderWidth) / 2;
737                left = left - itemLeft;
738                if (left < 0) {
739                    left = 0;
740                }
741                $tooltip.css('left', left + 'px');
742            }
743        },
744        mouseleave: function () {
745            $('body > .rt-tooltip').remove();
746        }
747    }, '.rt-tpg-social-share a');
748
749    $('.rt-wc-add-to-cart').on('click', function (e) {
750        e.preventDefault();
751        var $pType = $(this).data('type'),
752            $pID = $(this).data('id'),
753            self = $(this);
754        if (rttpg.woocommerce_enable_ajax_add_to_cart == "no") {
755            window.location = self.attr('href');
756        } else {
757            if ($pType == 'simple') {
758                if ($pID) {
759                    var data = "id=" + $pID,
760                        cart_text = "<div class='rt-woo-view-cart'><a href='" + wc_add_to_cart_params.cart_url + "'>" + wc_add_to_cart_params.i18n_view_cart + "</a></div>";
761                    AjaxCall($(this), 'addToCartWc', data, function (data) {
762                        if (!data.error) {
763                            $('body').append("<div class='rt-response-alert'><div class='rt-alert'>" + data.msg + cart_text + "<span class='cross'>x</span></div></div>");
764                            rtAlertPosition();
765                            if (rttpg.woocommerce_cart_redirect_after_add == "yes") {
766                                window.location.href = wc_add_to_cart_params.cart_url
767                            }
768                        }
769                    });
770                }
771            } else {
772                window.location = self.attr('href');
773            }
774        }
775        return false;
776    });
777
778    $(document).on('click', '.wc-product-holder .reset_variations', function (e) {
779        e.preventDefault();
780        $(".variations").find('select').val("").trigger("change").find('option:first-child').attr("selected", "selected");
781    });
782
783    $(document).on('click', '.rt-response-alert span.cross', function () {
784        $(this).parents('.rt-response-alert').fadeOut(1500, function () {
785            $(this).remove();
786        });
787    });
788
789    function rtAlertPosition() {
790        var target = $('.rt-alert');
791        target.css({
792            left: ($(window).width() - target.outerWidth()) / 2,
793            top: ($(window).height() - target.outerHeight()) / 2
794        });
795    }
796
797    function windowHashChange(isotope, IsoButton) {
798        var $hashFilter = decodeHash() || '';
799        if (!$hashFilter) {
800            $hashFilter = IsoButton.find('button.selected').attr('data-filter') || '';
801            $hashFilter = $hashFilter ? $hashFilter : '*';
802        }
803        $hashFilter = $hashFilter || '*';
804        isotope.isotope({
805            filter: $hashFilter
806        });
807        IsoButton.find("button").removeClass("selected");
808        IsoButton.find('button[data-filter="' + $hashFilter + '"]').addClass("selected");
809    }
810
811    function windowDropdownHashChange(isotope, IsoDropdownFilter) {
812        var $hashFilter = decodeHash() || '';
813
814        if (!$hashFilter) {
815            $hashFilter = IsoDropdownFilter.val();
816            $hashFilter = $hashFilter ? $hashFilter : '*';
817        }
818        $hashFilter = $hashFilter || '*';
819        isotope.isotope({
820            filter: $hashFilter
821        });
822        IsoDropdownFilter.val($hashFilter);
823    }
824
825    function decodeHash() {
826        var $matches = location.hash.match(/filter=([^&]+)/i);
827        var $hashFilter = $matches && $matches[1];
828        return $hashFilter && decodeURIComponent($hashFilter);
829    }
830
831    function isoFilterCounter(container, isotope) {
832        var total = 0;
833        container.find('.rt-tpg-isotope-buttons button').each(function () {
834            var self = $(this),
835                filter = self.attr("data-filter"),
836                itemTotal = isotope.find(filter).length;
837            if (filter != "*") {
838                self.find('span').remove();
839                self.append("<span> (" + itemTotal + ") </span>");
840                total = total + itemTotal;
841            }
842        });
843        container.find('.rt-tpg-isotope-buttons button[data-filter="*"]').find('span').remove();
844        container.find('.rt-tpg-isotope-buttons button[data-filter="*"]').append("<span> (" + total + ") </span>");
845    }
846
847// debounce so filtering doesn't happen every millisecond
848    function debounce(fn, threshold) {
849        var timeout;
850        return function debounced() {
851            if (timeout) {
852                clearTimeout(timeout);
853            }
854
855            function delayed() {
856                fn();
857                timeout = null;
858            }
859
860            setTimeout(delayed, threshold || 100);
861        };
862    }
863
864    function preFunction() {
865        overlayIconResizeTpg();
866    }
867
868
869    $(".tpg-shortcode-main-wrapper a.disabled").each(function () {
870        $(this).prop("disabled", true);
871        $(this).removeAttr("href");
872    });
873
874    function animation() {
875        var $pHolder = $('#rt-popup-wrap');
876        if (parseInt($pHolder.css('marginLeft')) === 0) {
877            $('body, html').removeClass('rt-model-open');
878        }
879
880        $pHolder.animate({
881            marginLeft: parseInt($pHolder.css('marginLeft'), 10) == 0 ?
882                $pHolder.outerWidth() : 0,
883        }).promise().done(function () {
884            if (parseInt($pHolder.css('marginLeft')) > 0) {
885                $pHolder.remove();
886            } else {
887                $('body, html').addClass('rt-model-open');
888            }
889        });
890    }
891
892    $(document).on('click', '.tpg-shortcode-main-wrapper .tpg-single-popup', function (e) {
893        e.preventDefault();
894        var id = $(this).attr("data-id"),
895            wrap_id = $(this).parents('.tpg-shortcode-main-wrapper').attr('id').replace("rt-tpg-container-", "");
896        var data = "action=tgpSinglePopUp&id=" + id;
897        $.ajax({
898            type: "post",
899            url: rttpg.ajaxurl,
900            data: data,
901            beforeSend: function () {
902                $('body, html').addClass('rt-model-open');
903                $("#rt-modal").addClass('md-show rt-modal-' + wrap_id);
904                $("#rt-modal .rt-md-content-holder").html('<div class="rt-md-loading">Loading...</div>');
905            },
906            success: function (data) {
907                $("#rt-modal .rt-md-content-holder").html(data.data);
908                tpgMdScriptLoad()
909            },
910            error: function () {
911                $('body, html').removeClass('rt-model-open');
912                console.log('Error');
913            }
914        });
915    });
916    $('.md-close, .md-overlay').on('click', function (e) {
917        e.preventDefault();
918        $('body, html').removeClass('rt-model-open');
919        $("#rt-modal").removeClass('md-show');
920        $("#rt-modal .rt-md-content-holder").html('');
921    });
922    $(window).bind('keydown', function (event) {
923        if (event.keyCode === 27) { // Esc
924            $('body, html').removeClass('rt-model-open');
925            $("#rt-modal").removeClass('md-show');
926            $("#rt-modal .rt-md-content-holder").html('');
927        }
928    });
929
930    $(document).on('click', '.tpg-shortcode-main-wrapper .tpg-multi-popup', function () {
931
932        var current;
933        var id = $(this).data("id");
934        current = id;
935        var itemArray;
936        var item_count_holder = $(this).parents('.tpg-shortcode-main-wrapper').find('.rt-row.rt-content-loader .rt-grid-item'),
937            wrap_id = $(this).parents('.tpg-shortcode-main-wrapper').attr('id').replace("rt-tpg-container-", "");
938        if (item_count_holder.length) {
939            itemArray = item_count_holder.map(function () {
940                return $(this).data("id");
941            }).get();
942        }
943        var data = "action=tgpMultiPagePopUp&id=" + id;
944        $.ajax({
945            type: "post",
946            url: rttpg.ajaxurl,
947            data: data,
948            beforeSend: function () {
949                initPopupTeamPro(wrap_id);
950                setLevelTgpPro(current, itemArray);
951            },
952            success: function (data) {
953                $("#rt-popup-wrap .rt-popup-content").html(data.data);
954                tpgMdScriptLoad();
955            },
956            error: function () {
957                $('body, html').removeClass('rt-model-open');
958                $("#rt-popup-wrap .rt-popup-content").html("<p>Loading error!!!</p>");
959            }
960        });
961
962        $('.rt-popup-next').on('click', function () {
963            rightClick();
964        });
965        $('.rt-popup-prev').on('click', function () {
966            leftClick();
967        });
968        $('.rt-popup-close').on('click', function () {
969            animation();
970        });
971
972        $(window).bind('keydown', function (event) {
973            if (event.keyCode === 27) { // Esc
974                animation();
975            } else if (event.keyCode === 37) { // left arrow
976                leftClick();
977            } else if (event.keyCode === 39) { // right arrow
978                rightClick();
979            }
980        });
981
982        function rightClick() {
983            var nextId = nextItem(current, itemArray);
984            current = nextId;
985            var data = "action=tgpMultiPagePopUp&id=" + current;
986            $.ajax({
987                type: "post",
988                url: rttpg.ajaxurl,
989                data: data,
990                beforeSend: function () {
991                    setLevelTgpPro(current, itemArray);
992                    $('#rt-popup-wrap .rt-popup-content').html('<div class="rt-popup-loading"></div>');
993                },
994                success: function (data) {
995                    $('#rt-popup-wrap .rt-popup-content').html(data.data);
996                }
997            });
998        }
999
1000        function leftClick() {
1001            var prevId = prevItem(current, itemArray);
1002            current = prevId;
1003            var data = "action=tgpMultiPagePopUp&id=" + current;
1004            $.ajax({
1005                type: "post",
1006                url: rttpg.ajaxurl,
1007                data: data,
1008                beforeSend: function () {
1009                    setLevelTgpPro(current, itemArray);
1010                    $('#rt-popup-wrap .rt-popup-content').html('<div class="rt-popup-loading"></div>');
1011                },
1012                success: function (data) {
1013                    $('#rt-popup-wrap .rt-popup-content').html(data.data);
1014                }
1015            });
1016        }
1017
1018        return false;
1019    });
1020
1021    function initPopupTeamPro(wrap_id) {
1022        var html = '<div id="rt-popup-wrap" class="rt-popup-wrap rt-popup-singlePage-sticky rt-popup-singlePage rt-popup-wrap-' + wrap_id + '">' +
1023            '<div class="rt-popup-content">' +
1024            '<div class="rt-popup-loading"></div>' +
1025            '</div>' +
1026            '<div class="rt-popup-navigation-wrap">' +
1027            '<div class="rt-popup-navigation">' +
1028            '<div class="rt-popup-prev" title="Previous (Left arrow key)" data-action="prev"></div>' +
1029            '<div class="rt-popup-close" title="Close (Esc arrow key)" data-action="close"></div>' +
1030            '<div class="rt-popup-next" title="Next (Right arrow key)" data-action="next"></div>' +
1031            '<div class="rt-popup-singlePage-counter"><span class="ccurrent"></span> of <span class="ctotal"></span></div>' +
1032            '</div>' +
1033            '</div>' +
1034            '</div>';
1035        $("body").append(html);
1036        var $pHolder = $('#rt-popup-wrap');
1037        $pHolder.css('display', 'block');
1038        var navHeight = $pHolder.find('.rt-popup-navigation-wrap').height();
1039        $pHolder.find('.rt-popup-content').css('padding-top', navHeight + "px");
1040        animation();
1041    }
1042
1043    function nextItem(current, list) {
1044        var index = list.indexOf(current);
1045        index++;
1046        if (index >= list.length)
1047            index = 0;
1048        return list[index];
1049    }
1050
1051    function prevItem(current, list) {
1052        var index = list.indexOf(current);
1053        index--;
1054        if (index < 0)
1055            index = list.length - 1;
1056        return list[index];
1057    }
1058
1059
1060    function setLevelTgpPro(current, list) {
1061        var index = list.indexOf(current) + 1;
1062        var count = list.length;
1063        $(".ccurrent").text(index);
1064        $(".ctotal").text(count);
1065    }
1066
1067    function navResize() {
1068        var $pHolder = jQuery('#rt-popup-wrap');
1069        $pHolder.css('display', 'block');
1070    }
1071
1072
1073    $(document).on('click', ".wc-product-holder .wc-tabs li a", function (e) {
1074        e.preventDefault();
1075        var container = $(this).parents('.wc-tabs-wrapper');
1076        var nav = container.children('.wc-tabs');
1077        var content = container.children(".panel.entry-content");
1078        var $this, $id;
1079        $this = $(this);
1080        $id = $this.attr('href');
1081        content.hide();
1082        nav.find('li').removeClass('active');
1083        $this.parent().addClass('active');
1084        container.find($id).show();
1085    });
1086    $(document).on('click', "a.woocommerce-main-image.zoom", function (e) {
1087        e.preventDefault();
1088        return false;
1089    });
1090
1091    $(document).on('click', '.wc-product-holder .single_add_to_cart_button', function (e) {
1092        e.preventDefault();
1093        var $this = $(this),
1094            msgTarget = $this.parents(".wc-add-to-cart"),
1095            $pID = msgTarget.find('form button[name="add-to-cart"]').val(),
1096            qtn = msgTarget.find('form input[name="quantity"]').val();
1097        //var data = rttpg.nonceID + "=" + rttpg.nonce + "&action=addToCartWc&id=" + $pID;
1098        if (rttpg.woocommerce_enable_ajax_add_to_cart === "no") {
1099            $this.parents('form').submit();
1100        } else {
1101            var data = "id=" + $pID + "&qtn=" + qtn,
1102                cart_text = "<div class='rt-woo-view-cart'><a href='" + wc_add_to_cart_params.cart_url + "'>" + wc_add_to_cart_params.i18n_view_cart + "</a></div>";
1103            AjaxCall($(this), 'addToCartWc', data, function (data) {
1104                if (!data.error) {
1105                    $('body').append("<div class='rt-response-alert'><div class='rt-alert'>" + data.msg + cart_text + "<span class='cross'>x</span></div></div>");
1106                    rtAlertPosition();
1107                    if (rttpg.woocommerce_cart_redirect_after_add === "yes") {
1108                        window.location.href = wc_add_to_cart_params.cart_url
1109                    }
1110                } else {
1111                    $('body').append("<div class='rt-response-alert'><div class='rt-alert'>" + data.msg + "</div></div>");
1112                    rtAlertPosition();
1113                    $("body").children('.rt-response-alert').fadeOut(2000, function () {
1114                        $(this).remove();
1115                    });
1116                }
1117            });
1118        }
1119        return false;
1120    });
1121
1122    function AjaxCall(element, action, arg, handle) {
1123        var data = '';
1124        if (action) data = "action=" + action;
1125        if (arg) data = arg + "&action=" + action;
1126        if (arg && !action) data = arg;
1127
1128        var n = data.search(rttpg.nonceID);
1129        if (n < 0) {
1130            data = data + "&" + rttpg.nonceID + "=" + rttpg.nonce;
1131        }
1132
1133        $.ajax({
1134            type: "POST",
1135            url: rttpg.ajaxurl,
1136            data: data,
1137            beforeSend: function () {
1138                element.append("<span class='rt-spine-loading'></span>");
1139            },
1140            success: function (data) {
1141                element.find(".rt-spine-loading").remove();
1142                handle(data);
1143            }
1144        });
1145    }
1146
1147    function overlayIconResizeTpg() {
1148        $('.overlay').each(function () {
1149            var holder_height = jQuery(this).height();
1150            var target = $(this).children('.link-holder');
1151            var targetd = $(this).children('.view-details');
1152            var a_height = target.height();
1153            var ad_height = targetd.height();
1154            var h = (holder_height - a_height) / 2;
1155            var hd = (holder_height - ad_height) / 2;
1156            target.css('top', h + 'px');
1157            targetd.css('margin-top', hd + 'px');
1158        });
1159    }
1160
1161
1162    function mdPopUpResize() {
1163        var target = jQuery("#rt-modal .rt-md-content-holder"),
1164            targetHeight = target.outerHeight(),
1165            title = target.find(".md-header").outerHeight(),
1166            contentHeight = targetHeight - title - 25;
1167        target.find(".rt-md-content").height(contentHeight + "px");
1168    }
1169
1170    window.tpgMdScriptLoad = function () {
1171        mdPopUpResize();
1172        jQuery('.rt-md-content, .rt-popup-content').niceScroll({
1173            background: 'rgba(0, 0, 0, 0.2)',
1174            cursorcolor: rttpg.primaryColor || "#06f",
1175            cursorborder: 'none',
1176            cursorwidth: '3px'
1177        });
1178    };
1179
1180    window.tpgWcFunctionRun = function () {
1181        jQuery(".wc-product-holder .tabs.wc-tabs li:first-child a").trigger('click');
1182        jQuery(document).ready(function () {
1183            jQuery('a.woocommerce-main-image.zoom').zoom();
1184        });
1185
1186        if (typeof Swiper == 'undefined') {
1187            return;
1188        }
1189
1190        new Swiper("#rt-product-gallery.hasImg", {
1191            slidesPerView: 1,
1192            loop: true,
1193            pagination: {
1194                el: '.swiper-pagination',
1195                clickable: true,
1196            }
1197        });
1198    };
1199
1200})(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.