-
Notifications
You must be signed in to change notification settings - Fork 54
/
deleteselection.min.js
1 lines (1 loc) · 2.01 KB
/
deleteselection.min.js
1
javascript:krazete:(()=>{var a,m,c,w;function h(e){return e.preventDefault(),e.touches?{x:(e.touches[0]||e.changedTouches[0]).clientX+window.scrollX,y:(e.touches[0]||e.changedTouches[0]).clientY+window.scrollY}:{x:e.clientX+window.scrollX,y:e.clientY+window.scrollY}}function u(e){window.removeEventListener("mousemove",v),window.removeEventListener("touchmove",v),window.removeEventListener("mouseup",u),window.removeEventListener("touchend",u),w=h(e),document.body.style.pointerEvents="",a.remove(),m.remove();for(var e=Math.min(c.x,w.x),t=Math.max(c.x,w.x),n=Math.min(c.y,w.y),o=Math.max(c.y,w.y),s=Math.max(1,(t-e)/10),d=Math.max(1,(o-n)/10),i=[],r=e;r<=t;r+=s)for(var l=n;l<=o;l+=d)i.push(document.elementsFromPoint(r-window.scrollX,l-window.scrollY));i.sort((e,t)=>e.length-t.length),e=i[0].filter(t=>t!=m&&i.every(e=>e.includes(t))),console.log(e),e[0].remove()}function v(e){var e=h(e);e=e,m.style.left=Math.min(c.x,e.x)+"px",m.style.top=Math.min(c.y,e.y)+"px",m.style.width=Math.abs(e.x-c.x)+"px",m.style.height=Math.abs(e.y-c.y)+"px"}function t(e){window.removeEventListener("mousedown",t),window.removeEventListener("touchstart",t),window.addEventListener("mousemove",v),window.addEventListener("touchmove",v,{passive:!1}),window.addEventListener("mouseup",u),window.addEventListener("touchend",u),c=h(e),e="r"+parseInt(1e13*Math.random()),document.body.style.pointerEvents="none",(a=document.createElement("style")).textContent="."+e+"::after{content:'\\00D7';position:absolute;left:50%25;top:50%25;transform:translate(-50%25,-50%25);color:red;font-size:15em;}",document.body.appendChild(a),(m=document.createElement("div")).className=e,m.style.position="absolute",m.style.left=c.x+"px",m.style.top=c.y+"px",m.style.width=0,m.style.height=0,m.style.outline="3px dashed red",m.style.boxShadow="inset 0 0 30px 3px pink",m.style.mixBlendMode="difference",m.style.overflow="hidden",m.style.zIndex=1e13,document.body.appendChild(m)}document.body.style.pointerEvents="none",window.addEventListener("mousedown",t),window.addEventListener("touchstart",t)})();