useWatermark-186794fa.js 1000 B

1
  1. const e="/assets/avatar-ea67286d.gif",t=Symbol("watermark-dom");function n(e=document.body){let n=()=>{};const o=t.toString(),i=()=>{const t=document.getElementById(o);if(t){e&&e.removeChild(t)}window.removeEventListener("resize",n)},l=t=>{i();const n=document.createElement("canvas");n.width=300,n.height=240;const l=n.getContext("2d");l&&(l.rotate(-20*Math.PI/120),l.font="15px Vedana",l.fillStyle="rgba(0, 0, 0, 0.15)",l.textAlign="left",l.textBaseline="middle",l.fillText(t,n.width/20,n.height));const a=document.createElement("div");a.id=o,a.style.pointerEvents="none",a.style.top="0px",a.style.left="0px",a.style.position="absolute",a.style.zIndex="100000000",a.style.width=document.documentElement.clientWidth+"px",a.style.height=document.documentElement.clientHeight+"px",a.style.background="url("+n.toDataURL("image/png")+") left top repeat";return e&&e.appendChild(a),o};return{setWatermark:function(e){l(e),n=()=>{l(e)},window.addEventListener("resize",n)},clear:i}}export{e as a,n as u};