Bookmarklet to hide annoying bits

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Bookmarklet to hide annoying bits

Post by agibsonsw »

Hello.

Some websites have large panels near the top or oversized images. I developed the following 'bookmarklet' so that I can click it and then click an image (or table row, frame, etc.) to temporarily hide it. It shows an outline to indicate what you will be clicking on. If the object has a link it (should be) disabled when you click it, but you can continue to click links thereafter.

In Firefox create a bookmark and paste all of the following code as the location. I named mine 'Hide This'.

Code: Select all

javascript:document.onmouseover=function(e){var evt=e||window.event;var elem=evt.target||evt.srcElement;elem.style.outline='2px solid gray';};document.onmouseout=function(e){var evt=e||window.event;var elem=evt.target||evt.srcElement;elem.style.outline='';};document.onclick=function(e){var evt=e||window.event;var elem=evt.target||evt.srcElement;var par=elem.parentNode;if(par.nodeName=='A'){par.onclick=function(e){e.returnValue=false;return false;};par.setAttribute('href','');};elem.style.display='none';if(evt.preventDefault)evt.preventDefault();evt.returnValue=false;document.onclick=null;document.onmouseover=null;};void 0;
(It's only temporary so a page refresh will 'correct' the page.) Andy.

Edited - I'm sure there are other tools/ addins out there that do a similar thing :smile:
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.