views:

68

answers:

1

Hello,

I have a UserScript which should remove all images of a certain class on the first mousemove-event.

Being pretty new in writing Greasemonkey-scripts, okay this is my first script, I think there is just something small missing.

// ==UserScript==
// @name aname
// @namespace anamespace
// @description adescription
// @include        http://www.google.com/search*
// @include        http://www.google.com/webhp*
// @include        http://www.google.com/#*
// @include        http://www.google.com/
// ==/UserScript==
var removeTags = function () {
    var allHTMLTags = window.document.getElementsByTagName("*");
    for (i=0; i < allHTMLTags.length; i++) {
        if (allHTMLTags[i].className == "l sb-l") {
            allHTMLTags[i].style.display='none';
        }
    }
};
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = removeTags;

Thanks for your help!

A: 

Try addEventListener

window.addEventListener('mousemove',removeTags,false);
S.Mark
Thanks, this was fast!
Roman Glass
I'm glad to know it works.
S.Mark