$(document).ready(() => {
// setup the form
FFinitialise(‘cad8674f-ed1b-4f01-9e69-4fcb09def99d’,1239, ‘NL’);
});

body .centerBloc {
position: fixed;
top: 50%;
left: 50%;
z-index:40000;
transform: translate(-50%, -50%);
}

/* ##Device = Low Resolution Tablets, Mobiles (Landscape) ##Screen = B/w 481px to 767px */
@media (min-width: 1001px) and (max-width: 100000px) {
.navbar-collapse {
font-size: 140% !important;
}
}

/* ##Device = Low Resolution Tablets, Mobiles (Landscape) ##Screen = B/w 481px to 767px */
@media (min-width: 500px) and (max-width: 1000px) {
.navbar-collapse {
font-size: 120% !important;
}
}

/* end adjustment of fonts in menu */

/*start kaart scrollen*/
@-webkit-keyframes leaflet-gestures-fadein {
0% {
opacity: 0; }
100% {
opacity: 1; } }

@keyframes leaflet-gestures-fadein {
0% {
opacity: 0; }
100% {
opacity: 1; } }

.leaflet-container:after {
-webkit-animation: leaflet-gestures-fadein 0.8s backwards;
animation: leaflet-gestures-fadein 0.8s backwards;
color: #fff;
font-family: “Roboto”, Arial, sans-serif;
font-size: 22px;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 15px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 461;
pointer-events: none; }

.leaflet-gesture-handling-touch-warning:after,
.leaflet-gesture-handling-scroll-warning:after {
-webkit-animation: leaflet-gestures-fadein 0.8s forwards;
animation: leaflet-gestures-fadein 0.8s forwards; }

.leaflet-gesture-handling-touch-warning:after {
content: attr(data-gesture-handling-touch-content); }

.leaflet-gesture-handling-scroll-warning:after {
content: attr(data-gesture-handling-scroll-content); }
/*eind kaart scrollen*/

html, body, #container {
height: 100%;
width: 100%;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
.navcontainer{
z-index:401;
position:absolute;
display:block;
}
.navbar{
box-shadow:none;
}
.navbar-collapse{
padding:12px .75rem 12px .75rem;
box-shadow:0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
background:#ffffff;
}

.leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
border: 0px;
width: 40px !important;
}

.leaflet-touch .leaflet-bar a:last-child, .leaflet-bar a:first-child {
background-color: transparent !important;
font-size: 30px;
color:#ffffff;
}

.leaflet-control-zoom {
background-color: rgba(254,193,12,.8);
border-radius:200px;
padding: 5px 5px 5px 5px !important;
color:#ffffff;
}

.navbarfas, .leaflet-control-zoom {
background-color: rgba(254,193,12,.8);
border-radius:200px;
padding:10px;
color:#ffffff;
}

/* kaart*/
#map {
width: 100%;
height: 100%;
}
.leaflet-popup-content-wrapper{
border-color: rgba(225,19,131,0.9);
border-radius: .125rem;
border-width: 1px;
border-style: solid;
background-color: rgba(255,255,255,0.9);
max-width: 95%;
}
.leaflet-popup-content {
width:315px !important;
color: rgba(225,19,131,0.9);
font-size:1rem;
line-height:20px;
max-width: 95%;}

.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 4;
right: 24;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 20px Tahoma, Verdana, sans-serif;
color: #da718b;
text-decoration: none;
font-weight: bold;
background: transparent;
}

.leaflet-popup-tip{
background:rgba(225,19,131,06);
}
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
width: 33px !important;
height: 33px !important;
background-color: rgba(225, 19, 131, 1);
border: 0px solid #000;
}
.marker-cluster div, .marker-cluster div span{
margin-left: 1px;
margin-top: 1px;
background-color: transparent;
line-height: 34px;
font-size: 18px;
font-weight:bold;
color: #ffffff;
}
.leaflet-container a.leaflet-popup-close-button {
color: #E11383 !mportant;
}
/*formulieren*/
.geforceerd-active{
-webkit-transform: translateY(-14px) scale(.8) !important;
-ms-transform: translateY(-14px) scale(.8) !important;;
transform: translateY(-14px) scale(.8) !important;;
}
.custom-control-input:checked~.custom-control-label::before {
color: rgba(254,193,12,.8);
border-color: rgba(254,193,12,.8);
background-color: rgba(254,193,12,.8);
}

.md-form input[type=text]:focus:not([readonly])+label{
color:rgba(225,19,131,1);
}
.md-form input[type=text]:focus:not([readonly]){
border-bottom:rgba(225,19,131,1);
-webkit-box-shadow:0 1px 0 0 rgba(225,19,131,1);
box-shadow:0 1px 0 0 rgba(225,19,131,1);
}

.modal {
overflow-y:auto;
}
.modal .inschrijven .modal-header{
background:rgba(225,19,131,1);
}
.modal .inschrijven .modal-header h5, .modal .inschrijven .modal-header .close{
color:#ffffff;
font-size:2rem;
}
.modal-footer {
padding-right:2rem
}
.modal-header {
padding-left:2rem
}
.modal-content {
pointer-events: a
}
.modal-footer {
padding-right:2rem
}

/* color of radio buttons*/
.form-check-input[type=”radio”]:checked+label:after, .form-check-input[type=”radio”].with-gap:checked+label:after, label.btn input[type=”radio”]:checked+label:after, label.btn input[type=”radio”].with-gap:checked+label:after {
background-color: rgba(254,193,12,.8);
}

.form-check-input[type=”radio”]:not(:checked)+label:before, .form-check-input[type=”radio”]:not(:checked)+label:after, label.btn input[type=”radio”]:not(:checked)+label:before, label.btn input[type=”radio”]:not(:checked)+label:after {
border: 1px solid #808080;
}

.form-check-input[type=”radio”]:checked+label:after, .form-check-input[type=”radio”].with-gap:checked+label:before, .form-check-input[type=”radio”].with-gap:checked+label:after, label.btn input[type=”radio”]:checked+label:after, label.btn input[type=”radio”].with-gap:checked+label:before, label.btn input[type=”radio”].with-gap:checked+label:after {
border: 1px solid #808080;
}

/* end color of radio buttons */

.bg-primary {
background-color: #E11383 !important;
}

.text-bluemarker {
color: #3E8EDE;
}

.btn {
color: #FFF;
background: #E11383;
}

.btn:hover {
color: #7A0B48;
}

.btn-annuleren:hover{
color:#525456;
}

button.btn-info, button.btn-paars{
background: rgba(225,19,131,1) !important;
color: #FFF;
}

#btn-submit:disabled {
background: #FFE97F;
}

.btn-annuleren{
background:#ced4da;
}

.opportunity-title {
font-weight: 700 !important;
text-transform: uppercase;
color: #3E80C2;
font-family: ‘Prompt’,sans-serif !important;
font-size: 24px;
}
.opportunity-subtitle {
font-weight: 600 !important;
color: #FFF !important;
text-transform: uppercase;
font-family: ‘Prompt’,sans-serif !important;
font-size: 24px !important;
padding-bottom: 13px;
}
.opportunity-text, .opportunity-info{
font-weight: 400 !important;
color: #3E80C2 !important;
font-family: ‘Prompt’,sans-serif!important;
font-size: 13px !important;
}

#toast-container > div {
background-color: #3E8EDE;
}

.opportunity-leftdiv {
padding-top: 20px;
padding-left: 20px;
}

.opportunity-cardcol {
position: relative;
width: 100%;
padding-right: 0px;
padding-left: 0px;
}

.view img, .view video {
margin-left: 8px;
}

.menuline {
margin-top: 8px;
}

.cijfer-pink {
color: #E11383;
font-size: 20px;
}

.cijfer-blue {
color: #3E80C2;
font-size: 20px;
}

#compliencediv {
line-height: 1.1;
margin-left: 5px;
color: #404040;
}

.rotate {
-moz-transition: all .4s linear;
-webkit-transition: all .4s linear;
transition: all .4s linear;
}
.rotate.down {
-moz-transform:rotate(180deg);
-webkit-transform:rotate(180deg);
transform:rotate(180deg);
}

#openfullscreen {
float: right !important;
}

.navcontainer { z-index: 500;}

input[type=’text’], input[type=’number’], textarea {
font-size: 16px;
}

/* color of the switch*/
.switch label input[type=checkbox]:checked+.lever:after {
background-color: #FEC10D;
}

/* margin right of zoom control equal to hamburger margin-left */
.leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
margin-right: 18px;
}

.navbar-collapse {
margin-top: 10px;
padding: 5px 4px 12px 4px;
}

/* stop the glowing blue shadow around the search input*/
.add-on .form-control:focus {
box-shadow:none;
-webkit-box-shadow:none;
//border-color:#cccccc;

}

.input-group {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-align: stretch;
align-items: stretch;
width: 100%;
}

.navbar-nav > li > a {
border-right: 1px solid #ddd;
padding-bottom: 15px;
padding-top: 15px;
}

#input-search {
border: none !important; */
}

.btn-search {
background-color: transparent !important;
//color: grey !important;
border: none !important;
width: 10px;
padding: 12px 20px 2px 10px;
box-shadow: none !important;
}

.fa-search:hover, .fa-times:hover {
color: #3E80C2;
}

.fa-search, .fa-times {
color: grey;
}

.was-validated textarea.form-control:valid, textarea.form-control.is-valid {
color: grey;
border-color: grey !important;
}

.form-control.is-invalid, .was-validated .form-control:invalid {
border-color: grey !important;
}

var totalparticipants = 0 ;
var totalcleanups = 0 ;
var newprogress = 0;
var stepsaantal = 0;
var geocode= ‘373326929472195661181×5788’ ;
actieinfo = null;
var language = $(‘input[name=language]’).val();
if (language == “EN” ) {
var toastr_wronglocationclicked = ‘Je klikte op de kaart op een locatie buiten Nederland, op het water of zonder adresgegevens.’;
} else {
var toastr_wronglocationclicked = ‘You clicked at a foreign location, on water or without a specified address.’;
}

$( document ).ready(function() {

var singlecleanup = $(‘#singlecleanup’).val();

if ( singlecleanup > 0 ) {

retval = getsinglecleanup(singlecleanup);
} else {

stepsaantal = 25

$(‘#modalProgress’).modal(‘show’);
//getcleanups(0,1);

var retval = 0;
var step = 20;
var offset = step *-1 + 0;

for (i = 0; i < stepsaantal; i++) {

offset = offset+step;
retval = getcleanups(offset,step);

// if (retval = 0) {
// alert(totalcleanups);
// $('#modalProgress').modal('hide');
// break;
// }
}

}
});

var singlecleanup = $(‘#singlecleanup’).val();
if ( singlecleanup > 0 ) {
var zoomlevel = 15;
lat = 0;
lng = 0;
} else {
var zoomlevel = 8;
lat = 52.0704978;
lng = 4.3006999;
}

//var map = L.map(‘map’).setView([52.0704978, 4.3006999], 8);

var NewMarker = {};
var map = L.map(“map”, {
center: [lat,lng],
zoom: zoomlevel,
gestureHandling: true
});

map.zoomControl.setPosition(‘bottomright’);

L.tileLayer(‘https://{s}.tile.osm.org/{z}/{x}/{y}.png’, {
attribution: ‘© OpenStreetMap | FundFactory
}).addTo(map);
map.attributionControl.setPosition(‘bottomleft’);

var markers = L.markerClusterGroup();

var singlecleanup = $(‘#singlecleanup’).val();

if ( singlecleanup > 0 ) {

var Iconpink = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_pink_transparent_whiteeye.png’,
iconSize: [150,150], // size of the icon

iconAnchor: [23,50], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, 40] // point from which the popup should open relative to the iconAnchor
});

} else {
var Iconpink = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_pink_transparent_whiteeye.png’,
iconSize: [50,50], // size of the icon

iconAnchor: [23,50], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, 40] // point from which the popup should open relative to the iconAnchor
});

}

var Iconclosed = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_pink_transparent_lockeye.png’,
iconSize: [50,50], // size of the icon
iconAnchor: [23,50], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, 40] // point from which the popup should open relative to the iconAnchor
});

var markers = L.markerClusterGroup();
map.addLayer(markers);

//// ADD MARKER CROWN
// getmarkercrown();

// $(‘.navbar-toggler’).click();

// CLICK ON A CLUSER MARKER
markers.on(‘clusterclick’, function() {
$(‘.navbar-collapse’).collapse(‘hide’); });

// CLICK ON THE MAP ITSELF
map.on(‘click’, function(e) {
var Icon = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_blue_transparent_whiteeye.png’,
iconSize: [65,65], // size of the icon
iconAnchor: [30,60], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, -76] // point from which tfhe popup should open relative to the iconAnchor
});

if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};

$(“#latlng_lat”).val(e.latlng.lat);
$(“#latlng_lng”).val(e.latlng.lng);
var x = geo_reverse();

// langlot geeft buitenlands adres terug
if ( actieinfo.includes(“buitenland”) ) {
toastr.info(toastr_wronglocationclicked);
} else {

// adres/straatnaam is complexer, object er uit halen
if ( actieinfo.includes(“object”) ) {
actieinfo = actieinfo.replace(“[object Object], “, “”);
}
// langlot geeft geen resultaat
if ( actieinfo.includes(“undefined”) ) {
actieinfo = null;
toastr.info(‘Je klikte op de kaart op een plek zonder locatie-aanduiding’);
}

if (actieinfo !== null && actieinfo !== ”) {

$(‘.navbar-collapse’).collapse(‘hide’);

NewMarker = L.marker([e.latlng.lat, e.latlng.lng], {icon: Icon}, {id: 999999999}).addTo(map);
NewMarker.on(‘click’, newmarkerOnClick)
////// NewMarker.bindTooltip( ‘‘+ actieinfo +’
‘ + var_textparticipate).openTooltip();

map.setView([e.latlng.lat, e.latlng.lng], 15);

$(‘#modal_confirmstart’).modal(‘show’);
}
}
});

// GET SINGLE CLEANUP FROM BACKEND
function getsinglecleanup(recordid) {

if (recordid != 0) {
// fetch data from server
const url = ‘https://fundfactory.bettywebblocks.com/portal/getjson?model=opportunity&idstart=’ + recordid;
const request = new XMLHttpRequest();
request.open(‘GET’, url, true);
request.onload = function() {
if (request.status === 200) {
const item = JSON.parse(request.responseText);

id = item[0].id;
max_groupmembers = item[0].max_groupmembers;
name = item[0].name;
ownername = item[0].ownername;
locatie = item[0].location;
cl_description = item[0].description;
begin = item[0].begin;
cl_duration = item[0].duration;
cl_lat = item[0].lat;
cl_lng = item[0].lng;
cl_type = ‘wcf’;
cl_url = ”;

setcleanup(item[0], ‘single’); // put the cleanup on the map!

$(“#opportunity-title”).html(item[0].name);
shorteneddescription = jQuery.trim(item[0].description).substring(0, 100).trim(item[0].description) + “…”;
$(“#opportunity-text”).html(shorteneddescription);
$(“#opportunity-starttime”).html(item[0].begin);
$(“#opportunity-duration”).html(item[0].duration);
$(“#opportunity-numparticipants”).html(item[0].groupmembers);
$(“#opportunity-maxparticipants”).html(item[0].max_groupmembers);
$(“#address_info”).html(item[0].name);

$(“#eventlocation”).html(item[0].name);

} else {
// Reached the server, but it returned an error
}
}

request.onerror = function() {
console.error(‘An error occurred fetching the JSON from ‘ + url);
};
request.send();
// end fetch data from server

} else {
// no need to fetch data: new record
$(“.opportunity-title”).html(”);
$(“.opportunity-text”).html(”);
}

// end: get event data from backend
}

// GET CLEANUPS
function getcleanups(startnum, endnum) {
// fetch data from server
const url = ‘https://fundfactory.bettywebblocks.com/portal/getjson?model=cleanups&idstart=’ + startnum + ‘&idend=’ + endnum;

const request = new XMLHttpRequest();
var numcleanups = 0;
request.open(‘GET’, url, true);
request.onload = function() {
if (request.status === 200) {
const response = JSON.parse(request.responseText);

var numcleanups = Object.keys(response).length;
totalcleanups = totalcleanups + numcleanups ;

$(function() {
$.each(response, function(i, item) {

if (item.max_groupmembers > 0) { var g_max = item.max_groupmembers; } else { var g_max = 0};
if (item.count_groupmembers > 0) { var g_num = item.count_groupmembers; } else { var g_num = 0};
var max_reached = (g_max > 0 && g_num >= g_max);

var numparticipants = item.groupmembers + item.count_groupmembers + 1;
totalparticipants = totalparticipants + numparticipants;
count_groupmembers = item.groupmembers;
groupmembers = item.count_groupmembers;

id = item.id;
max_groupmembers = item.max_groupmembers;
name = item.name;
ownername = item.ownername;
cl_locatie = ( item.location ?? “”); // get rid of null in string
cl_description = item.description;
begin = item.begin;
cl_duration = item.duration;
cl_lat = item.lat;
cl_lng = item.lng;
cl_type = ‘wcf’;
cl_url = ”;

if (item.closed_event == true ) {
setcleanupclosed(item); // put the closed cleanup on the map!
} else {
if ( max_reached ) {
setcleanupmaxreached(item); // put the max participants cleanup on the map!
} else {
setcleanup(item); // put the cleanup on the map!
}

}
});

if (totalcleanups == 0) {
var toonaantal = “de”
} else {
var toonaantal = totalcleanups
}

if ( $(“#language”).val() == ‘EN’ ) {
var progresstekst = ‘Loading ‘ + toonaantal + ‘ cleanups…’ ;
} else {
var progresstekst = ‘Bezig met het laden van ‘ + toonaantal + ‘ opruimacties… ‘ ;
}
newprogress = newprogress + 1;
$(‘#progressbar’).width(newprogress*5 + “%”).attr(‘aria-valuenow’, newprogress*5);
$(‘#exampleModalLongTitle’).html( progresstekst);

if (newprogress == stepsaantal) {
getnscleanups() ;
$(‘#progressbar’).width(100 + “%”).attr(‘aria-valuenow’, 100);
setTimeout(cancelProgress(), 2000);
$(‘.navbar-collapse’).collapse(‘show’);
}

});
translateTexts();
return numcleanups;

} else {
// Reached the server, but it returned an error
// code here
return 0;
}

request.onerror = function() {
//code here
return 0;
};
};
request.send();
// end fetch data from server
// end: get event data from backend
}

/////////////////////////////////////////////////////////////////////

// GET NEDERLAND SCHOON CLEANUPS
function getnscleanups() {
// fetch data from server
const url = ‘https://fundfactory.bettywebblocks.com/portal/getjson?model=nscleanups’;
const request = new XMLHttpRequest();
request.open(‘GET’, url, true);
request.onload = function() {
if (request.status === 200) {

var s = request.responseText;

const responsem = JSON.parse(s);
const response = responsem[0];
var numcleanups = Object.keys(response.features).length;
totalcleanups = totalcleanups + numcleanups ;

$(function() {
$.each(response.features, function(i, item) {
var numparticipants = item.properties.Participants;
totalparticipants = totalparticipants + numparticipants;
id = item.properties.Id;
max_groupmembers = 0;
name = item.properties.Name;
groupmembers = item.properties.Participants;
count_groupmembers = 0;
cl_locatie = item.properties.Address + ‘, ‘ + item.properties.City;
ownername = item.properties.OwnerName;
cl_description = item.properties.IntroText;
begin = nicedate(item.properties.Date) + ‘, ‘ + item.properties.StartTime;
cl_duration = item.properties.StartTime + ‘ – ‘ + item.properties.EndTime;
cl_lat = item.geometry.coordinates[1];
cl_lng = item.geometry.coordinates[0];
cl_type = ‘ns’;
cl_url = item.properties.DetailsUrl;

if (item.properties.OpenForParticipation === true ) {
setcleanup(item); // put the cleanup on the map!
} else {
setcleanupclosed(item); // put the closed cleanup on the map!
}
});

});

// bog een keer transalte text om aantal bij te werken in popup modal
translateTexts();

return numcleanups;

} else {
// Reached the server, but it returned an error
// code here
return 0;
}

request.onerror = function() {
//code here
return 0;
};
};
request.send();
// end fetch data from server
// end: get event data from backend
}

/////////////////////////////////////////////////////////////////////

// CLICK ON A NEWMARKER IN THE MAP
function newmarkerOnClick(e) {

$(‘.navbar-collapse’).collapse(‘hide’);

$(‘#formmodalsubmit’).removeClass(‘was-validated’); // remove all validation messages when subsequently opening modal

$(“#activeform”).val(“ORGANISEER”);
$(“#eventlocation”).text( $(“#address_info”).val() );

$(“.hidesubscribe”).show();
// initially hide organisation, because default is individual
$(‘#opporganisation’).hide();
$(‘#organisationtype’).hide();

$(‘#text_organisation’).hide();
$(‘label[for=”opporganisation”]’).hide();
$(‘#input-oppgroupmembers’).hide();
$(‘#text-oppgroupmembers’).hide();
$(‘#feedback-oppgroupmembers’).hide();
$(‘#input-oppmaxgroupmembers’).show();
$(‘#text-oppmaxgroupmembers’).show();
$(“#opportunity_name”).attr(“required”, true);
$(“#opportunity_duration”).attr(“required”, true);
$(“#opportunity_begin”).attr(“required”, true);
$(“#opportunity_locationinfo”).attr(“required”, true);
$(“#opportunity_description”).attr(“required”, true);
//$(“#input-oppgroupmembers”).attr(“required”, true);
$(‘#opporganisation’).attr(“required”, false);

//$(‘#btn-submit’).removeClass(‘submit-deelname’);
//$(‘#btn-submit’).addClass(‘submit-cleanup’);

$(‘#formmodal’).modal(‘show’);

}

// CLICK ON A MARKER IN THE MAP
function markerOnClick(e) {
// $(‘.navbar-toggler’).click();
$(‘.navbar-collapse’).collapse(‘hide’);
// store marker id to hidden input
$(“#markerid”).val(this.options.id);
// get other info fromm the clicked event to be stored in hidden inputs
var x = geteventinfo(this.options.id);

};

// ON CLICK OF -DOE MEE- BUTTON BIJ SPECIFIEKE ACTIE

$(document).on(‘click’, ‘#schrijfindeelnemer2’, function() {

//$(‘#btn-submit’).addClass(‘submit-deelname’);
//$(‘#fbtn-submit’).removeClass(‘submit-cleanup’);

if ( $(“#language”).val() == ‘EN’ ) {
$(“#formmodaltitlelabel”).text(“Take part in this cleanup event”);
$(“#complience”).text(“Plastic Soup Foundation will share the above information with the cleanup organizer so that he/she can contact you about it if necessary. For more information see our “);
} else {
$(“#formmodaltitlelabel”).text(“Schrijf je in als deelnemer”);
$(“#complience”).text(“Plastic Soup Foundation deelt bovenstaande gegevens met de organisator van de opruimactie, zodat hij/zij indien nodig contact kan opnemen m.b.t. de opruimactie. Zie voor meer informatie onze “);
}

$(“#complience2”).text(“”); // do not show!

$(“#activeform”).val(“DOEMEE”);
// hide unwanted form objects and clear some values

$(“.hidesubscribe”).hide();
$(‘#opporganisation’).removeAttr(‘required’);
$(‘#opportunity_name’).removeAttr(‘required’);
$(‘#opportunity_duration’).removeAttr(‘required’);
$(‘#opportunity_begin’).removeAttr(‘required’);
$(‘#opportunity_locationinfo’).removeAttr(‘required’);
$(‘#opportunity_description’).removeAttr(‘required’);
$(‘#input-oppgroupmembers’).removeAttr(‘required’);

//set hidden id & location info
var actieid = $(“#schrijfindeelnemer2”).data(‘oppid’);
$(“#subscribe_group”).val(actieid);
$(“#markerid”).val(actieid);
var x = geteventinfo(actieid);

});

// ON CLICK OF START CLEANUP BUTTON
$(document).on(‘click’, ‘#btn-startcleanupssubmit’, function() {

$(‘#formmodalsubmit’).removeClass(‘submit-deelname’);
$(‘#formmodalsubmit’).add

if ( $(“#language”).val() == ‘EN’ ) {
$(“#formmodaltitlelabel”).text(“Create your own cleanup event”);
$(“#complience”).text(“Plastic Soup Foundation will share the information above with other participants of your cleanup so that they can contact you if necessary regarding the cleanup campaign. For more information, see our “);
$(“#complience2”).text(“This year we are organizing World Cleanup Day together with NederlandSchoon; that’s why your action will be visible on the map of Supporter van Schoon – initiative of NederlandSchoon. Your details (such as your name and email address) are not visible on the map.”);

} else {
$(“#formmodaltitlelabel”).text(“Organiseer je eigen opruimactie”);
$(“#complience”).text(“Plastic Soup Foundation deelt bovenstaande gegevens met andere deelnemers van jouw opruimactie, zodat zij indien nodig contact kunnen opnemen m.b.t. de opruimactie. Zie voor meer informatie onze “);
$(“#complience2”).text(“Dit jaar organiseren we World Cleanup Day samen met NederlandSchoon, daarom is jouw actie na aanmelding ook zichtbaar op de kaart van Supporter van Schoon – initiatief van NederlandSchoon. Jouw persoonsgegevens (zoals je naam en emailadres) zijn niet op de kaart te zien.”);
}

$(“#modal_confirmstart”).modal(‘hide’);
if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};
newmarkerOnClick();
});

// ON CLICK OF CANCEL START CLEANUP BUTTON
$(document).on(‘click’, ‘#btn-startcleanupclose’, function() {
$(“#modal_confirmstart”).modal(‘hide’);

// var xlat = $(“#latlng_lat”).val();
// var xlng = $(“#latlng_lng”).val(xlng);
var zoomlevel = 8;
xlat = 52.0704978;
xlng = 4.3006999;

// map.flyTo([xlat, xlng], zoomlevel, {
// animate: false,
// duration: 1 // in seconds
// });

if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};

});

// ON CLICK OF -DOE MEE- BUTTON
$(document).on(‘click’, ‘#schrijfindeelnemer’, function() {

if ( $(“#language”).val() == ‘EN’ ) {
$(“#formmodaltitlelabel”).text(“Take part in this cleanup event”);
$(“#complience”).text(“Plastic Soup Foundation will share the above information with the cleanup organizer so that he/she can contact you about it if necessary. For more information see our “);
} else {
$(“#formmodaltitlelabel”).text(“Schrijf je in als deelnemer”);
$(“#complience”).text(“Plastic Soup Foundation deelt bovenstaande gegevens met de organisator van de opruimactie, zodat hij/zij indien nodig contact kan opnemen m.b.t. de opruimactie. Zie voor meer informatie onze “);
}

$(“#activeform”).val(“DOEMEE”);
// hide unwanted form objects and clear some values

$(“.hidesubscribe”).hide();
$(‘#opporganisation’).removeAttr(‘required’);
$(‘#opportunity_name’).removeAttr(‘required’);
$(‘#opportunity_duration’).removeAttr(‘required’);
$(‘#opportunity_begin’).removeAttr(‘required’);
$(‘#opportunity_locationinfo’).removeAttr(‘required’);
$(‘#opportunity_description’).removeAttr(‘required’);
$(‘#input-oppgroupmembers’).removeAttr(‘required’);
$(“#eventlocation”).text( $(“#address_info”).val() );
});

// on click of search button
$(document).on(‘click’, ‘#btn-search’, function() {

x= geo_forward();
});

// on click of clear search button
$(document).on(‘click’, ‘#btn-clearsearch’, function() {

$(‘#input-search’).val(”);
if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};
map.setView([52.0704978, 4.3006999], 8);
});

// nav-item button click
$(‘.nav-item button’).on(‘click’, function(){
// collapse navbar up when a menu option is clicked
$(‘.navbar-toggler’).click();
});

// on show of modal form formmodal
$(‘#formmodal’).on(‘show.bs.modal’, function (e) {
$(‘#mapnavbar’).collapse({ ’toggle’: false }).collapse(‘hide’);
map.closePopup();
$(‘#navbartoggle’).prop(‘disabled’, true);
});

// on hide of modal form formmodal
$(‘#formmodal’).on(‘hidden.bs.modal’, function () {
$(“#activeform”).val(“”);
$(“#formmodaltitlelabel”).text(“-“);
$(‘#navbartoggle’).prop(‘disabled’, false);
})

// GET EVENT DATA FROM BACKEND
function geteventinfo(recordid) {
if (recordid != 0) {
// fetch data from server
const url = ‘/opportunity/?id=’ + recordid;
const request = new XMLHttpRequest();
request.open(‘GET’, url, true);
request.onload = function() {
if (request.status === 200) {

const opportunity = JSON.parse(request.responseText);
$(“#address_info”).val(opportunity[0].name);
$(“#subscribe_group”).val(opportunity[0].id);
$(“#eventlocation”).text(opportunity[0].name);
} else {
$(“#address_info”).val(“”);
$(“#subscribe_group”).val(“”);
$(“#eventlocation”).text(“”);

// Reached the server, but it returned an error
}

}

request.onerror = function() {
console.error(‘An error occurred fetching the JSON from ‘ + url);
};
request.send();
// end fetch data from server

} else {
// no need to fetch data: new record
$(“#opportunity_name”).val(“”);
$(“#opportunity_description”).val(“”);
$(“#opportunity_closed_event”).html(“”);
$(“#formmodaltitlelabel”).text(“”);
$(“#address_info”).val(“”);
}

// end: get event data from backend
}

function geo_reverse() {
// FETCH ADDRESS INFO FROM LNG/LAT
// https://geocode.xyz/51.50354,-0.12768?geoit=json
var xlat = $(“#latlng_lat”).val();
var ylng = $(“#latlng_lng”).val();
$(“#address_name”).val(“”);
$(“#address_state”).val(“”);
$(“#address_address”).val(“”);
$(“#address_city”).val(“”);
$(“#address_info”).val(“”);
$(‘#newlocationinfo’).text(“”);
actieinfo = null;

if (xlat.length > 0) {
// fetch data from server
// GEOCODE key zoals vorig jaar gebruikt:”304225343058305750426×2480
const url = ‘https://geocode.xyz/’+ xlat + ‘,’ + ylng + ‘?json=1&auth=’ + geocode;
const request = new XMLHttpRequest();
request.open(‘GET’, url, false); // false = synchronous, true = asynchronous
request.onload = function() {
if (request.status === 200) {
response = ‘[‘+ request.responseText + ‘]’;

var n = response.search(“Netherlands”);

if (n > -1) {

const geo = JSON.parse(response);
// $(“#address_name”).val(geo[0].osmtags.name);
$(“#address_state”).val(geo[0].state);
var street = geo[0].staddress + ‘ ‘ + geo[0].stnumber;
$(“#address_address”).val(street);
$(“#address_city”).val(geo[0].city);
$(“#address_info”).val(geo[0].staddress + ‘, ‘+ geo[0].city);

actieinfo = $(“#address_info”).val();
$(‘#newlocationinfo’).text(actieinfo);

} else {
actieinfo = “buitenland”;
$(“#address_info”).val(“buitenland”);
}

} else {
// Reached the server, but it returned an error
}
}
request.onerror = function() {
};
request.send();
// end fetch data from server

} else {
// no need to fetch data: new record.val();
}
// end: get event data from backend
}

// ENTER IN SEARCH INPUT TRIGGERS SEARCH
$(“#input-search”).on(‘keyup’, function (e) {
if (e.keyCode == 13) {
x= geo_forward();
}
});

// FETCH LNG/LAT BASED ON ADDRESS INFO
function geo_forward() {
// https://geocode.xyz/51.50354,-0.12768?geoit=json
var xaddressinfo = $(“#input-search”).val();

$(“#address_name”).val(“”);
$(“#address_state”).val(“”);
$(“#address_address”).val(“”);
$(“#address_city”).val(“”);
$(“#address_info”).val(“”);

if (1===1) {
// fetch data from server
const url = ‘https://geocode.xyz/’+ xaddressinfo + ‘?json=1&auth=’+geocode;

const request = new XMLHttpRequest();
request.open(‘GET’, url, false); // false = synchronous, true = asynchronous
request.onload = function() {
if (request.status === 200) {
response = ‘[‘+ request.responseText + ‘]’;
const geo = JSON.parse(response);
xlat = geo[0].latt;
xlng = geo[0].longt;

$(“#latlng_lat”).val(xlat);
$(“#latlng_lng”).val(xlng);

var countryname = geo[0].standard.countryname;
var locinfo = geo[0].standard.addresst + ‘, ‘ + geo[0].standard.city ;
locinfo = locinfo.replace(“[object Object], “, “”);
$(“#address_info”).val(locinfo);

if (countryname == ‘Netherlands’) {
$(‘.navbar-collapse’).collapse(‘hide’);

$(“#input-search”).val(locinfo); // store location in search input, so we have visual feedback.
var Icon = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_blue_transparent_whiteeye.png’,
iconSize: [65,65], // size of the icon
iconAnchor: [30,60], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
});

if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};
actieinfo = $(“#address_info”).val();
NewMarker = L.marker([xlat, xlng], {icon: Icon}, {id: 999999999}).addTo(map);
NewMarker.on(‘click’, newmarkerOnClick);
/////NewMarker.bindTooltip( ‘‘+ actieinfo +’
‘ + var_textparticipate).openTooltip();

$(‘#newlocationinfo’).text(locinfo);
$(‘#modal_confirmstart’).modal(‘show’);

map.flyTo([xlat, xlng], 16, {
animate: false,
duration: 1 // in seconds
});

}
else {
toastr.info(‘Locatie is niet bekend of niet in Nederland’);
}

// $(“#address_name”).val(geo[0].osmtags.name);
// $(“#address_state”).val(geo[0].osmtags.state);
// $(“#address_address”).val(geo[0].staddress + ‘ ‘ + geo[0].stnumber);
// $(“#address_city”).val(geo[0].city);
// $(“#address_info”).val(geo[0].staddress + ‘ in ‘+ geo[0].city);

} else {
// Reached the server, but it returned an error
}
}
request.onerror = function() {
};
request.send();
// end

} else {
// no need to fetch data: new record.val();
}
// end: get event data from backend
}

// hode/show organisation input on change of radio button
$(‘#opportunity_isorganisation’).on(‘change’, function () {
//var checked = new Boolean(this.checked);
if (this.checked) {
$(‘#opporganisation’).show();
$(‘#text-opporganisation’).show();
$(‘#organisationtype’).show();

$(‘label[for=”opporganisation”]’).show();
$(‘#opporganisation’).attr(“required”, true);

} else {
$(‘#opporganisation’).hide();
$(‘#organisationtype’).hide();
$(‘#text_opporganisation’).hide();
$(‘label[for=”opporganisation”]’).hide();
$(‘#opporganisation’).removeAttr(‘required’);
}
});

// hide/show number of participants input on change of checkbox
$(‘#opportunity_closed_event’).on(‘change’, function () {
if($(this).is(“:checked”))
{
$(‘#input-oppgroupmembers’).show();
$(‘#text-oppgroupmembers’).show();
$(‘#input-oppgroupmembers’).attr(“required”, true);
$(‘#input-oppmaxgroupmembers’).hide();
$(‘#text-oppmaxgroupmembers’).hide();
$(‘#feedback-oppgroupmembers’).show();
$(‘#feedback-oppmaxgroupmembers’).hide();

}
else
{
$(‘#input-oppgroupmembers’).hide();
$(‘#text-oppgroupmembers’).hide();
$(‘#input-oppgroupmembers’).removeAttr(‘required’);
$(‘#input-oppmaxgroupmembers’).show();
$(‘#text-oppmaxgroupmembers’).show();
$(‘#feedback-oppgroupmembers’).hide();
$(‘#feedback-oppmaxgroupmembers’).show();

}
});

// JUST CREATE ONE PINK MARKER AFTER CREATION OF NEW EVENT
function createpinkmarker(p1, p2, p3) {

if ( $(“#language”).val() == ‘EN’ ) {
var var_textactieinaanvraag = ‘This cleanup event is now being processed.
Give it a moment and refresh this page to reflect the change.’;
} else {
var var_textactieinaanvraag = ‘Ververs de pagina om de actie op de kaart te zien.
Het kan een paar minuten duren voor de gegevens verwerkt zijn en dus zichtbaar worden.’;
}

var Iconpink = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_pink_transparent_yellowstareye.png’,
iconSize: [50,50], // size of the icon
iconAnchor: [23,50], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, 40] // point from which the popup should open relative to the iconAnchor
});
var title = ‘‘ + p1 + ‘
‘ + var_textactieinaanvraag ;

var marker = L.marker(new L.LatLng(p2, p3), {
icon: Iconpink,
id: 999999
}).on(‘click’, markerOnClick)
marker.bindPopup(title);
marker.bindTooltip(title).openTooltip();
markers.addLayer(marker);

}

function toggleFullScreen() {
alert(“togglefuillscreen”);
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {

$(‘.navbar-collapse’).collapse(‘hide’);

if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (document.documentElement.webkitEnterFullScreen) {
document.documentElement.webkitEnterFullScreen();
}

// var e = document.getElementById(“expand”);
// var c = document.getElementById(“collaps”);
// e.style.display = “none”;
// c.style.display = “block”;

} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
// var e = document.getElementById(“expand”);
// var c = document.getElementById(“collaps”);
// e.style.display = “block”;
// c.style.display = “none”;
}
}

// rotate the top buttons on button click or avbar collapse
$(‘.navbar-collapse’).on(‘show.bs.collapse’, function () {
// Change menu margin from 60 to 0 when collapsed and 0 to 60 when expanded
// Change logo left padding to 10 when collapsed and 0 when expanded
$(“.rotate”).toggleClass(“down”);
});
$(‘.navbar-collapse’).on(‘hide.bs.collapse’, function () {
// Change menu margin from 60 to 0 when collapsed and 0 to 60 when expanded
// Change logo left padding to 10 when collapsed and 0 when expanded
$(“.rotate”).toggleClass(“down”);
});

function getmarkercrown() {

//////////////////////////////////////////////////////////////////////////////////////////////////////
var IconCrown = L.icon({
iconUrl: ‘https://fundfactory.nl/resources/markerWCD_crown512.png’,
iconSize: [80,80], // size of the icon
iconAnchor: [23,50], // point of the icon which will correspond to marker’s location
popupAnchor: [-3, 40] // point from which the popup should open relative to the iconAnchor
});

var marker = L.marker([51.814947, 5.246667],
{
icon: IconCrown,
}
).addTo(map);

var crowndescript = ‘ Landelijk startschot World Cleanup Day NL
‘ +
‘Rivieren zijn belangrijke toevoerwegen van plasticafval naar zee. Daarom organiseert Plastic Soup Foundation op World Cleanup Day een landelijk evenement langs de Waal.’+
‘Op de Waalkade in Zaltbommel (ter hoogte van nr. 6 Grand Café De Verdraagzaamheid) lost de burgemeester om 10.00 uur het symbolisch startschot van alle opruimacties ‘+
‘in het land. Hier starten en eindigen enkele opruimacties.’+
‘Diverse bedrijven tonen hier tussen 12.00 en 15.00 uur hun innovatieve opvangsystemen om plastic uit rivieren te halen. Kom kijken en doe mee!’;

var crowntipdescript = ‘

Landelijk startschot
World Cleanup Day NL

‘ +

Rivieren zijn belangrijke toevoerwegen
van plasticafval naar zee.
‘+
‘Daarom organiseert Plastic Soup Foundation
op World Cleanup Day een landelijk
‘+
‘evenement langs de Waal.
Op de Waalkade in Zaltbommel
(ter hoogte van nr. 6
Grand Café De Verdraagzaamheid)
Iedereen is welkom. Kom ook!

‘;

//marker.bindPopup(crowndescript);
//marker.bindTooltip(crowntipdescript);
marker.bindTooltip(crowntipdescript, {className: “info”, direction: “bottom”, offset: [17,17] });
/////////////////////////////////////////////////////////////////////////////////////////////////////

}

function postdata() {

$(“#btn-submit”).attr(“disabled”, true);

var csrf = $(‘input[name=_csrf]’).val();

if($(‘#opportunity_closed_event’).is(“:checked”)){
var opportunity_closed_event = ‘Ja’;
}
else if($(this).is(“:not(:checked)”)){
var opportunity_closed_event = ”;
}

if($(‘#mailpermission’).is(“:checked”)){
var mailpermission = ‘Ja’;
}
else if($(this).is(“:not(:checked)”)){
var mailpermission = ”;
}

if($(‘#consent’).is(“:checked”)){
var consent = ‘Ja’;
}
else if($(this).is(“:not(:checked)”)){
var consent = ”;
}

var category = “”;
var concerns = “”;
var customeruuid = $(‘input[name=customeruuid]’).val();
var email = $(‘input[name=email]’).val();
var firstname = $(‘input[name=firstname]’).val();
var gender = $(‘input[name=gender]’).val();
var info = “”;
var initials = $(‘input[name=initials]’).val();
var interest = $(‘input[name=interest]’).val();
var keyword = $(‘input[name=keyword]’).val();
var language = $(‘input[name=language]’).val();
var lastname = $(‘input[name=lastname]’).val();
var middlename = $(‘input[name=middlename]’).val();

if ( $(“#activeform”).val() == “ORGANISEER”) {
var opportunity_begin = $(‘input[name=opportunity_begin]’).val();
var opportunity_description = $(’textarea[name=opportunity_description]’).val();
var opportunity_duration = $(‘input[name=opportunity_duration]’).val();
var opportunity_eventinfo = “”;
var opportunity_lat = $(‘input[name=opportunity_lat]’).val();
var opportunity_lng = $(‘input[name=opportunity_lng]’).val();
var opportunity_location = $(‘input[name=opportunity_location]’).val();
var opportunity_locationinfo = $(’textarea[name=opportunity_locationinfo]’).val();
var opportunity_name = $(‘input[name=opportunity_name]’).val();
var opportunity_type = $(‘input[name=opportunity_type]’).val();

if($(‘#opportunity_closed_event’).is(“:checked”)){
var opportunity_numberofparticipants = $(‘input[name=opportunity_numberofparticipants]’).val();
var opportunity_maxnumberofparticipants = “”;
} else {
var opportunity_numberofparticipants = “”;
var opportunity_maxnumberofparticipants = $(‘input[name=opportunity_maxnumberofparticipants]’).val();
}

if($(‘#opportunity_isorganisation’).is(“:checked”)){
var organisation = $(‘input[name=opporganisation]’).val();
var organisation_type = $(“input[name=’organisation_type’]:checked”).val(); //$(‘input[name=organisation_type]’).val();
} else {
var organisation = ”;
var organisation_type = ”;
}

var phone = “”;
var subscribe_group = “”;
var type = “20”;

// hide blue pin!! Add pink Pin!!
if (NewMarker != undefined) {
map.removeLayer(NewMarker);
};

createpinkmarker(opportunity_name, opportunity_lat, opportunity_lng);

} else {
var opportunity_begin = “”;
var opportunity_description = “”;
var opportunity_duration = “”;
var opportunity_eventinfo = “”;
var opportunity_lat = “”;
var opportunity_lng = “”;
var opportunity_location = “”;
var opportunity_locationinfo = “”;
var opportunity_name = “”;
var opportunity_closed_event = “”;
var opportunity_type = “”;
var opportunity_numberofparticipants = “”;
var opportunity_maxnumberofparticipants = “”;
var phone = “”;
var subscribe_group = “actie:” + $(“#subscribe_group”).val();
var type = “”;
var organisation = ”;
var organisation_type = ”;

};

$.post(“/public/contact”,
{
‘_csrf’: csrf,
‘category’: category,
‘concerns’: concerns,
‘customeruuid’: customeruuid,
‘email’: email,
‘firstname’: firstname,
‘gender’: gender,
‘info’: info,
‘initials’: initials,
‘interest’: interest,
‘keyword’: keyword,
‘language’: language,
‘lastname’: lastname,
‘mailpermission’: mailpermission,
‘consent_privacy’: consent,
‘middlename’: middlename,
‘opportunity_begin’: opportunity_begin,
‘opportunity_description’: opportunity_description,
‘opportunity_duration’: opportunity_duration,
‘opportunity_eventinfo’: opportunity_eventinfo,
‘opportunity_lat’: opportunity_lat,
‘opportunity_lng’: opportunity_lng,
‘opportunity_location’: opportunity_location,
‘opportunity_locationinfo’: opportunity_locationinfo,
‘opportunity_name’: opportunity_name,
‘opportunity_type’: opportunity_type,
‘opportunity_closed_event’: opportunity_closed_event,
‘opportunity_numberofparticipants’: opportunity_numberofparticipants,
‘opportunity_maxnumberofparticipants’: opportunity_maxnumberofparticipants,
‘organisation’: organisation,
‘organisation_type’: organisation_type,
‘phone’: phone,
‘subscribe_group’: subscribe_group,
’type’: type
}
);

$(‘#formmodal’).modal(‘hide’);
$(“#btn-submit”).attr(“disabled”, false);

var language = $(‘#language’).val();

if ( $(“#activeform”).val() == “ORGANISEER”) {
//$(‘#confirm4’).show();
//$(‘#confirm5’).show();

if (language=’EN’) {
window.open(“https://www.worldcleanupday.nl/en/bevestiging-organisator/”);
} else {
window.open(“https://www.worldcleanupday.nl/bevestiging-organisator/”);
}

} else {
//$(‘#confirm4’).hide();
//$(‘#confirm5’).hide();

if (language=’EN’) {
window.open(“https://www.worldcleanupday.nl/en/bevestiging/”);
} else {
window.open(“https://www.worldcleanupday.nl/bevestiging/”);
}

}
//$(‘#neweventconfirm’).modal(‘show’);

}

function setcleanup(item, single) {

if ( $(“#language”).val() == ‘EN’ ) {
var text_starttime = ‘ Start: ‘;
var text_duration = ‘ Duration: ‘;
var text_numparticipants = ‘ Participants: ‘;
if ( max_groupmembers > 0 ) {
var text_maxparticipants = ‘ Max. number of participants: ‘ + max_groupmembers ;
} else {
var text_maxparticipants = ”;

}
var text_join = “Join with “;
var text_share = “Share”;
var text_email = “Email”;
var title = ‘‘ + name + ‘
‘ + cl_locatie + ‘


Click on the marker to participate‘ ;

} else {
var text_starttime = ‘ Start: ‘;
var text_duration = ‘ Duur: ‘;
var text_numparticipants = ‘ Deelnemers: ‘;
if ( max_groupmembers > 0 ) {
var text_maxparticipants = ‘ Max. aantal deelnemers: ‘ + max_groupmembers ;
} else {
var text_maxparticipants = ”;

}
var text_join = “Neem deel via “;
var text_share = “Delen”;
var text_email = “E-mailen”;
var title = ‘‘ + name + ‘
‘ + cl_locatie + ‘


Klik op de pin om deel te nemen aan deze opruimactie‘ ;
}

var text_countparticipants = count_groupmembers + groupmembers + 1;

if (cl_type == “wcf”) {
var text_join = text_join + “World Cleanup Day”;
var button = ‘

‘ ;
} else {
var text_join = text_join + “Supporter Van Schoon”;
var button = ‘

‘ + text_join + ‘‘;
}

var description = ‘‘+ name + ‘
‘+ cl_locatie + ‘


‘ + cl_description + ‘

‘ +
text_starttime + begin + ‘
‘ +
text_duration + cl_duration + ‘
‘+
text_numparticipants + text_countparticipants + ‘
‘ +
text_maxparticipants + button ;

var marker = L.marker(new L.LatLng(cl_lat, cl_lng), {
icon: Iconpink,
id: item.id
}).on(‘click’, markerOnClick)
marker.bindPopup(description);
marker.bindTooltip(title).openTooltip();
markers.addLayer(marker);

if (single == “single”) {

var lat = cl_lat;
var lng = cl_lng;

map.panTo(new L.LatLng(lat, lng));

}

}

function setcleanupmaxreached(item) {

if ( $(“#language”).val() == ‘EN’ ) {
var var_textparticipate = “This event reached it’s maximum number of participants”;
var text_starttime = ‘Start time: ‘;
var text_duration = ‘Duration: ‘;
var text_numparticipants = ‘Number of participants: ‘;
if ( max_groupmembers > 0 ) {
var text_maxparticipants = ‘Maximum number of participants: ‘ + max_groupmembers ;
} else {
var text_maxparticipants = ”;

}
} else {
var var_textparticipate = ‘Deze actie heeft het maximum aantal deelnemers bereikt’;
var text_starttime = ‘Starttijd: ‘;
var text_duration = ‘Duur: ‘;
var text_numparticipants = ‘Aantal deelnemers: ‘;
if ( max_groupmembers > 0 ) {
var text_maxparticipants = ‘Maximum aantal deelnemers: ‘ + max_groupmembers ;
} else {
var text_maxparticipants = ”;

}
}

var text_countparticipants = count_groupmembers + groupmembers + 1;

var description = ‘‘+ name + ‘

‘+ cl_locatie + ‘


‘+ description + ‘

‘ +
text_numparticipants + text_countparticipants

var title = ‘‘ + name + ‘
‘ + cl_locatie + ‘


Click on the marker to participate‘ ;

var description = ‘‘+ name + ‘

‘+ cl_locatie + ‘


‘+ cl_description + ‘

‘ +
text_numparticipants + text_countparticipants + ‘

‘+ var_textparticipate+’‘;

var marker = L.marker(new L.LatLng(cl_lat, cl_lng), {
icon: Iconpink,
id: id
}).on(‘click’, markerOnClick)
marker.bindPopup(description);
marker.bindTooltip(title).openTooltip();
markers.addLayer(marker);
}

function setcleanupclosed(item) {

if ( $(“#language”).val() == ‘EN’ ) {
var var_textparticipate = ‘This is a private event in which you cannot participate’;
var text_numparticipants = ‘Number of participants: ‘;
} else {
var var_textparticipate = ‘Dit is een besloten actie waarop je niet kunt inschrijven’;
var text_numparticipants = ‘Aantal deelnemers: ‘;
}
var text_countparticipants = count_groupmembers + groupmembers + 1;
var description = ‘‘+ name + ‘

‘+ cl_locatie + ‘


‘+ cl_description + ‘

‘ +
text_numparticipants + text_countparticipants + ‘

‘+ var_textparticipate+’‘;
var title = ‘‘+ name +’‘ + ‘
‘+var_textparticipate;

var marker = L.marker(new L.LatLng(cl_lat, cl_lng), {
icon: Iconpink,
id: id
}).on(‘click’, markerOnClick)
marker.bindPopup(description);
marker.bindTooltip(title).openTooltip();
markers.addLayer(marker);
}

// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
‘use strict’;
window.addEventListener(‘load’, function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName(‘needs-validation’);
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener(‘submit’, function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
} else {
event.preventDefault();
postdata();
}
form.classList.add(‘was-validated’);

}, false);

});
}, false);
})();

$(‘#opportunity_name’).keyup(updateCount);
$(‘#opportunity_name’).keydown(updateCount);

function updateCount() {
var language = $(‘#language’).val();
if (language=’EN’) {
var cs = ‘Cleanup name (‘ + $(this).val().length + ‘ of 100 characters)’;
} else {
var cs = ‘Naam van de actie (‘ + $(this).val().length + ‘ van 100 tekens)’;
}
$(‘#text-oppname’).text(cs);
}

function translateTexts() {

if ( $(“#language”).val() == ‘EN’ ) {

$(“#doemeeinfo”).html( ‘Click on a pink marker to take part in the event of your choice on World Cleanup Day. So far ‘+ totalparticipants + ‘ participants!’ );
$(“#organiseinfo”).html( ‘Find your location or click on the map at the spot where your event will take place. So far ‘ + totalcleanups + ‘ registered cleanups!’);
$(“#doemeetitel”).html( ‘JOIN A CLEANUP’ );
$(“#organiseertitel”).html( ‘ORGANISE YOUR OWN CLEANUP’);

$(“#text-mandatory”).text(“* = mandatory”);
$(“#text-locatie”).text(“Cleanup”);
$(“#text-extralocatie”).text(“Description of the cleanup *”);
$(“#feedback-extralocatie”).text(“Location description is mandatory”);
$(“#text-oppname”).text(“Name of the event (max. 100 characters) *”);
$(“#feedback-oppname”).text(“Enter a catchy description for the event”);
$(“#text-oppdescript”).text(“Description of the meeting point *”);
$(“#feedback-oppdescript”).text(“Enter a description for the event”);
$(“#text-oppregallow”).text(“This is a closed event”);
$(“#text-oppbegin”).text(“At what time participants have to be present? *”);
$(“#feedback-oppbegin”).text(“It’s mandatory to mention a start time”);
$(“#text-oppduration”).text(“What is the duration of the event (start/end time)? *”);
$(“#feedback-oppduration”).text(“Mention the duration of the event”);
$(“#text-oppisindividual”).text(“Individual”);
$(“#text-oppisorganisation”).text(“This cleanup is organised by a business, school or class”);
$(“#text-opporganisation”).text(“Name *”);
$(“#feedback-opporganisation”).text(“Mention the name of the organisation”);
$(“#text-firstname”).text(“First name *”);
$(“#feedback-firstname”).text(“First name is still mising”);
$(“#text-middlename”).text(“Middle name”);
$(“#text-lastname”).text(“Last name *”);
$(“#feedback-lastname”).text(“Last name is still missing”);
$(“#text-email”).text(“Email *”);
$(“#feedback-email”).text(“Enter a (valid) email address”);
$(“#text-emailsubscribe”).text(‘Yes, Plastic Soup Foundation can send me information about her own projects and initiatives’);
$(“#text-consent”).text(‘Yes, Plastic Soup Foundation is allowed to share my data with Stichting Nederland Schoon, so that Stichting Nederland Schoon can send me information about its initiatives.’);

$(“#text-oppgroupmembers”).text(“Number of participants”);
$(“#feedback-oppgroupmembers”).text(“Enter the desired maximium number of participants”);
$(“#text-oppmaxgroupmembers”).text(“Desired maximum number of participants”);
$(“#feedback-oppmaxgroupmembers”).text(“The maximum number of participants is 2500”);
$(“#formmodaltitlelabel”).text(“Organize your own cleanup event”);
$(“#complience”).text(“By submitting this form you give permission to Plastic Soup Foundation to share your name and email address with participants of your cleanup.”);
$(“#btn-close”).text(“Close”);
$(“#btn-submit”).text(“Send”);
$(“#confirm1”).text(“Registration succesful”);
$(“#confirm2”).text(“Thank you for your registration.”);
$(“#confirm3”).text(“We’ll send a confirmation by e-mail.”);
$(“#confirm4”).text(“The confirmation also contains the information for creating an account to manage your cleanup.”);
$(“#confirm5”).text(“This cleanup event is now being processed.
Give it a moment and refresh this page to reflect the change.”);
$(“#lbl_isorganisatie”).text(“Organisation”);
$(“#lbl_isschoolofklas”).text(“School or class”);
$(“#text-locatiewijzigeninfo”).text(“Do you want to start a cleanup at this location?”);
$(“#btn-startcleanupclose”).text(“No”);
$(“#btn-startcleanupssubmit”).text(“Yes”);

} else {

$(“#doemeeinfo”).html( ‘Klik in de kaart op één van de bestaande acties (de roze pins) als je als individu op World Cleanup Day hieraan wilt deelnemen. Tot nu toe ‘+ totalparticipants + ‘ deelnemers!’ );
$(“#organiseinfo”).html( ‘Zoek je locatie op of plaats een pin op de kaart waar je je nieuwe actie wilt organiseren. Tot nu toe ‘ + totalcleanups + ‘ opruimacties!’);

$(“#formmodaltitlelabel”).text(“Organiseer je eigen opruimactie”);

}

}

function nicedate(orginaldate) {
var date = new Date(orginaldate);
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
if (day < 10) {
day = "0" + day;
}
if (month length ? str.substring(0, length – 3) + ‘…’ : str
}

function cancelProgress() {

// $(‘#modalProgress’).modal(‘hide’);
$(“#modalProgress”).remove();
$(“.modal-backdrop”).remove();
}