/**handles:wpp-js,cookie-notice-front**/ var wpp_params=null; var WordPressPopularPosts=function(){var noop=function(){};var supportsShadowDOMV1=!!HTMLElement.prototype.attachShadow;var get=function(url,params,callback,additional_headers){callback="function"===typeof callback?callback:noop;ajax("GET",url,params,callback,additional_headers)};var post=function(url,params,callback,additional_headers){callback="function"===typeof callback?callback:noop;ajax("POST",url,params,callback,additional_headers)};var ajax=function(method,url,params,callback,additional_headers){var xhr= new XMLHttpRequest;var target=url;var args=params;var valid_methods=["GET","POST"];var headers={"X-Requested-With":"XMLHttpRequest"};method=-1!=valid_methods.indexOf(method)?method:"GET";if("POST"==method)headers["Content-Type"]="application/x-www-form-urlencoded";if("object"==typeof additional_headers&&Object.keys(additional_headers).length)headers=Object.assign({},headers,additional_headers);xhr.open(method,target+("GET"==method?"?"+args:""),true);var key;for(key in headers)if(headers.hasOwnProperty(key))xhr.setRequestHeader(key, headers[key]);xhr.onreadystatechange=function(){if(4===xhr.readyState&&200<=xhr.status&&300>xhr.status)if("function"===typeof callback)callback.call(undefined,xhr.response)};xhr.send("POST"==method?args:null)};var theme=function(wpp_list){if(supportsShadowDOMV1){var base_styles=document.createElement("style");var dummy_list=document.createElement("ul");dummy_list.innerHTML='
  • ';wpp_list.parentNode.appendChild(dummy_list);var dummy_list_item_styles=getComputedStyle(dummy_list.querySelector("li")); var dummy_link_item_styles=getComputedStyle(dummy_list.querySelector("li a"));base_styles.innerHTML=".wpp-list li {font-size: "+dummy_list_item_styles.fontSize+"}";base_styles.innerHTML+=".wpp-list li a {color: "+dummy_link_item_styles.color+"}";wpp_list.parentNode.removeChild(dummy_list);var wpp_list_sr=wpp_list.attachShadow({mode:"open"});wpp_list_sr.append(base_styles);for(;wpp_list.firstElementChild;)wpp_list_sr.append(wpp_list.firstElementChild)}};return{get:get,post:post,ajax:ajax,theme:theme}}(); (function(){try{var wpp_json=document.querySelector("script#wpp-json");var do_request=true;wpp_params=JSON.parse(wpp_json.textContent);if(wpp_params.ID){if("1"==wpp_params.sampling_active){var num=Math.floor(Math.random()*wpp_params.sampling_rate)+1;do_request=1===num}if(do_request)WordPressPopularPosts.post(wpp_params.api_url+"/v2/views/"+wpp_params.ID,"_wpnonce="+wpp_params.token+"&sampling="+wpp_params.sampling_active+"&sampling_rate="+wpp_params.sampling_rate,function(response){wpp_params.debug&& window.console&&window.console.log&&window.console.log(JSON.parse(response))})}}catch(err){console.error("WPP: Couldn't read JSON data")}})(); document.addEventListener("DOMContentLoaded",function(){function fetchWidget(widget_placeholder){var widget_id_attr=widget_placeholder.getAttribute("data-widget-id");var method="GET";var url="";var headers={"X-WP-Nonce":wpp_params.token};var params="";if(widget_id_attr){url=wpp_params.ajax_url+"/widget/"+widget_id_attr.split("-")[1];params="is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:"")}else{method="POST";url=wpp_params.api_url+"/v2/widget?is_single="+wpp_params.ID+(wpp_params.lang? "&lang="+wpp_params.lang:"");headers["Content-Type"]="application/json";var json_tag=widget_placeholder.parentNode.querySelector('script[type="application/json"]');if(json_tag){var args=JSON.parse(json_tag.textContent.replace(/[\n\r]/g,""));params=JSON.stringify(args)}}WordPressPopularPosts.ajax(method,url,params,function(response){renderWidget(response,widget_placeholder)},headers)}function renderWidget(response,widget_placeholder){widget_placeholder.insertAdjacentHTML("afterend",JSON.parse(response).widget); var parent=widget_placeholder.parentNode;var sr=parent.querySelector(".popular-posts-sr");var json_tag=parent.querySelector('script[type="application/json"]');if(json_tag)parent.removeChild(json_tag);parent.removeChild(widget_placeholder);parent.classList.add("wpp-ajax");if(sr)WordPressPopularPosts.theme(sr);var event=new Event("wpp-onload",{"bubbles":true,"cancelable":false});parent.dispatchEvent(event)}var widget_placeholders=document.querySelectorAll(".wpp-widget-placeholder, .wpp-widget-block-placeholder, .wpp-shortcode-placeholder"); var w=0;for(;w0?" "+e:e)},this)},remove:function(){t(arguments,function(t){this.element.className=this.element.className.replace(e(t),"")},this)},toggle:function(e){return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)},contains:function(t){return e(t).test(this.element.className)},replace:function(e,t){this.remove(e),this.add(t)}},"classList"in Element.prototype||Object.defineProperty(Element.prototype,"classList",{get:function(){return new n(this)}}),window.DOMTokenList&&null==DOMTokenList.prototype.replace&&(DOMTokenList.prototype.replace=n.prototype.replace)}(),function(e,t,n){var i=new function(){this.cookiesAccepted=null,this.noticeContainer=null,this.setStatus=function(n){var i=this,o="",s="",c=new Date,a=new Date;cnArgs.onScroll&&e.removeEventListener("scroll",this.handleScroll),"accept"===n?(n="true",a.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTime))):(n="false",a.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTimeRejected))),cnArgs.globalCookie&&(o=this.getDomain(t.location.hostname)),"localhost"===t.location.hostname&&(s=t.location.pathname.split("/")[1]);var r="";"https:"===t.location.protocol&&(r=";secure"),t.cookie=cnArgs.cookieName+"="+n+";expires="+a.toUTCString()+";path=/"+s+";domain="+o+r,this.cookiesAccepted="true"===n;var d=new CustomEvent("setCookieNotice",{detail:{value:n,time:c,expires:a,data:cnArgs}});if(t.dispatchEvent(d),this.setBodyClass(["cookies-set","true"===n?"cookies-accepted":"cookies-refused"]),this.hideCookieNotice(),"automatic"===cnArgs.revokeCookiesOpt&&(this.noticeContainer.addEventListener("animationend",function e(){i.noticeContainer.removeEventListener("animationend",e),i.showRevokeNotice()}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){i.noticeContainer.removeEventListener("webkitAnimationEnd",e),i.showRevokeNotice()})),cnArgs.redirection&&("true"===n&&null===this.cookiesAccepted||n!==this.cookiesAccepted&&null!==this.cookiesAccepted)){var l=e.location.protocol+"//",h=e.location.host+"/"+e.location.pathname;cnArgs.cache?(l=l+h.replace("//","/")+(""===e.location.search?"?":e.location.search+"&")+"cn-reloaded=1"+e.location.hash,e.location.href=l):(l=l+h.replace("//","/")+e.location.search+e.location.hash,e.location.reload(!0));return}},this.getDomain=function(e){RegExp(/https?:\/\//).test(e)||(e="http://"+e);var t=new URL(e).hostname.split(".");return t.slice(0).slice(-(4===t.length?3:2)).join(".")},this.getStatus=function(e){var n=("; "+t.cookie).split("; cookie_notice_accepted=");if(2!==n.length)return null;var i=n.pop().split(";").shift();return e?"true"===i:i},this.showCookieNotice=function(){var e=this,n=new CustomEvent("showCookieNotice",{detail:{data:cnArgs}});t.dispatchEvent(n),this.noticeContainer.classList.remove("cookie-notice-hidden"),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.add("cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function t(){e.noticeContainer.removeEventListener("animationend",t),e.noticeContainer.classList.remove("cn-animated")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function t(){e.noticeContainer.removeEventListener("webkitAnimationEnd",t),e.noticeContainer.classList.remove("cn-animated")})},this.hideCookieNotice=function(){var e=this,n=new CustomEvent("hideCookieNotice",{detail:{data:cnArgs}});t.dispatchEvent(n),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function t(){e.noticeContainer.removeEventListener("animationend",t),e.noticeContainer.classList.remove("cn-animated"),e.noticeContainer.classList.add("cookie-notice-hidden")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function t(){e.noticeContainer.removeEventListener("webkitAnimationEnd",t),e.noticeContainer.classList.remove("cn-animated"),e.noticeContainer.classList.add("cookie-notice-hidden")})},this.showRevokeNotice=function(){var e=this,n=new CustomEvent("showRevokeNotice",{detail:{data:cnArgs}});t.dispatchEvent(n),this.noticeContainer.classList.remove("cookie-revoke-hidden"),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.add("cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function t(){e.noticeContainer.removeEventListener("animationend",t),e.noticeContainer.classList.remove("cn-animated")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function t(){e.noticeContainer.removeEventListener("webkitAnimationEnd",t),e.noticeContainer.classList.remove("cn-animated")})},this.hideRevokeNotice=function(){var e=this,n=new CustomEvent("hideRevokeNotice",{detail:{data:cnArgs}});t.dispatchEvent(n),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function t(){e.noticeContainer.removeEventListener("animationend",t),e.noticeContainer.classList.remove("cn-animated"),e.noticeContainer.classList.add("cookie-revoke-hidden")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function t(){e.noticeContainer.removeEventListener("webkitAnimationEnd",t),e.noticeContainer.classList.remove("cn-animated"),e.noticeContainer.classList.add("cookie-revoke-hidden")})},this.setBodyClass=function(e){t.body.classList.remove("cookies-revoke"),t.body.classList.remove("cookies-accepted"),t.body.classList.remove("cookies-refused"),t.body.classList.remove("cookies-set"),t.body.classList.remove("cookies-not-set");for(var n=0;nparseInt(cnArgs.onScrollOffset)&&this.setStatus("accept")},this.getClosest=function(e,n){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1});e&&e!==t;e=e.parentNode)if(e.matches(n))return e;return null},this.inIframe=function(){try{return e.self!==e.top}catch(t){return!0}},this.init=function(){var n=this;if(!0!==this.inIframe()&&(this.cookiesAccepted=this.getStatus(!0),this.noticeContainer=t.getElementById("cookie-notice"),this.noticeContainer)){var i=t.getElementsByClassName("cn-set-cookie"),o=t.getElementsByClassName("cn-revoke-cookie"),s=t.getElementById("cn-close-notice");this.noticeContainer.classList.add("cn-effect-"+cnArgs.hideEffect),null===this.cookiesAccepted?(cnArgs.onScroll&&e.addEventListener("scroll",function(e){n.handleScroll()}),cnArgs.onClick&&e.addEventListener("click",function(e){null===n.getClosest(e.target,"#cookie-notice")&&n.setStatus("accept")},!0),this.setBodyClass(["cookies-not-set"]),this.showCookieNotice()):(this.setBodyClass(["cookies-set",!0===this.cookiesAccepted?"cookies-accepted":"cookies-refused"]),cnArgs.revokeCookies&&"automatic"===cnArgs.revokeCookiesOpt&&this.showRevokeNotice());for(var c=0;c