1var dceDynamicPostsSkin = ""; 2var dceDynamicPostsSkinPrefix = ""; 3var Widget_DCE_Dynamicposts_base_Handler = function ($scope, $) { 4 const widgetType = $scope.attr("data-widget_type"); 5 if (typeof widgetType !== "string") { 6 return; 7 } 8 9 const typeAndSkin = widgetType.split("."); 10 if (typeAndSkin.length !== 2) { 11 return; 12 } 13 14 // Features Dynamic Posts Collection 15 let features = dce_features_collection_dynamic_posts; 16 17 if (!features.includes(typeAndSkin[0])) { 18 return; 19 } 20 dceDynamicPostsSkin = typeAndSkin[1]; 21 if (dceDynamicPostsSkin === "grid-filters") { 22 dceDynamicPostsSkin = "grid_filters"; 23 } 24 dceDynamicPostsSkinPrefix = dceDynamicPostsSkin + "_"; 25 var elementSettings = dceGetElementSettings($scope); 26 27 // Run on load 28 fitImages(); 29 initAjaxCallbacks(); 30 31 // HOVER EFFECTS 32 var blocks_hoverEffects = $scope.find(".dce-post-block.dce-hover-effects"); 33 if (blocks_hoverEffects.length) { 34 blocks_hoverEffects.each(function (i, el) { 35 $(el).on("mouseenter touchstart", function () { 36 $(this) 37 .find(".dce-hover-effect-content") 38 .removeClass("dce-close") 39 .addClass("dce-open"); 40 }); 41 $(el).on("mouseleave touchend", function () { 42 $(this) 43 .find(".dce-hover-effect-content") 44 .removeClass("dce-open") 45 .addClass("dce-close"); 46 }); 47 }); 48 } 49 50 // Linkable Template 51 if ( 52 false === elementorFrontend.isEditMode() && 53 "yes" === elementSettings.templatemode_linkable 54 ) { 55 $scope 56 .find(".dce-post.dce-post-item[data-post-link]") 57 .click(function () { 58 window.location.assign($(this).attr("data-post-link")); 59 return false; 60 }); 61 } 62 63 // Fit Images Ratio 64 function fitImage($post) { 65 var $imageParent = $post.find(".dce-img"); 66 $image = $imageParent.find("img"); 67 image = $image[0]; 68 69 if (!image) { 70 return; 71 } 72 73 var imageParentRatio = 74 $imageParent.outerHeight() / $imageParent.outerWidth(), 75 imageRatio = image.naturalHeight / image.naturalWidth; 76 $imageParent.toggleClass("dce-fit-img", imageRatio < imageParentRatio); 77 } 78 79 function fitImages() { 80 var itemRatio = $scope 81 .find(".dce-post-image figure") 82 .first() 83 .data("image-ratio"); 84 85 if (!itemRatio) { 86 return; 87 } 88 $scope.find(".dce-posts-container").toggleClass("dce-is-ratio", true); 89 $scope.find(".dce-post-image").each(function () { 90 var $post = $(this); 91 $image = $post.find(".dce-img img"); 92 fitImage($post); 93 $image.on("load", function () { 94 fitImage($post); 95 }); 96 }); 97 } 98 99 function initAjaxCallbacks() { 100 // Re init layout after ajax request on Search&Filter Pro v2 101 $(document).on("sf:ajaxfinish", ".searchandfilter", function (e, data) { 102 if ( 103 window.elementorFrontend && 104 window.elementorFrontend.elementsHandler && 105 window.elementorFrontend.elementsHandler.runReadyTrigger 106 ) { 107 var runReadyTrigger = 108 window.elementorFrontend.elementsHandler.runReadyTrigger; 109 let form = data.object; 110 let ajaxUpdateSections = "[]"; 111 if (typeof form.dataset.ajaxUpdateSections == "string") { 112 ajaxUpdateSections = form.dataset.ajaxUpdateSections; 113 } 114 let sections = JSON.parse(ajaxUpdateSections); 115 sections.push(data.targetSelector); 116 for (let section of sections) { 117 runReadyTrigger($(section)); 118 $(section) 119 .find(".elementor-widget") 120 .each(function () { 121 runReadyTrigger($(this)); 122 }); 123 } 124 } 125 }); 126 127 // Re init layout after ajax request on Search&Filter Pro v3 128 function reInitElementorWidgets(domElement) { 129 if ( 130 !domElement || 131 !window.elementorFrontend || 132 !window.elementorFrontend.elementsHandler || 133 !window.elementorFrontend.elementsHandler.runReadyTrigger 134 ) { 135 return; 136 } 137 const runReadyTrigger = 138 window.elementorFrontend.elementsHandler.runReadyTrigger; 139 140 // Run the trigger for the dom element itself 141 runReadyTrigger($(domElement)); 142 143 // Run the trigger for any child elementor widgets 144 $(domElement) 145 .find(".elementor-widget") 146 .each(function () { 147 runReadyTrigger($(this)); 148 }); 149 } 150 151 // Function to add listeners to queries 152 function initSearchAndFilterProQueryListeners(query) { 153 // Re-init the layout of results after a query has updated the DOM 154 const supportedIntegrations = [ 155 "dynamicooo/dynamic-content-for-elementor", 156 ]; 157 158 // Don't update if dynamic update isn't enabled 159 if (query.getAttribute("resultsDynamicUpdate") !== "yes") { 160 return; 161 } 162 163 // Ensure the integration type is one of the supported ones 164 if ( 165 !supportedIntegrations.includes( 166 query.getAttribute("queryIntegration"), 167 ) 168 ) { 169 return; 170 } 171 172 // Listen for the update to the results 173 query.on("get-results/finish", function (queryObject) { 174 const queryContainer = queryObject.getQueryContainer(); 175 reInitElementorWidgets(queryContainer); 176 }); 177 } 178 179 // Initialize for Search & Filter Pro v3 180 window.addEventListener("searchandfilter/init", () => { 181 if ( 182 window.searchAndFilter && 183 window.searchAndFilter.frontend && 184 window.searchAndFilter.frontend.queries && 185 window.searchAndFilter.frontend.queries.getAll 186 ) { 187 const queries = 188 window.searchAndFilter.frontend.queries.getAll(); 189 for (let i = 0; i < queries.length; i++) { 190 initSearchAndFilterProQueryListeners(queries[i]); 191 } 192 } 193 }); 194 } 195}; 196 197var dceFavoritesHandler = function ($scope, $) { 198 $(document).one("dce::finish_add_to_favorites", function () { 199 var widgetId = $scope.attr("data-id"); 200 201 $scope.css({ 202 opacity: "0.5", 203 "pointer-events": "none", 204 }); 205 206 $.ajax({ 207 url: window.location.href, 208 type: "GET", 209 success: function (response) { 210 var updatedContent = $(response) 211 .find('[data-id="' + widgetId + '"]') 212 .html(); 213 $scope.html(updatedContent); 214 215 if ( 216 window.elementorFrontend && 217 window.elementorFrontend.elementsHandler && 218 window.elementorFrontend.elementsHandler.runReadyTrigger 219 ) { 220 window.elementorFrontend.elementsHandler.runReadyTrigger( 221 $scope, 222 ); 223 } 224 }, 225 error: function (error) { 226 console.log("Error in AJAX call", error); 227 },
228 complete: function () { 229 $scope.css({ 230 opacity: "", 231 "pointer-events": "", 232 }); 233 }, 234 }); 235 }); 236}; 237 238jQuery(window).on("elementor/frontend/init", function () { 239 elementorFrontend.hooks.addAction( 240 "frontend/element_ready/widget", 241 Widget_DCE_Dynamicposts_base_Handler, 242 ); 243 elementorFrontend.hooks.addAction( 244 "frontend/element_ready/dce-dynamic-show-favorites.grid", 245 dceFavoritesHandler, 246 ); 247 elementorFrontend.hooks.addAction( 248 "frontend/element_ready/dce-dynamic-show-favorites.carousel", 249 dceFavoritesHandler, 250 ); 251 elementorFrontend.hooks.addAction( 252 "frontend/element_ready/dce-dynamic-show-favorites.dualcarousel", 253 dceFavoritesHandler, 254 ); 255 elementorFrontend.hooks.addAction( 256 "frontend/element_ready/dce-dynamic-show-favorites.accordion", 257 dceFavoritesHandler, 258 ); 259 elementorFrontend.hooks.addAction( 260 "frontend/element_ready/dce-dynamic-show-favorites.list", 261 dceFavoritesHandler, 262 ); 263 elementorFrontend.hooks.addAction( 264 "frontend/element_ready/dce-dynamic-show-favorites.table", 265 dceFavoritesHandler, 266 ); 267 elementorFrontend.hooks.addAction( 268 "frontend/element_ready/dce-dynamic-show-favorites.timeline", 269 dceFavoritesHandler, 270 ); 271 elementorFrontend.hooks.addAction( 272 "frontend/element_ready/dce-dynamic-show-favorites.3d", 273 dceFavoritesHandler, 274 ); 275 elementorFrontend.hooks.addAction( 276 "frontend/element_ready/dce-dynamic-show-favorites.gridtofullscreen3d", 277 dceFavoritesHandler, 278 ); 279 elementorFrontend.hooks.addAction( 280 "frontend/element_ready/dce-dynamic-show-favorites.crossroadsslideshow", 281 dceFavoritesHandler, 282 ); 283});
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.