Created
June 24, 2019 10:42
-
-
Save MacroMan/57d43f26b3dc7fa2372eb352d4618a2d to your computer and use it in GitHub Desktop.
Bookmark doodle rect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(e,t){function n(e,t,n){e.addEventListener(t,n)}function o(e){27==e.which&&(i.removeChild(r),i.removeEventListener("keydown",o))}var i=t.body,d=t.documentElement,r=t.createElement("canvas"),a=r.width=Math.max(e.innerWidth,d.clientWidth,i.clientWidth),h=r.height=Math.max(e.innerHeight,d.clientHeight,i.clientHeight),c=r.style;c.position="absolute",c.left=c.top=0,c.width=a+"px",c.height=h+"px",c.zIndex=1e4,c.cursor="crosshair",i.appendChild(r);var l=r.getContext("2d");l.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",l.lineWidth=3;var u=!1,s={x:0,y:0};n(r,"mousedown",function(e){s.x=e.pageX,s.y=e.pageY,u=!0}),n(r,"mouseup",function(){u=!1}),n(r,"mousemove",function(e){if(u){var t=e.pageX,n=e.pageY;l.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",l.clearRect(0,0,a,h),l.beginPath(),l.rect(s.x,s.y,t-s.x,n-s.y),l.stroke()}}),n(i,"keydown",o)}(window,document);void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment