-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminimized.js
1 lines (1 loc) · 2.14 KB
/
minimized.js
1
javascript:(function(){function a(B,k,A,j,z,h,w,g,t){var v=B;var f=k;var s=A-B;var d=j-k;var u=z;var e=h;var r=w-z;var C=g-h;var i=r*d-s*C;if(i==0){return}var q=u-v;var p=e-f;var o=(r*p-C*q)/i;var m=(s*p-d*q)/i;var n=v+s*o;var l=f+d*o;t.strokeStyle="rgba(255, 255, 0, 0.7)";t.lineWidth=3;t.beginPath();t.arc(Math.round(n),Math.round(l),10,0,Math.PI*2,false);t.stroke()}function b(){var i=window.innerWidth;var d=window.innerHeight;var j=Math.round(i/3);var g=Math.round(d/3);re=document.getElementById("canvas");if(re){document.body.removeChild(re)}var h=document.createElement("canvas");if(!h.getContext){return false}h.id="canvas";h.setAttribute("height",d);h.setAttribute("width",i);h.style.cssText="position: fixed;top: 0;left: 0;z-index: 999;";document.body.appendChild(h);var e=h.getContext("2d");e.lineWidth=1;e.strokeStyle="rgba(255, 0, 0, 0.7)";e.beginPath();e.moveTo(0,0);e.lineTo(i,d);e.closePath();e.moveTo(i,0);e.lineTo(0,d);e.closePath();e.moveTo(j,0);e.lineTo(j,d);e.closePath();e.moveTo(j*2,0);e.lineTo(j*2,d);e.closePath();e.moveTo(0,g);e.lineTo(i,g);e.closePath();e.moveTo(0,g*2);e.lineTo(i,g*2);e.closePath();e.stroke();e.strokeStyle="rgba(0, 0, 255, 0.7)";e.beginPath();e.moveTo(0,Math.round(d/2));e.lineTo(i,Math.round(d/2));e.closePath();e.moveTo(Math.round(i/2),0);e.lineTo(Math.round(i/2),d);e.closePath();e.stroke();e.strokeStyle="rgba(0, 255, 0, 0.7)";e.beginPath();var f=Math.round(d*d/i);e.moveTo(0,0);e.lineTo(f,d);e.closePath();e.moveTo(i,d);e.lineTo(i-f,0);e.stroke();e.moveTo(0,d);e.lineTo(f,0);e.stroke();e.moveTo(i,0);e.lineTo(i-f,d);e.stroke();e.strokeStyle="rgba(255, 255, 0, 0.7)";e.beginPath();e.moveTo(Math.round(i/2.618),0);e.lineTo(Math.round(i/2.618),d);e.stroke();e.moveTo(i-Math.round(i/2.618),0);e.lineTo(i-Math.round(i/2.618),d);e.stroke();e.moveTo(0,Math.round(d/2.618));e.lineTo(i,Math.round(d/2.618));e.stroke();e.moveTo(0,d-Math.round(d/2.618));e.lineTo(i,d-Math.round(d/2.618));e.stroke();a(0,0,i,d,0,d,f,0,e);a(0,0,i,d,i,0,i-f,d,e);a(0,d,i,0,0,0,f,d,e);a(0,d,i,0,i,d,i-f,0,e)}function c(e,d){if(window.addEventListener){window.addEventListener(e,d,false)}else{if(window.attachEvent){window.attachEvent("on"+e,d)}}}b();c("resize",b)})();