HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/skl.creativefellows.nl/public/js/app.js
$(document).foundation().ready(function(){
			
	$(".lazy-image, .lazy-load-image").Lazy({
		effect: "fadeIn",
		effectTime : 500,
		enableThrottle: true,
        throttle: 250,
		afterLoad: function(el){
		}
	});
	
	
	$('#acceptCookie').on("click",function(event)
	{
		event.preventDefault();
		var link = $(this).attr("data-link");
		
		$.ajax({
			type: 'POST',
			url: link,
			complete: function(){
				$("#accept-cookies").slideUp("fast");	
			}	
		});
	});


	$(".jarallax").jarallax();
	
	$("[data-find-location]").findLocations();
	
	$(".input__calendar").each(function()
	{
	
		if( $(this).hasClass("no-filter") ){
			$(this).datepicker($.datepicker.regional[ "nl" ]);
		}
		else{

		   $(this).datepicker(	{ minDate: "+7D", beforeShowDay: function(date) {
				var day = date.getDay();
				return [(day != 0 && day != 6), ''];
			}}, $.datepicker.regional[ "nl" ]);

			
		}
		
	});
	
	// checked filled form elements
	$(".input__hidden").each(function(el)
	{
		var check_field 	= $(this).attr("check");
		var input_element 	= this;
	
		$("#"+check_field).on('change', function(event)
		{
			var element = $(this).find('option:selected'); 
			var mail 	= element.attr("rel");
			input_element.value = mail;
		});
		
	});
	
});

let map, bounds;
function initMap(){

	bounds = new google.maps.LatLngBounds();
	map = new google.maps.Map(document.getElementById("map"), {
		center: { lat: 52.1365119, lng: 4.6520323 },
		zoom: 12,
		styles: [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#dde6e8"},{"visibility":"on"}]}]
	});
  

}


$.fn.findLocations = function(){
	
	return this.each(function(){

		var plugin		= $(this);		
		var url			= plugin.attr("action");
		var bounded		= false;		
		var locations 	= null;
		var markers		= [];
		
		var $button 	= plugin.find(".button");
		var $address	= plugin.find("[name=address]");
		var $type		= plugin.find("[name=type]");

		var $details	= $('<div class="location-info"></div>').hide();

			
		plugin.init = function()
		{	
			$button.click( plugin.getLocations );
			$details.insertAfter('#map');
			
			locations = JSON.parse( $(".skl-location-data").html() );
			
			plugin.setLocations(locations);
		}
		
				
		plugin.getLocations = function(event){
			
			event.preventDefault();
			
			$.ajax({
				type: 'POST',
				url: url,
				data:  {
					address: $address.val(),
					type: $type.val(),
				},
				success: function(data){
					
					plugin.setLocations(data);
				}	
			});
			
		}
		
		plugin.reset = function(locations)
		{
			
		    for (let i = 0; i < markers.length; i++) {
		       markers[i].setMap(null);
		    }
			markers = [];
			bounded = false;
		
			$details.hide();
			
		}
		
		
		plugin.setLocations = function(locations)
		{	
			plugin.reset();
		   
			$.each( locations, function( i, location_group ) {
				
				//console.log(location);
		
				var marker = plugin.addMarker(i,location_group);
				
			});	
			
		}
		
		plugin.addMarker = function(city,location_group)
		{
			var location = location_group[0];
			
			var url				= 'https://www.google.nl/maps/vt/icon/name=assets/icons/poi/tactile/pinlet_shadow_v3-2-medium.png,assets/icons/poi/tactile/pinlet_outline_v3-2-medium.png,assets/icons/poi/tactile/pinlet_v3-2-medium.png&highlight=ff000000,ffffff,3fae2a,ffffff?scale=1.25';
			var position 		= new google.maps.LatLng(location.breedtegraad,location.lengtegraad);
			var pan_location	= new google.maps.LatLng(location.breedtegraad,location.lengtegraad-0.025);
			
			var background_img 	= new google.maps.MarkerImage(url);
	
			var marker = new google.maps.Marker({
				position: position,
				map: map,
				icon: background_img,               
			});
	
	
			marker.setMap(map);
	
			if(bounded == false){
				map.panTo(pan_location);
				map.setZoom(14);
				bounded = true;
				
				plugin.setDetails(city,location_group);
			}
		
			plugin.markerClick(marker,location_group,city);
			markers.push(marker);
			
		}
		
		plugin.setDetails = function(city, location_group){
			
			var html = '<h3>'+ city +'</h3>';//location.naam
			html += '<ul class="accordion" data-accordion>';			
		   
		    for (let i = 0; i < location_group.length; i++){
				html += '<li class="accordion-item" data-accordion-item>';
				html += '<a class="accordion-title">'+  location_group[i].naam +'</a>';
				html += '<div class="accordion-content" data-tab-content>'+ location_group[i].adres +'</div>';
				html += '</li>';
		    }
			
			html += "</ul>";
			
			//html += '<p><strong>Afstand: ± '+location.distance+' km</strong></p>';
			//html += '<p><a href="" class="button secondary">Meer informatie</a></p>';
			html += '<span class="close-location" aria-hidden="true">&times;</span>';
			
			
			// location contact
			$details.html(html).show();
			
			var elem = new Foundation.Accordion($details.find("ul.accordion"));
			
			
			$details.find(".close-location").click(function(){
				$details.hide();
			});
		}
		
		plugin.markerClick = function(marker,location_group,city){
			
			
			google.maps.event.addListener(marker, 'click', function() {
				
				plugin.setDetails(city,location_group);
			
			});
			
		}
					
		// init the plugin
	    plugin.init();
		
		
	});
}

function setLocations(locations)
{
	
	
}

function addMarker(latitude,longitude,name)
{

	var url				= 'https://www.google.nl/maps/vt/icon/name=assets/icons/poi/tactile/pinlet_shadow_v3-2-medium.png,assets/icons/poi/tactile/pinlet_outline_v3-2-medium.png,assets/icons/poi/tactile/pinlet_v3-2-medium.png&highlight=ff000000,ffffff,3fae2a,ffffff?scale=1.25';
	var position 		= new google.maps.LatLng(latitude,longitude);
	var background_img 	= new google.maps.MarkerImage(url);
	
	var marker = new google.maps.Marker({
		position: position,
		map: map,
		icon: background_img,               
		zIndex: 3,
		animation: google.maps.Animation.DROP
	});
	
	///
	
	
	marker.setMap(map);
	
	bounds.extend(marker.position);
	map.fitBounds(bounds);
			
}

(function( factory ) {
	if ( typeof define === "function" && define.amd ) {

		// AMD. Register as an anonymous module.
		define([ "../jquery.ui.datepicker" ], factory );
	} else {

		// Browser globals
		factory( jQuery.datepicker );
	}
}(function( datepicker ) {
	datepicker.regional['nl'] = {
		closeText: 'Sluiten',
		prevText: 'Vorige',
		nextText: 'Volgende',
		currentText: 'vandaag',
		monthNames: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni','Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'],
		monthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
		dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
		dayNamesShort: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
		dayNamesMin: ['z','m','d','w','d','v','z'],
		weekHeader: 'Week',
		dateFormat: 'dd-mm-yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''
	};
	datepicker.setDefaults(datepicker.regional['nl']);

	return datepicker.regional['nl'];

}));