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