开发者

Greasemonkey onmousemove script

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.开发者_JAVA技巧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!


Try addEventListener

window.addEventListener('mousemove',removeTags,false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜