const domainSelector=document.querySelector(".header-container > .domain-selector"),currentDomain=domainSelector&&domainSelector.querySelector(".current-domain-item"),domainDropDown=domainSelector&&domainSelector.querySelector(".domain-dropdown"),countryList=domainSelector&&domainSelector.querySelector(".country-list"),toggleDomainSelector=()=>{domainSelector&&domainSelector.classList.toggle("open");if(countryList&&countryList.classList.contains("open"))toggleOtherCountryList()},toggleOtherCountryList=()=>{if(!domainSelector||!countryList)return;countryList.classList.toggle("open")};document.addEventListener('click',(event)=>{if(!domainSelector||!domainDropDown)return;event.stopPropagation();const isClickInsideElement=domainDropDown.contains(event.target),clickedDomainSelector=currentDomain.contains(event.target),isOpen=domainSelector.classList.contains("open");if(!isClickInsideElement&&isOpen||clickedDomainSelector)return toggleDomainSelector()});(function initHeader(){const body=document.querySelector("body"),header=document.querySelector(".header"),toggle=header.querySelector(".link-menu-toggle"),navLinks=header.querySelectorAll(".nav-dropdown > .link"),headerItemWithDropdownToggles=header.querySelectorAll(".header-item-with-dropdown-toggle"),menuItemChildrenToggles=header.querySelectorAll(".show-children-toggle"),domainSubMenuToggle=true,menu=header.querySelector(".nav-menu"),vacancyOverviewFilters=document.querySelector(".form-filters"),closeMenu=header.querySelector(".close-menu .close-icon svg"),headerItemWithDropdowns=header.querySelectorAll(".header-item-with-dropdown");[...headerItemWithDropdowns].map((headerItemWithDropdown)=>{if(window.innerWidth>=992){headerItemWithDropdown.addEventListener("click",(event)=>{const withToggle=event.currentTarget.querySelector(".header-item-with-dropdown-toggle");withToggle.classList.toggle("is-open");event.currentTarget.blur()});document.addEventListener("click",(event)=>{const linkLabel=headerItemWithDropdown.querySelector(".link-label");if(event.target!==linkLabel){const withToggle=headerItemWithDropdown.querySelector(".header-item-with-dropdown-toggle");withToggle.classList.remove("is-open")}})};headerItemWithDropdown.addEventListener("focus",(event)=>{event.target.classList.add("has-submenu-focus");document.addEventListener("click",function(event){if(event.target!==headerItemWithDropdown)headerItemWithDropdown.classList.remove("has-submenu-focus")})});headerItemWithDropdown.addEventListener("keydown",function(event){if(event.key==="Tab"&&event.shiftKey&&event.target===headerItemWithDropdown)headerItemWithDropdown.classList.remove("has-submenu-focus")});const dropdownMenuItems=headerItemWithDropdown.querySelectorAll(".dropdown-menu .dropdown-menu-item .link");dropdownMenuItems&&[...dropdownMenuItems].map((dropdownMenuItem)=>{dropdownMenuItem.addEventListener("focus",(event)=>headerItemWithDropdown.classList.add("has-submenu-focus"));dropdownMenuItem.addEventListener("blur",(event)=>{const lastElementOfSubMenu=findLastNestedElement(headerItemWithDropdown);checkIfLast(event.target,lastElementOfSubMenu,headerItemWithDropdown)})})});function checkIfLast(element,elementOfSubMenu,headerItemWithDropdown){if(element===elementOfSubMenu)headerItemWithDropdown.classList.remove("has-submenu-focus")}
function findLastNestedElement(element){const children=element.children;if(children.length===0){return element}else{const lastChild=children[children.length-1];return findLastNestedElement(lastChild)}};const checkForMobile=window.matchMedia("(max-width: 992px)"),onScroll=function onScroll(event){if(window.pageYOffset>header.clientHeight){header.classList.add("header-sm");vacancyOverviewFilters&&vacancyOverviewFilters.classList.add("header-sm")}else{header.classList.remove("header-sm");vacancyOverviewFilters&&vacancyOverviewFilters.classList.remove("header-sm")}};window.addEventListener("scroll",onScroll);if(window.innerWidth<=992){toggle&&toggle.addEventListener("click",(event)=>{toggle.classList.toggle("is-open");menu.classList.toggle("is-open");body.classList.toggle("no-scroll")});navLinks&&domainSubMenuToggle&&[...navLinks].map((navLink)=>navLink.addEventListener("click",(event)=>{event.preventDefault();event.target.closest(".nav-dropdown").classList.toggle("is-open")}));closeMenu&&closeMenu.addEventListener("click",(event)=>{closeMenu.classList.toggle("is-open");toggle&&toggle.classList.remove("is-open");menu&&menu.classList.remove("is-open");body&&body.classList.remove("no-scroll")});headerItemWithDropdownToggles&&domainSubMenuToggle&&[...headerItemWithDropdownToggles].map((headerItemWithDropdownToggle)=>headerItemWithDropdownToggle.addEventListener("click",function(){headerItemWithDropdownToggle.classList.toggle("is-open")}))};menuItemChildrenToggles&&[...menuItemChildrenToggles].map((item)=>item&&item.addEventListener("click",(event)=>event.target.parentNode.classList.toggle("is-open")))})();(function allowFavorites(){fetch("/api/cookie-consent").then((response)=>response.json()).then((data)=>{const favoriteToggle=document.querySelector("#favorites-page-link");data!=="necessary"&&favoriteToggle&&favoriteToggle.classList.remove("hidden")})})();(function favoritesCount(){fetch("/api/1/favorites").then((response)=>response.json()).then((data)=>{const counter=document.querySelector(".link-counter"),span=counter&&counter.querySelector("span"),linkFavorites=document.querySelector(".link.link-favorites");if(data&&data.length>0&&span){counter.classList.remove("hidden");linkFavorites.classList.add("with-counter");span.textContent=data.length}})})();addEventListener('DOMContentLoaded',(event)=>fetch("/api/token").then(res=>res.ok&&res.json()).then((value)=>{const input=document.createElement("input");input.setAttribute("type","hidden");input.setAttribute("name","_token");input.setAttribute("value",value.token);document.getElementById("toggle-147300").appendChild(input)}));(function allowFavorites(){fetch("/api/cookie-consent").then((response)=>response.json()).then((data)=>{const toggleLinks=document.querySelectorAll("#favorites-toggle-link");Array.from(toggleLinks).forEach((link)=>data!=="necessary"&&link&&link.classList.remove("hidden"))})})();(function inFavorites(){fetch("/api/1/favorites").then((response)=>response.json()).then((data)=>{const icons=document.querySelectorAll(".favorites-icon");Array.from(icons).forEach((icon)=>{const emptyIcon=icon&&icon.querySelector(".empty-icon"),filledIcon=icon&&icon.querySelector(".filled-icon");if(data&&data.includes(147300)&&emptyIcon&&filledIcon){filledIcon.classList.remove("hidden");emptyIcon.classList.add("hidden")}})})})();(function stickyBanner(){const selector=document.getElementById("hident2"),sticky=document.querySelectorAll(".vacancy-sticky"),banner=selector.querySelector(".banner-background").clientHeight,onScroll=function onScroll(evt){if(banner&&window.pageYOffset>banner){sticky.forEach((element)=>element.classList.add("active"))}else sticky.forEach((element)=>element.classList.contains("active")&&element.classList.remove("active"))};window.addEventListener("scroll",onScroll,{capture:true})})();(function vacancyBackButton(){const element=document.getElementById("hident2"),vacancyBackButton=element.querySelector(".vacancy-back-button"),vacancyBackButtonText=vacancyBackButton&&vacancyBackButton.querySelector(".btn-text"),referrer=document.referrer!==location.href&&document.referrer,comesFromVacancyOverview=referrer&&referrer.includes("https://werkenbijmonkeytown.nl/vacatures"),comesFromCMSpage=referrer&&!comesFromVacancyOverview&&new URL(referrer).origin==new URL(location.href).origin,comesFromVacancyDetailPage=referrer&&((window.location.href.indexOf("solliciteer")>-1)||(window.location.href.indexOf("apply")>-1));vacancyBackButtonText.innerText=(comesFromVacancyOverview&&"Terug naar alle vacatures")||vacancyBackButtonText.innerText;vacancyBackButtonText.innerText=(comesFromCMSpage&&"Terug naar vorige pagina")||vacancyBackButtonText.innerText;vacancyBackButtonText.innerText=(comesFromVacancyDetailPage&&"Terug naar vorige pagina")||vacancyBackButtonText.innerText;function clickLogic(){(comesFromVacancyOverview&&window.history.back())||(comesFromCMSpage&&window.history.back());if(!comesFromCMSpage&&!comesFromVacancyOverview)document.location.href="https://werkenbijmonkeytown.nl/vacatures"};vacancyBackButton&&vacancyBackButton.addEventListener("click",clickLogic)})();window.addEventListener('DOMContentLoaded',(event)=>{const endDates=Array.from(document.querySelectorAll(".metadata .date-metadata"));endDates.forEach(endDate=>{const date=endDate.getAttribute("data-utc");endDate.innerHTML=formatDate(date,false)})});(function(){var app=Elm.Slider.init({node:document.getElementById('application-procedure-hident3'),flags:{slider:{"tag":"application-procedure-slider","contents":[{"icon":"/static/uploads/assessment.svg","title":"Solliciteer","description":"Allereerst vul je het digitale sollicitatieformulier in, waarbij je jouw CV en motivatiebrief upload.","maskColor":"secondary"},{"icon":"/static/uploads/first-live-interview.svg","title":"Persoonlijke reactie","description":"Binnen 14 dagen hoor je van ons of je op gesprek mag komen.","maskColor":"secondary"},{"icon":"/static/uploads/orientation-day.svg","title":"Kennismaking","description":"Als we op papier een match zien, willen we graag kennis met jou maken in een eerste gesprek. Eventueel volgt er een tweede gespreksronde in een andere samenstelling; zo kunnen we allebei goed bepalen of we bij elkaar passen.","maskColor":"secondary"},{"icon":"/static/uploads/phone-interview.svg","title":"Telefonische terugkoppeling","description":"We bellen je om te laten weten of de match definitief is! Als dat aan jouw kant ook zo is, bespreken we de laatste punten en kan je starten in jouw nieuwe baan.","maskColor":"secondary"},{"icon":"/static/uploads/offer.svg","title":"Contract","description":"We sturen je een formulier zodat je digitaal dan nog wat gegevens aan ons kan verstreken en kort daarna ontvang je jouw contract!","maskColor":"secondary"}]},sliderType:"in-threes",windowWidth:window.innerWidth,infinity:false,project:"monkey-town"}})})()