PageSourceSearch

https://icecreamswheelsandtires.com/wp-content/plugins/the-post-grid/assets/js/rttpg.js?ver=1790592293

js icecreamswheelsandtires.com collected 2026-09-28 10:45:27 UTC 12,527 bytes, 304 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    window.tpgFixLazyLoad = function () {
5        $('.rt-tpg-container').each(function () {
6            // jetpack Lazy load
7            $(this).find('img.jetpack-lazy-image:not(.jetpack-lazy-image--handled)').each(function () {
8                $(this).addClass('jetpack-lazy-image--handled').removeAttr('srcset').removeAttr('data-lazy-src').attr('data-lazy-loaded', 1);
9            });
10            //
11            $(this).find('img.lazyload').each(function () {
12                var src = $(this).attr('data-src') || '';
13                if (src) {
14                    $(this).attr('src', src).removeClass('lazyload').addClass('lazyloaded');
15                }
16            });
17        });
18    };
19
20    window.initTpg = function () {
21
22        $('.rt-tpg-container').each(function () {
23            var container = $(this),
24                str = $(this).attr("data-layout"),
25                IsotopeWrap = '',
26                isIsotop = $(".rt-tpg-isotope", container),
27                IsoButton = $(".rt-tpg-isotope-buttons", container),
28                loader = container.find(".rt-content-loader"),
29                IsoDropdownFilter = $("select.isotope-dropdown-filter", container);
30
31            setTimeout(function (){
32                loader.removeClass('tpg-pre-loader');
33            }, 800);
34            if (str) {
35                var qsRegex,
36                    buttonFilter;
37
38                if (isIsotop.length) {
39                    var IsoURL = IsoButton.attr('data-url'),
40                        IsoCount = IsoButton.attr('data-count');
41
42                    if (!buttonFilter) {
43                        if (IsoButton.length) {
44                            buttonFilter = IsoButton.find('button.selected').data('filter');
45                        } else if (IsoDropdownFilter.length) {
46                            buttonFilter = IsoDropdownFilter.val();
47                        }
48                    }
49
50                    container.trigger('tpg_item_before_load');
51                    tpgFixLazyLoad();
52                    IsotopeWrap = isIsotop.imagesLoaded(function () {
53                        preFunction();
54                        IsotopeWrap.isotope({
55                            itemSelector: '.isotope-item',
56                            masonry: {columnWidth: '.isotope-item'},
57                            filter: function () {
58                                var $this = $(this);
59                                var searchResult = qsRegex ? $this.text().match(qsRegex) : true;
60                                var buttonResult = buttonFilter ? $this.is(buttonFilter) : true;
61                                return searchResult && buttonResult;
62                            }
63                        });
64                        setTimeout(function () {
65                            IsotopeWrap.isotope();
66                            container.trigger('tpg_item_after_load');
67                        }, 100);
68                    });
69
70                    IsotopeWrap.on('arrangeComplete', function (event, filteredItems) {
71                        if ($(".isotope-item", IsotopeWrap).is(":visible")) {
72                            IsotopeWrap.parent().find('.isotope-term-no-post p').hide();
73                        } else {
74                            IsotopeWrap.parent().find('.isotope-term-no-post p').show();
75                        }
76                    });
77
78                    // use value of search field to filter
79                    var $quicksearch = container.find('.iso-search-input').keyup(debounce(function () {
80                        qsRegex = new RegExp($quicksearch.val(), 'gi');
81                        IsotopeWrap.isotope();
82                    }));
83
84                    IsoButton.on('click touchstart', 'button', function (e) {
85                        e.preventDefault();
86                        buttonFilter = $(this).attr('data-filter');
87                        if (IsoURL) {
88                            location.hash = "filter=" + encodeURIComponent(buttonFilter);
89                        } else {
90                            IsotopeWrap.isotope();
91                            $(this).parent().find('.selected').removeClass('selected');
92                            $(this).addClass('selected');
93                        }
94                    });
95                    if (IsoURL) {
96                        $(document).ready(function(){
97                            windowHashChange(IsotopeWrap, IsoButton);
98                        });
99                        $(window).on("hashchange", function () {
100                            windowHashChange(IsotopeWrap, IsoButton);
101                        });
102                    }
103                    if (IsoCount) {
104                        isoFilterCounter(container, IsotopeWrap);
105                    }
106                    IsoDropdownFilter.on('change', function (e) {
107                        e.preventDefault();
108                        buttonFilter = $(this).val();
109                        IsotopeWrap.isotope();
110                    });
111                }
112            }
113            container.trigger("tpg_loaded");
114        });
115    };
116    initTpg();
117
118    $(window).on('load resize', function () {
119        tpgBottomScriptLoader();
120        overlayIconResizeTpg();
121    });
122
123
124    function tpgBottomScriptLoader() {
125        setTimeout(function () {
126
127            $(".bottom-script-loader").fadeOut(500, function () {
128                // fadeOut complete. Remove the loading div
129                $(".bottom-script-loader").remove(); //makes page more lightweight
130            });
131
132        }, 400)
133    }
134
135    function windowHashChange(isotope, IsoButton) {
136        var $hashFilter = decodeHash() || '';
137        if (!$hashFilter) {
138            $hashFilter = IsoButton.find('button.selected').attr('data-filter') || '';
139            $hashFilter = $hashFilter ? $hashFilter : '*';
140        }
141        $hashFilter = $hashFilter || '*';
142        isotope.isotope({
143            filter: $hashFilter
144        });
145        IsoButton.find("button").removeClass("selected");
146        IsoButton.find('button[data-filter="' + $hashFilter + '"]').addClass("selected");
147    }
148
149    function decodeHash() {
150        var $matches = location.hash.match(/filter=([^&]+)/i);
151        var $hashFilter = $matches && $matches[1];
152        return $hashFilter && decodeURIComponent($hashFilter);
153    }
154
155    function isoFilterCounter(container, isotope) {
156        var total = 0;
157        container.find('.rt-tpg-isotope-buttons button').each(function () {
158            var self = $(this),
159                filter = self.attr("data-filter"),
160                itemTotal = isotope.find(filter).length;
161            if (filter != "*") {
162                self.find('span').remove();
163                self.append("<span> (" + itemTotal + ") </span>");
164                total = total + itemTotal;
165            }
166        });
167        container.find('.rt-tpg-isotope-buttons button[data-filter="*"]').find('span').remove();
168        container.find('.rt-tpg-isotope-buttons button[data-filter="*"]').append("<span> (" + total + ") </span>");
169    }
170
171    // debounce so filtering doesn't happen every millisecond
172    function debounce(fn, threshold) {
173        var timeout;
174        return function debounced() {
175            if (timeout) {
176                clearTimeout(timeout);
177            }
178
179            function delayed() {
180                fn();
181                timeout = null;
182            }
183
184            setTimeout(delayed, threshold || 100);
185        };
186    }
187
188    function preFunction() {
189        //HeightResize();
190        overlayIconResizeTpg();
191    }
192
193    $(".rt-tpg-container a.disabled").each(function () {
194        $(this).prop("disabled", true);
195        $(this).removeAttr("href");
196    });
197
198    function HeightResize() {
199        var wWidth = $(window).width();
200        tpgFixLazyLoad();
201        $(".rt-tpg-container").each(function () {
202            var self = $(this),
203                dCol = self.data('desktop-col'),
204                tCol = self.data('tab-col'),
205                mCol = self.data('mobile-col'),
206                target = $(this).find('.rt-row.rt-content-loader.tpg-even');
207            if ((wWidth >= 992 && dCol > 1) || (wWidth >= 768 && tCol > 1) || (wWidth < 768 && mCol > 1)) {
208                target.imagesLoaded(function () {
209                    var tlpMaxH = 0;
210                    target.find('.even-grid-item').height('auto');
211                    target.find('.even-grid-item').each(function () {
212                        var $thisH = $(this).outerHeight();
213                        if ($thisH > tlpMaxH) {
214                            tlpMaxH = $thisH;
215                        }
216                    });
217                    target.find('.even-grid-item').height(tlpMaxH + "px");
218                });
219            } else {
220                target.find('.even-grid-item').height('auto');
221            }
222
223        });
224        if ($(".rt-row.rt-content-loader.layout4").length) {
225            equalHeight4Layout4();
226        }
227
228        function equalHeight4Layout4() {
229            var $maxH = $(".rt-row.rt-content-loader.layout4 .layout4item").height();
230            $(".rt-row.rt-content-loader.layout4 .layout4item .layoutInner .rt-img-holder img,.rt-row.rt-content-loader.layout4 .layout4item .layoutInner.layoutInner-content").height($maxH + "px");
231        }
232    }
233
234    function overlayIconResizeTpg() {
235        $('.overlay').each(function () {
236            var holder_height = jQuery(this).height();
237            var target = $(this).children('.link-holder');
238            var targetd = $(this).children('.view-details');
239            var a_height = target.height();
240            var ad_height = targetd.height();
241            var h = (holder_height - a_height) / 2;
242            var hd = (holder_height - ad_height) / 2;
243            target.css('top', h + 'px');
244            targetd.css('margin-top', hd + 'px');
245        });
246    }
247
248
249    function RTPromoContent() {
250        parent.document.addEventListener("mousedown", function (e) {
251            var widgets = parent.document.querySelectorAll(".elementor-element--promotion");
252
253            if (widgets.length > 0) {
254                for (var i = 0; i < widgets.length; i++) {
255                    if (widgets[i].contains(e.target)) {
256                        var dialog = parent.document.querySelector("#elementor-element--promotion__dialog");
257                        var icon = widgets[i].querySelector(".icon > i");
258
259                        if (icon.classList.toString().indexOf("tss-
259promotional-element") >= 0) {
260                            dialog.querySelector(".dialog-buttons-action").style.display = "none";
261
262                            if (dialog.querySelector(".rt-dialog-buttons-action") === null) {
263                                var button = document.createElement("a");
264                                var buttonText = document.createTextNode("Get Pro");
265
266                                button.setAttribute("href", "//www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/");
267                                button.setAttribute("target", "_blank");
268                                button.classList.add(
269                                    "elementor-button",
270                                    "elementor-button-success",
271                                    "rt-dialog-buttons-action"
272                                );
273
274                                button.appendChild(buttonText);
275
276                                // dialog.querySelector(".dialog-buttons-action").removeChild(button.outerHTML);
277                                dialog.querySelector(".dialog-buttons-action").insertAdjacentHTML("afterend", button.outerHTML);
278                            } else {
279                                dialog.querySelector(".rt-dialog-buttons-action").style.display = "";
280                            }
281                        } else {
282                            dialog.querySelector(".dialog-buttons-action").style.display = "";
283
284                            if (dialog.querySelector(".rt-dialog-buttons-action") !== null) {
285                                dialog.querySelector(".rt-dialog-buttons-action").style.display = "none";
286                            }
287                        }
288
289                        break;
290                    }
291                }
292            }
293        });
294    }
295
296    // Elementor Frontend Load
297    $(window).on('elementor/frontend/init', function () {
298        if (elementorFrontend.isEditMode()) {
299            // Promo Content.
300            RTPromoContent();
301        }
302    });
303
304})(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.