+Marker hinzufügen
map_el = `map-20210929`;
if(document.getElementById(map_el)) {
/* Transfer PHP array to JS json */
var oum_all_locations = [{"title":"Wasserstelle Camping","lat":"50.88362871726","lng":"9.2557454109192","zoom":"16","content":"Wasserstelle Camping Wasserstelle Camping Trinkwasserstelle im Campingbereich des World Music Festivals wasserstelle-camping","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"4876","address":"Wasserstelle Camping","text":"Trinkwasserstelle im Campingbereich des World Music Festivals","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"Wasser- und Waschplatz","lat":"50.884043132209","lng":"9.255718588829","zoom":"12","content":"echtes Loshausener Hahnebecker Wasser- und Waschplatz Zwischen Bühne und Eingang steht die Wasserstelle. Hier kann man sich mit Blick auf die rauschende Schwalm ein klares Helles zapfen, Zähne putzen oder die wichtigsten Schweißstellen reinigen. wasser-und-waschplatz","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"3630","address":"echtes Loshausener Hahnebecker","text":"Zwischen Bühne und Eingang steht die Wasserstelle. Hier kann man sich mit Blick auf die rauschende Schwalm ein klares Helles zapfen, Zähne putzen oder die wichtigsten Schweißstellen reinigen.","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"Hotel / Metzgerei Bechtel","lat":"50.877881167484","lng":"9.2565554380417","zoom":"12","content":"Hotel / Metzgerei Bechtel Hotel / Metzgerei Bechtel Hotel / Metzgerei Bechtel hotel-metzgerei-bechtel","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2198","address":"Hotel / Metzgerei Bechtel","text":"Hotel / Metzgerei Bechtel","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain","lat":"50.911923395038","lng":"9.2419427633286","zoom":"12","content":"Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain Supermärkte, Apotheken, Tankstellen usw. Auch über den Rotkäppchen-Radweg bequem erreichbar ... einkaufsmoeglichkeiten-in-schwalmstadt-ziegenhain","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2199","address":"Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain","text":"Einkaufsmöglichkeiten in Schwalmstadt-Ziegenhain\u003Cbr\u003ESupermärkte, Apotheken, Tankstellen usw.\u003Cbr\u003EAuch über den Rotkäppchen-Radweg bequem erreichbar ...","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"Radweg Rotkäppchenland / Überrregionaler Radweg D4","lat":"50.887258463624","lng":"9.2512285709381","zoom":"12","content":"Radweg Rotkäppchenland / Überrregionaler Radweg D4 Radweg Rotkäppchenland / Überrregionaler Radweg D4 Infotafel Radwege radweg-rotkaeppchenland-ueberrregionaler-radweg-d4","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2194","address":"Radweg Rotkäppchenland / Überrregionaler Radweg D4","text":"Infotafel Radwege","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"Bäckerei Nolte","lat":"50.884677487874","lng":"9.2532899712553","zoom":"12","content":"Bäckerei Nolte Bäckerei Nolte world-music-festival-baeckerei-nolte","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2187","address":"Bäckerei Nolte","text":"","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"World Music Festival – Bahnhof Treysa","lat":"50.910931089605","lng":"9.1856324672699","zoom":"12","content":"World Music Festival - Bahnhof Treysa World Music Festival – Bahnhof Treysa Der nächstgelegene Bahnhof in Schwalmstadt-Treysa world-music-festival-bahnhof-treysa","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2182","address":"World Music Festival - Bahnhof Treysa","text":"Der nächstgelegene Bahnhof in Schwalmstadt-Treysa","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"World Music Festival – Camping","lat":"50.882771509967","lng":"9.2568765297666","zoom":"12","content":"World Music Festival - Campingwiesen World Music Festival – Camping world-music-festival-camping","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2177","address":"World Music Festival - Campingwiesen","text":"","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"World Music Festival – Bushalt ‚Willingshausen-Loshausen Grundschule‘","lat":"50.885612438315","lng":"9.2519400078855","zoom":"12","content":"World Music Festival - Bushaltestelle \u0027Willingshausen-Loshausen Grundschule\u0027 World Music Festival – Bushalt ‚Willingshausen-Loshausen Grundschule‘ bushaltestelle-willingshausen-loshausen-grundschule","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2176","address":"World Music Festival - Bushaltestelle \\\u0026#039;Willingshausen-Loshausen Grundschule\\\u0026#039;","text":"","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0},{"title":"World Music Festival – Festivalgelände Schlosspark","lat":"50.883766849867","lng":"9.2567566800411","zoom":"12","content":"World Music Festival-Gelände in Willingshausen-Loshausen World Music Festival – Festivalgelände Schlosspark world-music-festival-loshausen","icon":"https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png","types":[],"post_id":"2173","address":"World Music Festival-Gelände in Willingshausen-Loshausen","text":"","image":"","audio":"","video":"","custom_fields":[],"votes":0,"star_rating_avg":0,"star_rating_count":0}];
// Wait for the main initialization function to be available, then call it
function oumWaitForMainInit() {
if (typeof oumInitializeMap === 'function') {
console.log('🗺️ Open User Map: Starting');
// Initialize the map
oumInitializeMap();
} else {
setTimeout(oumWaitForMainInit, 100);
}
}
setTimeout(oumWaitForMainInit, 100);
}
map_el = `map-20210929`;
if(document.getElementById(map_el)) {
// Wait for OUMLoader to be defined
function oumLoading() {
if (typeof OUMLoader !== 'undefined') {
// Initialize loader for this map
OUMLoader.initLoader(map_el);
// Add event listener for map initialization complete
document.addEventListener('oum:map_initialized', function(e) {
if (e.detail.mapId === map_el) {
OUMLoader.setMapInitialized(map_el);
}
});
} else {
// If OUMLoader is not yet defined, wait and try again
setTimeout(oumLoading, 100);
}
}
// OUM Loading Spinner
oumLoading();
// OUM inline JS variables
var mapStyle = `OpenStreetMap.DE`;
var oum_tile_provider_mapbox_key = ``;
var marker_icon_url = `https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-icon_custom1-2x.png`;
var marker_shadow_url = `https://worldmusicfestival.de/wp-content/plugins/open-user-map/src/leaflet/images/marker-shadow.png`;
var oum_enable_scrollwheel_zoom_map = false;
var oum_enable_cluster = true;
var oum_enable_fullscreen = true;
var oum_enable_searchbar = true;
var oum_searchbar_type = `markers`;
var oum_geosearch_selected_provider = ``;
var oum_geosearch_provider = `osm`;
var oum_geosearch_provider_geoapify_key = ``;
var oum_geosearch_provider_here_key = ``;
var oum_geosearch_provider_mapbox_key = ``;
var oum_enable_searchaddress_button = true;
var oum_searchaddress_label = `Adresse suchen`;
var oum_enable_searchmarkers_button = true;
var oum_searchmarkers_label = `Location suchen`;
var oum_searchmarkers_zoom = `8`;
var oum_enable_currentlocation = false;
var oum_action_after_submit = `text`;
var thankyou_redirect = ``;
var start_lat = Number(50.884524207423);
var start_lng = Number(9.2543292045593);
var start_zoom = Number(16);
var oum_enable_fixed_map_bounds = ``;
var oum_use_settings_start_location = true;
var oum_has_regions = false;
var oum_enable_multiple_marker_types = `false`;
var oum_hide_filterbox = false;
var oum_hide_location_popup = false;
var oum_enable_address = `on`;
var oum_enable_address_autofill = ``;
// WordPress timezone for opening hours calculations
var oum_wordpress_timezone = `Europe/Berlin`;
// Custom Image data
var oum_custom_image_url = ``;
var oum_custom_image_bounds = {};
var oum_custom_image_hide_tiles = false;
var oum_custom_image_background_color = `#ffffff`;
var oum_location = {};
var oum_custom_css = '';
var oum_custom_script = '';
var oum_max_image_filesize = 10;
var oumMap;
var oumMap2;
/**
* Conditional Field Feature
*
* @param {string} sourceField - The source field selector
* @param {string} targetField - The target field selector
* @param {array} condShow - The values that should show the target field
* @param {array|null} condHide - The values that should hide the target field. If empty/null/undefined, the field will be hidden when condShow is not met.
*/
var oumConditionalField = (sourceField, targetField, condShow, condHide = null) => {
const sourceElements = document.querySelectorAll(sourceField); // Select all radios/checkboxes or single select
const targetElementWrapper = document.querySelector(targetField)?.parentElement; /* works with custom fields only */
// Check if both sourceElements and targetElementWrapper exist
if (!sourceElements.length) {
console.warn(`OUM: Source field(s) not found: ${sourceField}`);
return;
}
if (!targetElementWrapper) {
console.warn(`OUM: Target field wrapper not found: ${targetField}`);
return;
}
/* Event listener for change */
const onChangeHandler = function() {
// Get selected values for checkboxes and single selected value for radios/select
const selectedValues = Array.from(sourceElements)
.filter(element => element.checked || element.tagName === 'SELECT')
.map(element => element.value);
const selectedValue = selectedValues[0]; // For radios and selects, we use only the first (and only) value
console.log('OUM: run condition', {selectedValue, sourceField, targetField, condShow, condHide});
// Show or hide target field based on the selected value(s)
if (condShow.includes(selectedValue)) {
// Show the field if condShow condition is met
targetElementWrapper.style.display = 'block';
} else if (condHide && Array.isArray(condHide) && condHide.length > 0 && condHide.includes(selectedValue)) {
// Hide the field if condHide is provided and condition is met
targetElementWrapper.style.display = 'none';
} else if (!condHide || (Array.isArray(condHide) && condHide.length === 0)) {
// If condHide is empty/null/undefined, hide the field when condShow is not met
targetElementWrapper.style.display = 'none';
}
};
/* Attach the event listener to each radio/checkbox or select */
sourceElements.forEach(element => {
element.addEventListener('change', onChangeHandler);
});
/* Trigger initially */
onChangeHandler(); // Call it directly to set initial state
};
/**
* Add Custom Styles
*/
/* custom color */
oum_custom_css += `
.open-user-map .add-location #close-add-location-overlay:hover {color: #e82c71 !important}
.open-user-map .box-wrap .map-wrap .open-add-location-overlay {background-color: #e82c71 !important}
.open-user-map .box-wrap .map-wrap .open-add-location-overlay:hover,
.open-user-map .box-wrap .map-wrap .open-add-location-overlay:active {background-color: #d12866 !important}
.open-user-map .box-wrap .map-wrap .oum-filter-controls .oum-filter-list .close-filter-list:hover {color: #e82c71 !important}
.open-user-map .oum-advanced-filter-button .oum-advanced-filter-content .close-advanced-filter:hover,
.open-user-map .oum-advanced-filter-panel .oum-advanced-filter-content .close-advanced-filter:hover {color: #e82c71 !important}
.open-user-map input.oum-switch[type="checkbox"]:checked + label::before {background-color: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum-required-indicator {color: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location h2 {color: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=text]:focus,
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=email]:focus,
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=url]:focus,
.open-user-map .add-location .location-overlay-content #oum_add_location textarea:focus,
.open-user-map .add-location .location-overlay-content #oum_add_location select:focus {border-color: #e82c71 !important; box-shadow: 0 0 0 2px #e82c711a !important}
.open-user-map .add-location .location-overlay-content #oum_add_location_thankyou h3 {color: #e82c71 !important}
.open-user-map .oum_location_text a {color: #e82c71 !important}
.open-user-map .oum_location_text .oum_vote_button_wrap .oum_vote_button.voted {background: #e82c71 !important; border-color: #e82c71 !important;}
.open-user-map .oum-tabs {border-color: #e82c71 !important}
.open-user-map .oum-tabs .nav-item:hover {color: #e82c71 !important; border-color: #e82c71 !important}
.open-user-map .oum-tabs .nav-item.active {color: #e82c71 !important; border-color: #e82c71 !important}
.open-user-map .box-wrap .map-wrap .oum-attribution a {color: #e82c71 !important;}
/* Submit Button */
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=submit] {background-color: #e82c71 !important; border-color: #e82c71 !important;}
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=submit]:hover,
.open-user-map .add-location .location-overlay-content #oum_add_location input[type=submit]:active {background-color: #d12866 !important;}
/* Message CTA Buttons */
.open-user-map .add-location .location-overlay-content #oum_add_location_thankyou button {background-color: #e82c71 !important; border-color: #e82c71 !important;}
.open-user-map .add-location .location-overlay-content #oum_add_location_thankyou button:hover,
.open-user-map .add-location .location-overlay-content #oum_add_location_thankyou button:active {background-color: #d12866 !important;}
.open-user-map .add-location .location-overlay-content .oum-delete-confirmation button {background-color: #e82c71 !important; border-color: #e82c71 !important;}
.open-user-map .add-location .location-overlay-content .oum-delete-confirmation button:hover,
.open-user-map .add-location .location-overlay-content .oum-delete-confirmation button:active {background-color: #d12866 !important;}
/* Media Section Colors */
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .media-upload label {color: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .oum-image-upload .media-upload-top label .multi-upload-indicator {background: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .oum-video-upload input[type=text]:hover {border-color: #e82c71 !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .oum-video-upload input[type=text]:focus {border-color: #e82c71 !important; box-shadow: 0 0 0 2px #e82c711a !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .image-preview-placeholder {border-color: #e82c71 !important; background: #e82c710a !important}
.open-user-map .add-location .location-overlay-content #oum_add_location .oum_media .oum-image-preview-grid .image-preview-item.dragging {border-color: #e82c71 !important}
/* List Styles */
.open-user-map-locations-list .oum-locations-list-item .oum_location_text a {color: #e82c71 !important}
.open-user-map-locations-list .oum-locations-list-item .oum_location_text .oum_vote_button_wrap .oum_vote_button.voted {background: #e82c71 !important; border-color: #e82c71 !important;}`;
var custom_style = document.createElement('style');
if (custom_style.styleSheet) {
custom_style.styleSheet.cssText = oum_custom_css;
} else {
custom_style.appendChild(document.createTextNode(oum_custom_css));
}
document.getElementsByTagName('head')[0].appendChild(custom_style);
/* Add initial CSS to prevent flash of unstyled content */
var initialStyles = document.createElement('style');
initialStyles.textContent = `
.oum-hidden {
opacity: 0 !important;
visibility: hidden !important;
transition: opacity 0.3s ease, visibility 0.3s ease;
}
.oum-filter-controls,
.open-add-location-overlay,
#oum_filter_markers,
.oum-advanced-filter-button,
.oum-advanced-filter-panel,
.oum-sidebar {
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease;
}
.oum-filter-controls.visible,
.open-add-location-overlay.visible,
#oum_filter_markers.visible,
.oum-advanced-filter-button.visible,
.oum-advanced-filter-panel.visible,
.oum-sidebar.visible {
opacity: 1;
visibility: visible;
}
`;
document.head.appendChild(initialStyles);
}