-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.min.js
1 lines (1 loc) · 933 Bytes
/
script.min.js
1
document.getElementById("captureBtn").addEventListener("click",function(){html2canvas(document.getElementById("captureArea"),{scale:2,useCORS:!0,logging:!0,allowTaint:!0}).then(function(e){let t=e.toDataURL("image/png"),n=document.createElement("div");n.classList.add("screenshot");let c=document.createElement("img");c.src=t,n.appendChild(c),document.getElementById("screenshotsContainerchild").appendChild(n);let o=n.childNodes.length;console.log(o),o>0&&(screenshotText.classList.remove("hide"),e.toBlob(function(e){if(navigator.share){let t=new File([e],"screenshot.png",{type:"image/png"});navigator.share({title:"Screenshot",text:"Check out this screenshot!",files:[t]}).then(()=>{console.log("Share successful")}).catch(e=>{console.error("Error sharing",e)})}else{let e=document.createElement("a");e.href=t,e.download="screenshot.png",e.click()}},"image/png"))})});let screenshotText=document.getElementById("screenshotText");