Skip to content

Instantly share code, notes, and snippets.

@thornbill
Created November 12, 2014 17:33
Show Gist options
  • Save thornbill/2c66b2b35a70b3438620 to your computer and use it in GitHub Desktop.
Save thornbill/2c66b2b35a70b3438620 to your computer and use it in GitHub Desktop.
Bookmarklet that highlights any table elements on a page
javascript:(function(d){function h(e){if(typeof e!=='object')return;function o(e){var _x=0,_y=0;while(e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop)){_x+=e.offsetLeft;_y+=e.offsetTop;e=e.offsetParent;}return {top:_y,left:_x};}var p=o(e);c(p.left,p.top,e.clientWidth,e.clientHeight);}function c(x,y,w,h){var e=d.createElement('div');e.style.zIndex='999999';e.style.background='rgba(255,0,0,0.6)';e.style.position='absolute';e.style.left=x+'px';e.style.top=y+'px';e.style.width=w+'px';e.style.height=h+'px';d.body.appendChild(e);}var t=d.getElementsByTagName('table'),i,l=t.length;for(i=0;i<l;i++){h(t[i]);console.log(t[i]);}})(document);
@bdmorin
Copy link

bdmorin commented Nov 12, 2014

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment