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