function brfFindClosestAnchor(e){for(;e;){if("A"===e.tagName)return e;e=e.parentElement}return null}function brfHandlePostBoxes(){let e=document.querySelectorAll(".postbox-container");for(var n=0;n<e.length;n++){var t=e[n];t.querySelector("#brf_custom_dashboard")||t.parentNode.removeChild(t)}}function brfHandleEventListeners(){document.querySelector("#adminmenumain").addEventListener("mousemove",(function(){document.body.classList.remove("brf-prevent-scroll")})),document.querySelector("#wpbody iframe").contentWindow.document.addEventListener("mousemove",(function(e){document.body.classList.add("brf-prevent-scroll")}))}window.addEventListener("load",(function(){var e=document.querySelector("#brf_custom_dashboard iframe");brfHandleEventListeners(),"default"===dashboardSettings.linkHandling&&e.contentWindow.document.addEventListener("click",(function(e){const n=brfFindClosestAnchor(e.target);n&&(e.preventDefault(),window.parent.location.href=n.href)})),brfHandlePostBoxes(),e.contentWindow.document.body.addEventListener("click",(function(n){const t=brfFindClosestAnchor(n.target);if(t&&"_blank"!==t.getAttribute("target")&&"default"!==dashboardSettings.linkHandling){n.preventDefault();const o=new URL(t.href);o.searchParams.append("backend","true"),e.contentWindow.location=o.toString()}})),e.addEventListener("load",(function(){let n=document.querySelector("#adminmenuback").getBoundingClientRect().width;e.style.width="calc(100vw - "+n+"px)",brfHandlePostBoxes(),e.contentWindow.document.body.addEventListener("click",(function(n){const t=brfFindClosestAnchor(n.target);if(t&&"_blank"!==t.getAttribute("target")&&"default"!==dashboardSettings.linkHandling){n.preventDefault();const o=new URL(t.href);o.searchParams.append("backend","true"),e.contentWindow.location=o.toString()}}))}))}));