-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeasure.js
1 lines (1 loc) · 2.13 KB
/
measure.js
1
javascript:void('http://centricle.com/tools/favelets/','v1.2','with code from fry@fcc');drg=false;d=document;db=d.body;d.ondblclick=kR;d.onkeypress=kR;rk=false;mC=prompt('Color:','red');mq=db.appendChild(d.createElement('div'));mqs=mq.style;mqs.position='absolute';mqs.border='dashed 1px red';mqs.fontSize='0px';ctr=db.appendChild(d.createElement('div'));ctrs=ctr.style;ctrs.position='absolute';ctrs.top='-300px';ctrs.left='-300px';ctrs.width='85px';ctrs.background='%23eee';ctrs.padding='5px';ctrs.border='solid 1px %23ccc';ctrs.font='10px verdana,sans-serif';ctrs.width='85px';ctrs.zIndex='99';ctr.innerHTML='<b>Current:</b><br> x:<span id="cX">0</span> y:<span id="cY">0</span><br><b>Begin:</b><br> x:<span id="bX">0</span> y:<span id="bY">0</span><br><b>End:</b><br> x:<span id="eX">0</span> y:<span id ="eY">0</span><br><b>Dimensions:</b><br> w:<span id="dX">0</span> h:<span id="dY">0</span>';d.onmousemove=fW;d.onmousedown=bD;d.onmouseup=eD;function dgE(i)%7Breturn d.getElementById(i)%7D;if(!d.all)%7BcX=dgE('cX');cY=dgE('cY');bX=dgE('bX');bY=dgE('bY');eX=dgE('eX');eY=dgE('eY');dX=dgE('dX');dY=dgE('dY');%7D;dbs=db.style;void(dbs.cursor='crosshair');function fW(e)%7Bif(rk==true)%7Breturn;%7D;x=(e)?e.pageX:event.x;y=(e)?e.pageY:event.y;ctrs.left=x+15+%27px%27;ctrs.top=y+15+%27px%27;cX.innerHTML=x;cY.innerHTML=y;if(drg)%7BdX.innerHTML=Math.abs(x-dsX);dY.innerHTML=Math.abs(y-dsY);if(x-dsX%3E0)%7Bmqs.width=x-dsX+%27px%27;%7Delse%7Bmqs.width=-(x-dsX)+%27px%27;mqs.left=x+%27px%27;ctrs.left=dsX+15+%27px%27;%7D;if(y-dsY%3E0)%7Bmqs.height=y-dsY+%27px%27;%7Delse%7Bmqs.height=-(y-dsY)+%27px%27;mqs.top=y+%27px%27;ctrs.top=dsY+15+%27px%27;%7D;%7Dreturn%20false;%7D;function%20bD(e)%7Bif(rk==true)%7Breturn;%7D;mqs.width=0;mqs.height=0;mqs.borderColor=mC;drg=true;x=(e)?e.pageX:event.x;y=(e)?e.pageY:event.y;mqs.visibility=%27visible%27;mqs.left=x+%27px%27;mqs.top=y+%27px%27;dsX=x;dsY=y;bX.innerHTML=x;bY.innerHTML=y;return%20true;%7Dfunction%20eD(e)%7Bdrg=false;x=(e)?e.pageX:event.x;y=(e)?e.pageY:event.y;eX.innerHTML=x;eY.innerHTML=y;return%20true;%7D;function%20kR()%7Bmqs.visibility=%27hidden%27;ctrs.top=%27-300px%27;ctrs.left=%27-300px%27;dbs.cursor=%27auto%27;rk=true;%7D