29 July, 2013

UserJS: Remove annoying elements of a webpage with "Shift + click"

To remove annoying elements of a webpage (like animations) use this User JavaScript and click on the element while pressing Shift


(function() {
  document.onmouseover = function () {
    event.srcElement.onclick =function(){
      if (event.shiftKey) {
      event.preventDefault();
      event.srcElement.parentNode.removeChild(event.srcElement);return; }
     }
   }
})();
 

 This version triggers the "Shift + click" function only after double click on empty space of the webpage.

window.addEventListener('dblclick',function() {
  document.onmouseover = function () {
     event.srcElement.onclick =function(){
        if (event.shiftKey) {
   event.preventDefault();
   event.srcElement.parentNode.removeChild(event.srcElement); return; }
     }
   }

} , false)

No comments:

Post a Comment