| 1 |
jQuery(document).ready(function($){ |
| 2 |
//wdk_ajax_loading_listings(); |
| 3 |
}); |
| 4 |
|
| 5 |
|
| 6 |
const wdk_popup_listings = ($url = '') => { |
| 7 |
var $ = jQuery, |
| 8 |
theme_jc = null; |
| 9 |
|
| 10 |
$('.wdk_listing_popup').off().on('click', function(e){ |
| 11 |
e.preventDefault(); |
| 12 |
|
| 13 |
/* |
| 14 |
if($(e.target).closest('.slick-arrow').length){ |
| 15 |
return false |
| 16 |
} |
| 17 |
if($(e.target).closest('.wdk-favorites-actions').length){ |
| 18 |
return false |
| 19 |
} |
| 20 |
if($(e.target).closest('.wdk-compare-listing-button-actions').length){ |
| 21 |
return false |
| 22 |
} |
| 23 |
*/ |
| 24 |
|
| 25 |
var url = $(this).attr('data-listing_url'); |
| 26 |
|
| 27 |
if(theme_jc) |
| 28 |
theme_jc.close(); |
| 29 |
|
| 30 |
theme_jc = $.confirm({ |
| 31 |
backgroundDismiss: true, // this will just close the modal |
| 32 |
columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1 listing_popup', |
| 33 |
title: false, |
| 34 |
boxWidth: '1200px', |
| 35 |
useBootstrap: false, |
| 36 |
buttons: { |
| 37 |
cancel: { |
| 38 |
text: 'Close', |
| 39 |
action: function() {} |
| 40 |
}, |
| 41 |
close_btn: { |
| 42 |
text: '<svg viewBox="0 0 24 24" class="sc-ikHGee ebuEaN sc-hAQmFe iTHtnb" xmlns="http://www.w3.org/2000/svg" style="font-size: 24px;color: rgb(255, 255, 255);height: 24px;width: 24px;"><path d="M11.8 11.8L4 4l7.8 7.8L4 19.6l7.8-7.8zm0 0l7.8 7.8-7.8-7.8L19.6 4l-7.8 7.8z" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg>', |
| 43 |
btnClass: 'btn-close', |
| 44 |
action: function() {} |
| 45 |
}, |
| 46 |
}, |
| 47 |
content: function () { |
| 48 |
var self = this; |
| 49 |
return $.ajax({ |
| 50 |
url: url, |
| 51 |
}).done(function (response) { |
| 52 |
|
| 53 |
// Find all <script> elements in the data and remove them if the src contains "jquery" |
| 54 |
var tempContainer = jQuery("<div>").html(response); |
| 55 |
tempContainer.find("script").each(function() { |
| 56 |
var src = jQuery(this).attr("src"); |
| 57 |
if (src && src.toLowerCase().includes("jquery")) { |
| 58 |
jQuery(this).remove(); // Remove the script with "jquery" in the src attribute |
| 59 |
} |
| 60 |
if (src && src.toLowerCase().includes("leaflet")) { |
| 61 |
jQuery(this).remove(); // Remove the script with "jquery" in the src attribute |
| 62 |
} |
| 63 |
}); |
| 64 |
|
| 65 |
self.setContent(tempContainer); |
| 66 |
|
| 67 |
}).fail(function(){ |
| 68 |
self.setContent('Something went wrong.'); |
| 69 |
}); |
| 70 |
} |
| 71 |
}); |
| 72 |
return false; |
| 73 |
}) |
| 74 |
} |
| 75 |
|
| 76 |
|