| 1 |
window.copyBPlAdminShortcode=async function(t){const e=document.querySelector(`#bPlAdminShortcode-${t}`);if(!e)return;const o=e.querySelector("input"),n=e.querySelector(".tooltip"),i=o.value;try{await navigator.clipboard.writeText(i),n.textContent="Copied!",n.style.opacity=1,n.style.visibility="visible",setTimeout((()=>{n.style.opacity=0,n.style.visibility="hidden",n.textContent="Copy to Clipboard"}),1500)}catch(t){!function(t,e){const o=document.createElement("textarea");o.value=t,document.body.appendChild(o),o.select(),o.setSelectionRange(0,99999);try{document.execCommand("copy"),e.textContent="Successful Copied!"}catch(t){e.textContent="Failed!"}e.style.opacity=1,e.style.visibility="visible",e.style.width="120px",e.style.textAlign="center",e.style.fontWeight="400",e.style.fontSize="14px",e.style.padding="3px 5px",setTimeout((()=>{e.style.opacity=0,e.style.visibility="hidden",e.textContent="Copy to Clipboard"}),1500),document.body.removeChild(o)}(i,n)}},document.addEventListener("DOMContentLoaded",(function(){document.body.addEventListener("click",(function(t){const e=t.target.closest(".ytp_shortcode_copy_btn");if(!e)return;t.preventDefault();const o=e.getAttribute("data-shortcode");if(o){const t=e.querySelector(".copy-text")||e.parentElement&&e.parentElement.querySelector(".copy-text"),n=t?t.textContent:"",i=()=>{t&&(t.textContent="Copied!",setTimeout((()=>{t.textContent=n}),1500))};let c=!1;try{const t=document.createElement("textarea");t.value=o,document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),c=document.execCommand("copy"),document.body.removeChild(t)}catch(t){c=!1}c?i():navigator.clipboard&&window.isSecureContext&&navigator.clipboard.writeText(o).then(i).catch((t=>{console.error("Copy failed",t)}))}}))})); |