"); -->
/* setting up the map */
var params = {
"instance_id":"locate_anything_map_16778",
"map-id": "16778",
"map-container":'map-container-16778',
"initial-lat": 14.521096,
"initial-lon": 4.414225,
"initial-zoom": 5,
"single-zoom": 5,
"autogeocode" :'0',
"display_only_inbound" : '0',
"overlay" : {url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"OpenStreetMap" ,maxZoom:18 ,minZoom:2},
"googleplaces" : 0,
"max_nav_item_per_page" : 5,
"style-hue":"#000000", "scrollWheelZoom" : 1,
"navlist_event" : 'click',
"hide-splashscreen" : '0',
"kml_file" : '',
"kml_fillColor" : '#cbbdfb',
"kml_weight" : '2',
"kml_opacity" : '1',
"kml_color" : '#000000',
"kml_dashArray" : '2',
"kml_fillOpacity" : '0.5',
"bing-key" : 'An5y6EfmR_Tmk0nMXSWFQD7JZ2sc5Zv793InR2eKkVmMpwxfa_XOzlEmIEPXIol9',
"load-google" : '1',
"load-bing" : '',
"load-yandex" : '',
"overlay-addon" : '',
"overlay-addon-accessToken-jawg" : '',
"overlay-addon-customstyle-jawg" : '',
"overlay-addon-accessToken-thunderforest" : '',
"overlay-addon-accessToken-mapbox" : '',
"overlay-addon-accessToken-maptiler" : '',
"overlay-addon-accessToken-openweathermap" : '',
"overlay-addon-accessToken-here" : '',
"enable_fitBounds" : '0',
"enable_zoom_to_marker" : '0'
};
/* define instance name*/
var map_instance="locate_anything_map_"+map_id;
/* instanciate filter class */
eval("var "+map_instance+"=new leaflet_filters_class(params);");
/* loading ... */
eval(map_instance).showLoader(true);
/* Initialize Map */
eval(map_instance).createMap();
/* Register filters, property_name is the name of the property as shown in the JSON datas */
var custom_filters= [{"property_name":"","html_id" : "#-16778"},{"property_name":"post_tag","html_id" : "#post_tag-16778"},];
eval(map_instance).register_filters(custom_filters);
/* Override nav item template */
eval(map_instance).template_nav_item = function(marker,LatLng) {
var template='
'+decode((marker.title?marker.title:''))+'
'+decode((marker.medium_thumbnail?marker.medium_thumbnail:''))+'
'+decode((marker.content_stripped?marker.content_stripped:''))+'
Read more ';
return template;
};
/* define callback function */
var createEverything_16778 = function(result){
var cpt=0;
for(var i in result["data"]){
var marker={};
/* The JSON containing the markers data is indexed to save space and generation time
* Rebuilds the object with original field names
*/
var indexed_marker=result["data"][i];
for(var k in indexed_marker) {
marker[result["index"]["fieldnames"][k]]=indexed_marker[k];
}
/* Marker creation : set timeout is used to allow the progressbar to update */
setTimeout(function(marker){
/* define Tooltip HTML*/
var default_tooltip_template='
Read more';
// length must be superior to 2 because of the inclusion of 2 single quotes to delimitate the output
if(marker.tooltip_template.length>2) {
var html = eval(marker.tooltip_template);
}
else var html=default_tooltip_template;
/* define icon*/
var customIcon=null;
if(marker.custom_marker){
customIcon= eval(map_instance).getMarkerIcon(marker.custom_marker);
} else customIcon=false;
/* No custom icon, use default icon for this map */
if(!customIcon) customIcon= eval(map_instance).getMarkerIcon(result["defaults"][0].default_marker);
/* updates progress bar */
eval(map_instance).updateProgressBar(cpt++, result["data"].length, 1000);
/* creates the marker */
eval(map_instance).createMarker(marker.lat,marker.lng,html,marker,customIcon);
},1,marker);
}
setTimeout(function() {
/* Render Map */
eval(map_instance).render_map(eval(map_instance).markers);
/* Creation Nav */
eval(map_instance).updateNav(0);
/* hide loader */
eval(map_instance).showLoader(false);
/* stores the map in Jquery for easier access*/
current_map=eval(map_instance);
eval(map_instance).setup_range_sliders();
},250);
}
/* JSON : Retrieve markers data */
eval(map_instance).getData("https://proarides.org/wp-admin/admin-ajax.php?action=getMarkers&map_id=16778",createEverything_16778)
/* call Tokenize for nice selects */
if(jQuery.tokenize){
var token1=jQuery('#map-filters-'+map_id+' .tokenize-1').tokenize({maxElements:"1",onRemoveToken:function(e,f){eval(map_instance).update_markers();},onAddToken:function(e,f){eval(map_instance).update_markers();}});
var token=jQuery('#map-filters-'+map_id+' .tokenize').tokenize({maxElements:"9999",onRemoveToken:function(e,f){eval(map_instance).update_markers();},onAddToken:function(e,f){eval(map_instance).update_markers();}});
}
/* Hide attribution */
jQuery('.leaflet-control-attribution').hide();
/* Hide attribution */
jQuery('.filter-select select').chosen({width:'250px',allow_single_deselect:'true'});
});
//console.log("jQuery is loaded.");
})();