diff --git a/assets/js/accessibility-new-window-warnings-min.js b/assets/js/accessibility-new-window-warnings-min.js index 4b0e830..0a12f8e 100644 --- a/assets/js/accessibility-new-window-warnings-min.js +++ b/assets/js/accessibility-new-window-warnings-min.js @@ -1 +1 @@ -!function(){let e,t;const n=()=>{document.querySelectorAll(".anww-external-link-icon").forEach((e=>e.remove())),document.querySelectorAll("a:not([data-nww-processed])").forEach((e=>{let t=!1;const n=e.getAttribute("onclick");if("_blank"===e.getAttribute("target")&&(o(e),a(e),i(e),e.setAttribute("data-nww-processed","true"),t=!0),n&&n.includes("window.open")){const d=n.match(/window\.open\([^,]+,\s*['"]([^'"]+)['"]/),l=d?d[1]:"";"_blank"!==l&&""!==l||(o(e),a(e),i(e),e.setAttribute("data-nww-processed","true"),t=!0)}}))},o=e=>{const t=document.createElement("i");t.classList.add("anww-external-link-icon"),t.setAttribute("aria-hidden","true");const n=e.querySelector(".elementor-button-content-wrapper");if(n)return t.classList.add("elementor-button-link-content"),void n.insertAdjacentElement("beforeend",t);e.appendChild(t)},a=e=>{let t="";e.hasAttribute("aria-label")?t=e.getAttribute("aria-label"):e.querySelector("img")?t=e.querySelector("img").getAttribute("alt"):e.textContent&&(t=e.textContent.trim()),t=t?`${t}, ${anww_localized.opens_a_new_window}`:anww_localized.opens_a_new_window,e.setAttribute("aria-label",t)},i=e=>{e.addEventListener("mouseenter",(t=>{d(e,t.pageX,t.pageY)})),e.addEventListener("focusin",(t=>{const n=e.getBoundingClientRect();d(e,n.left+window.scrollX,n.top+n.height+window.scrollY)})),e.addEventListener("mouseleave",l),e.addEventListener("focusout",l)},d=(n,o,a)=>{clearTimeout(t),e.textContent=anww_localized.opens_a_new_window,e.style.display="block";const i=e.offsetWidth,d=e.offsetHeight;o+i+10>window.innerWidth&&(o-=i+20),a+d+10>window.innerHeight+window.scrollY&&(a-=d+20),e.style.top=`${a+10}px`,e.style.left=`${o+10}px`},l=()=>{t=setTimeout(r,300)},r=()=>{e.style.display="none"};window.addEventListener("load",(()=>{e=document.createElement("div"),e.setAttribute("role","tooltip"),e.classList.add("anww-tooltip"),Object.assign(e.style,{position:"absolute",background:"white",color:"#1e1e1e",fontSize:"16px",border:"1px solid black",padding:"5px 10px",zIndex:9999,display:"none",pointerEvents:"auto",boxShadow:"0px 4px 6px rgba(0,0,0,0.1)",maxWidth:"200px",whiteSpace:"nowrap"}),document.body.appendChild(e),document.addEventListener("click",(e=>{e.target.closest(".anww-tooltip, a[target='_blank']")||r()})),document.addEventListener("keydown",(e=>{"Escape"===e.key&&r()})),e.addEventListener("mouseenter",(()=>{clearTimeout(t)})),e.addEventListener("mouseleave",(()=>{r()})),n()})),document.addEventListener("facetwp-loaded",n)}(); \ No newline at end of file +!function(){let e,t;const n=()=>{document.querySelectorAll(".anww-external-link-icon").forEach((e=>e.remove())),document.querySelectorAll("a:not([data-nww-processed])").forEach((e=>{let t=!1;const n=e.getAttribute("onclick");if("_blank"===e.getAttribute("target")&&(o(e),a(e),i(e),e.setAttribute("data-nww-processed","true"),t=!0),n&&n.includes("window.open")){const d=n.match(/window\.open\([^,]+,\s*['"]([^'"]+)['"]/),l=d?d[1]:"";"_blank"!==l&&""!==l||(o(e),a(e),i(e),e.setAttribute("data-nww-processed","true"),t=!0)}}))},o=e=>{const t=document.createElement("i");t.classList.add("anww-external-link-icon"),t.setAttribute("aria-hidden","true");const n=e.querySelector(".elementor-button-content-wrapper");if(n)return t.classList.add("elementor-button-link-content"),void n.insertAdjacentElement("beforeend",t);e.appendChild(t)},a=e=>{let t="";e.hasAttribute("aria-label")?t=e.getAttribute("aria-label"):e.querySelector("img")?t=e.querySelector("img").getAttribute("alt"):e.textContent&&(t=e.textContent.trim()),t=t?`${t}, ${anww_localized.opens_a_new_window}`:anww_localized.opens_a_new_window,e.setAttribute("aria-label",t)},i=e=>{e.addEventListener("mouseenter",(t=>{d(e,t.pageX,t.pageY)})),e.addEventListener("focusin",(t=>{const n=e.getBoundingClientRect();d(e,n.left+window.scrollX,n.top+n.height+window.scrollY)})),e.addEventListener("mouseleave",l),e.addEventListener("focusout",l)},d=(n,o,a)=>{clearTimeout(t),e.textContent=anww_localized.opens_a_new_window,e.style.display="block";const i=e.offsetWidth,d=e.offsetHeight;o+i+10>window.innerWidth&&(o-=i+20),a+d+10>window.innerHeight+window.scrollY&&(a-=d+20),e.style.top=`${a+10}px`,e.style.left=`${o+10}px`},l=()=>{t=setTimeout(r,300)},r=()=>{e.style.display="none"};window.addEventListener("load",(()=>{e=document.createElement("div"),e.setAttribute("role","tooltip"),e.classList.add("anww-tooltip"),Object.assign(e.style,{position:"absolute",background:"white",color:"#1e1e1e",fontSize:"16px",border:"1px solid black",padding:"5px 10px",zIndex:9999,display:"none",pointerEvents:"auto",boxShadow:"0px 4px 6px rgba(0,0,0,0.1)",maxWidth:"200px",whiteSpace:"normal"}),document.body.appendChild(e),document.addEventListener("click",(e=>{e.target.closest(".anww-tooltip, a[target='_blank']")||r()})),document.addEventListener("keydown",(e=>{"Escape"===e.key&&r()})),e.addEventListener("mouseenter",(()=>{clearTimeout(t)})),e.addEventListener("mouseleave",(()=>{r()})),n()})),document.addEventListener("facetwp-loaded",n)}(); \ No newline at end of file diff --git a/assets/js/accessibility-new-window-warnings.js b/assets/js/accessibility-new-window-warnings.js index 8ff73da..6e0f243 100644 --- a/assets/js/accessibility-new-window-warnings.js +++ b/assets/js/accessibility-new-window-warnings.js @@ -24,7 +24,7 @@ pointerEvents: "auto", boxShadow: "0px 4px 6px rgba(0,0,0,0.1)", maxWidth: "200px", - whiteSpace: "nowrap" + whiteSpace: "normal", }); document.body.appendChild(anwwLinkTooltip);