| 1 |
"use strict"; |
| 2 |
|
| 3 |
(function ($) { |
| 4 |
'use strict'; |
| 5 |
/** |
| 6 |
* All of the code for your public-facing JavaScript source |
| 7 |
* should reside in this file. |
| 8 |
* |
| 9 |
* Note: It has been assumed you will write jQuery code here, so the |
| 10 |
* $ function reference has been prepared for usage within the scope |
| 11 |
* of this function. |
| 12 |
* |
| 13 |
* This enables you to define handlers, for when the DOM is ready: |
| 14 |
* |
| 15 |
* $(function() { |
| 16 |
* |
| 17 |
* }); |
| 18 |
* |
| 19 |
* When the window is loaded: |
| 20 |
* |
| 21 |
* $( window ).load(function() { |
| 22 |
* |
| 23 |
* }); |
| 24 |
* |
| 25 |
* ...and/or other possibilities. |
| 26 |
* |
| 27 |
* Ideally, it is not considered best practise to attach more than a |
| 28 |
* single DOM-ready or window-load handler for a particular page. |
| 29 |
* Although scripts in the WordPress core, Plugins and Themes may be |
| 30 |
* practising this, we should strive to set a better example in our own work. |
| 31 |
*/ |
| 32 |
|
| 33 |
$('.wdk-click-load-animation').on('click', function () { |
| 34 |
$(this).find('i.fa-ajax-indicator').css('display', 'block'); |
| 35 |
}); |
| 36 |
})(jQuery); |
| 37 |
|
| 38 |
var wdk_generate_marker = function wdk_generate_marker(ajax_url, listing_post_id, lat, lng, innerMarker, wdk_jpopup_customOptions) { |
| 39 |
var marker = L.marker([lat, lng], { |
| 40 |
icon: L.divIcon({ |
| 41 |
html: innerMarker, |
| 42 |
className: 'open_steet_map_marker', |
| 43 |
iconSize: [40, 60], |
| 44 |
popupAnchor: [-1, -35], |
| 45 |
iconAnchor: [25, 60] |
| 46 |
}) |
| 47 |
}); |
| 48 |
var data = { |
| 49 |
"action": 'wdk_public_action', |
| 50 |
"page": 'wdk_frontendajax', |
| 51 |
"function": 'map_infowindow', |
| 52 |
"listing_post_id": listing_post_id |
| 53 |
}; |
| 54 |
marker.bindPopup(function () { |
| 55 |
var content = '<div class="infobox"><div class="map_infowindow"><div class="loading_content animated-background"><div class="box_line m170"></div><div class="box_line m20"></div><div class="box_line m20"></div><div class="box_line m20"></div><div class="box_line m20"></div><div class="box_line m20"></div></div></div></div>'; |
| 56 |
marker.getPopup().setContent(content); |
| 57 |
marker.getPopup().update(); |
| 58 |
jQuery.ajax({ |
| 59 |
url: ajax_url, |
| 60 |
type: "POST", |
| 61 |
data: data, |
| 62 |
success: function success(data) { |
| 63 |
marker.getPopup().setContent(data.popup_content); |
| 64 |
marker.getPopup().update(); |
| 65 |
} |
| 66 |
}); |
| 67 |
return content; |
| 68 |
}, wdk_jpopup_customOptions); //marker.bindPopup(popup_content, wdk_jpopup_customOptions); |
| 69 |
|
| 70 |
wdk_clusters.addLayer(marker); |
| 71 |
return marker; |
| 72 |
}; |