var weatherLongTerm={init:function(){var t,n;if($(".widget-title")[0].addEventListener("click",weatherLongTerm.click),$(".widget-weather-long-term .async-content").length>0){for($(".widget-weather-long-term .async-content")[0].addEventListener("click",weatherLongTerm.click),t=$(".widget-weather-long-term table tr:nth-child(4) td div.blue:last-child"),n=0;n<t.length;n++)drop=document.createElement("i"),drop.className+="fa fa-tint blue",drop.title="Neerslag",t[n].prepend(drop);weatherLongTerm.setContentHeight();weatherLongTerm.checkTitleHeight();weatherLongTerm.setLink()}},click:function(){$(".widget-link-button-big a")[0].click()},setLink:function(){if(document.referrer&&typeof URL=="function"){const n=document.getElementById("wplink"),t=new URL(document.referrer).hostname;n.href=n.href+"?utm_source="+t+"&utm_medium=referral&utm_campaign=widget"}},setContentHeight:function(){$(".widget-weather-long-term .widget-warning > div")[0]===undefined?($(".widget-weather-long-term .widget-warning > div").hide(),$(".async-content").removeClass("warning")):($(".widget-weather-long-term .widget-warning > div").show(),$(".async-content").addClass("warning"))},checkTitleHeight:function(){$(".widget-title").height()>52?($(".widget-weather-long-term").addClass("large"),$(".widget-warning").addClass("large")):($(".widget-weather-long-term").removeClass("large"),$(".widget-warning").removeClass("large"))}},widgetWarning,now,locationWidget,locationToday,wpBannerSnippet;$(weatherLongTerm.init);widgetWarning={warning:function(n){n.Active&&$(n.Elements).each(function(){this.Color===n.Color&&widgetWarning.add(this.Title,n.Color)})},add:function(n,t){var i,r;url="https://www.weerplaza.nl/waarschuwing/";$(".widget-warning .widget-warning-block").length<1&&$(".widget-warning").append('<a target="_blank" href="'+url+'"><div class="widget-warning-block bg-'+t+' clearfix"><\/div><\/a>');i=$(".widget-warning .widget-warning-block");$(".widget-warning .widget-warning-block .fa-warning").length<1&&i.append('<i class="fa fa-warning"><\/i>');$(".widget-warning .widget-warning-block .fa-chevron-right").length<1&&i.append('<i class="fa fa-chevron-right"><\/i>');$(".widget-warning .widget-warning-block .text").length<1?i.append('<div class="text truncate">'+n+"<\/div>"):(r=$(".widget-warning .widget-warning-block .text"),r[0].innerHTML=widgetWarning.mergeTitles(r[0].innerHTML,n))},mergeTitles:function(n,t){var i=t.split(":")[1];return n+","+i}};now={init:function(){now.setLink();var n=function(){$(".widget-weather-now .btn.large")[0].click()};$(".widget-title").on("click",n);$(".widget-weather-now .weather").on("click",n);now.checkTitleHeight();now.setButtonText();$(".widget-weather-now").width()&&$(".widget-weather-now")[0].classList.add("xs");now.setContentHeight()},checkTitleHeight:function(){if($(".widget-weather-now .widget-title").height()>52){$(".location-widget").addClass("large");var n=$(".widget-title h3")[0].innerText,t="Nu in ";n.includes(t)?(n=n.replace(t,""),$(".widget-title h3")[0].innerText=n,$(".widget-weather-now .widget-title").height()>52&&$(".widget-title").addClass("large")):$(".widget-weather-now .widget-title h3").css({"font-size":"1.5rem","max-width":"63%",overflow:"hidden"})}else $(".location-widget").removeClass("large")},setLink:function(){var n=$(".widget-weather-now .btn.large")[0];if(n&&n.setAttribute("target",siteId===3?"_parent":"_blank"),document.referrer&&typeof URL=="function"){const n=document.querySelectorAll(".widget-weather-now a"),t=new URL(document.referrer).hostname;n.length>0&&n.forEach(function(n){n.href=n.href+"?utm_source="+t+"&utm_medium=referral&utm_campaign=widget"})}},setButtonText:function(){typeof geoName!="undefined"&&name!==geoName&&($(".location-widget .btn-more a")[0].text="Uitgebreid weer "+name)},setContentHeight:function(){if(typeof country!="undefined"){var n=$(".widget-weather-now .warning-bg.bg-green").length;n>0&&country==="NL"||n===0&&country!=="NL"?$(".location-widget").addClass("no-warning"):$(".location-widget").removeClass("no-warning")}}};$(now.init);locationWidget={geoId:0,countryCode:"",init:function(n,t){locationWidget.geoId=n;locationWidget.countryCode=t;locationWidget.load()},load:function(){$.ajax({url:"/api/meteo/homewidget/",data:{geoId:locationWidget.geoId},type:"GET",dataType:"json",success:locationWidget.update})},update:function(n){var t,r,u,i;$(".splash-text").html(n.Splash.Text);$(".splash-bg").addClass("bg-"+n.Splash.Color.toLowerCase()).removeClass("hide");$(".flash-text").html(n.Flash.Text);$(".flash-bg").addClass("bg-"+n.Flash.Color.toLowerCase()).removeClass("hide");t=$(".location-widget .weather .type").empty();n.Obs.WXCO_EXTENDED?t.append('<div class="geo-'+locationWidget.geoId+' wx wx-b60" style="background-image: url(/Content/Images/WeatherExtended/svg/lb/'+n.Obs.WXCO_EXTENDED+'_LB.svg)" title="'+n.Obs.WXCO_EXTENDED_TEXT+'"><\/div>'):n.Obs.WXCO&&t.append('<div class="geo-'+locationWidget.geoId+' wx wx-b60" style="background-image: url(/Content/Images/Weather/b60x60/'+n.Obs.WXCO+'.png)" title="'+n.Obs.WXCO_TEXT+'"><\/div>');n.Obs.TTTT!==null&&t.append('<span class="geo-'+locationWidget.geoId+' temp">'+parseInt(n.Obs.TTTT)+"°<\/span>");r=$(".location-widget .rating").empty();n.Obs.WXNUM&&(r.append('<span class="weather-rating large r-'+n.Obs.WXNUM+'" onclick="modal.show(\'#weather-rating\')">'+n.Obs.WXNUM+"<\/span>"),r.append("<a href=\"javascript:modal.show('#weather-rating')\">Weercijfer<\/a>"));n.Obs.RRRR?$(".location-widget .rain").html("Neerslag: <em>"+n.Obs.RRRR+" mm<\/em>").show():$(".location-widget .rain").hide();n.Obs.RHRH?$(".location-widget .humidity").html("Vochtigheid: <em>"+n.Obs.RHRH+"%<\/em>").show():$(".location-widget .humidity").hide();n.Obs.DDDD&&n.Obs.FFFF?$(".location-widget .wind").html("Wind: <em>"+n.Obs.DDDD+" "+n.Obs.FFFF+"<\/em>").show():$(".location-widget .wind").hide();n.Obs.PPPP>0?$(".location-widget .pressure").html("Druk: <em>"+n.Obs.PPPP+" hPa<\/em>"):$(".location-widget .pressure").html();typeof newsWarning!="undefined"&&locationWidget.countryCode==="NL"&&($(".warning-text").html(n.Warning.Title),$(".warning-bg").addClass(" bg-"+n.Warning.Color.toLowerCase()).removeClass("hide"));n.MeteoWarning!==null?(u=$(".location-widget .meteo-warning-block"),u.html('<a target="'+target+'" href="/waarschuwing/" class="btn warning warning-small warning-bg bg-'+n.MeteoWarning.Color+'"><\/a>'),i=$(".location-widget .meteo-warning-block a"),i.append('<div class="icon"><i class="fa fa-warning"><\/i><\/div>'),i.append('<span>WAARSCHUWING <div class="warning-text truncate">'+n.MeteoWarning.Title+"<\/div><\/span>"),i.append('<i class="fa fa-chevron-right"><\/i>')):$(".location-widget .meteo-warning-block").hide()}};const radarWidget={init:()=>{let r=6,n=50,t=50,i=null;wpLocation.city?(n=wpLocation.city.Lat,t=wpLocation.city.Lon,i=wpLocation.city):wpLocation.country?(r=wpLocation.country.ZoomLevel-1.5,n=wpLocation.country.Lat,t=wpLocation.country.Lon,i=wpLocation.country):wpLocation.continent&&(r=wpLocation.continent.ZoomLevel-1.5,n=wpLocation.continent.Lat,t=wpLocation.continent.Lon,i=wpLocation.continent);radarWidget.setContentHeight();const u=document.querySelector(".radar-widget .map");if(u){const e=document.querySelectorAll(".radar-widget a"),o=wpLocation.url(i,"regenradar","");e.forEach(n=>{n.setAttribute("href",o)});const f=IPT.map(u,{center:[n,t],zoom:r,language:IPT.LANGUAGE.NL,mapLayers:[IPT.MAP.BASE,IPT.MAP.BORDER],zoomControl:!1,panning:!1,zooming:!1});f&&(IPT.mapLayer(IPT.MAP.BASE).addTo(f),IPT.mapLayer(IPT.MAP.BORDER).addTo(f),f.setElementLayers([IPT.NOWCAST.RADAR_FORECAST],{timebar:{position:"hidden"},legend:{position:"hidden"}}),IPT.ui.location([n,t],{color:"#009FE3",active:!1}).addTo(f))}},setContentHeight:()=>{$(".location-widget .warning-bg").length>0&&$(".location-widget .warning-bg.bg-green").length===0?$(".radar-widget").addClass("warning"):$(".radar-widget").removeClass("warning")}};radarWidget.init();const rainWidget={graph:function(n){const t=[];if($(".rain-timeline .graph > svg").remove(),n.length>0){if(n[0].precipAmount===null){console.warn("[rainWidget] No precipAmount found",n);$(".rain-widget .rain-timeline").addClass("hide");return}$(n).each(function(){t.push(this.precipAmount)});let i=Math.ceil(Math.max.apply(null,t));i===0&&(i=1);i>1&&i<3&&(i=3);i>5&&i<10&&(i=10);const u=[];$(t).each(function(n){u.push({x:n*10,y:parseInt(60-60/i*this)})});const f=d3.area().curve(d3.curveMonotoneX).x(function(n){return n.x}).y0(60).y1(function(n){return n.y});let r="";r+='<svg viewBox="0 0 '+(u.length-1)*10+' 60" preserveAspectRatio="none">';r+='  <path d="'+f(u)+'" vector-effect="non-scaling-stroke" fill="#009FE3"/>';r+="<\/svg>";$(".rain-timeline .graph").append(r);$(".rain-timeline .graph .label").hide();i<=5&&$(".rain-timeline .graph .label.label-light").show().css("top",100-100/i+"%");i>=3&&$(".rain-timeline .graph .label.label-moderate").show().css("top",100-300/i+"%");i>=10&&$(".rain-timeline .graph .label.label-high").show().css("top",100-1e3/i+"%");$(".rain-widget .rain-timeline").removeClass("hide");$(".rain-widget .rain-graph-loader").addClass("hide")}else $(".rain-widget .rain-timeline").addClass("hide"),$(".rain-widget .rain-graph-loader").addClass("hide")}};locationToday={init:function(){locationToday.checkTitleHeight();locationToday.setContentHeight();locationToday.setLink()},setLink:function(){if(document.referrer&&typeof URL=="function"){const n=document.getElementById("wplink"),t=new URL(document.referrer).hostname;n&&n.href&&(n.href=n.href+"?utm_source="+t+"&utm_medium=referral&utm_campaign=widget")}},setContentHeight:function(){$(".widget-weather-today .widget-warning > a")[0]===undefined?($(".widget-weather-today .widget-warning > a").hide(),$(".dayparts").removeClass("warning"),$(".widget-link-button-big").removeClass("warning")):($(".widget-weather-today .widget-warning > a").show(),$(".dayparts").addClass("warning"),$(".widget-link-button-big").addClass("warning"))},checkTitleHeight:function(){var n="",t="";$(".widget-title").height()>52?($(".widget-weather-today").addClass("large"),$(".widget-weather-today .warning-block")[0]!==undefined&&$(".widget-warning").addClass("large"),n=$(".widget-title h3")[0].innerText,t="Weerbericht ",n=n.replace(t,""),$(".widget-title h3")[0].innerText=n):($(".widget-weather-today").removeClass("large"),$(".widget-warning").removeClass("large"));$(".widget-title h3").height()>=102&&(n=$(".widget-title h3")[0].innerText,t="Weerbericht ",n=n.replace(t,""),$(".widget-title h3")[0].innerText=n)}};$(locationToday.init);wpBannerSnippet={log:function(n,t,i){var f=$("#"+n).parent().find(".logging");if(f.length>0){var u=new Date,e=("00"+u.getHours()).substr(-2)+":"+("00"+u.getMinutes()).substr(-2)+":"+("00"+u.getSeconds()).substr(-2),r=$('<div class="item"><\/div>');r.append('<div class="time">'+e+"<\/div>");r.append('<div class="status">'+t+"<\/div>");i&&r.append('<div class="extra">'+i+"<\/div>");r.appendTo(f);console.log("[AD] "+n,t)}}};typeof googletag!="undefined"&&googletag.cmd.push(function(){googletag.pubads().addEventListener("slotRenderEnded",function(n){var i=n.slot.getSlotElementId(),t="";Object.keys(n).sort().forEach(function(i){var r=n[i];(typeof r!="object"||Array.isArray(r))&&(t+="<div><b>"+i+":<\/b> "+r+"<div>")});wpBannerSnippet.log(i,"rendered",t)})})