greasemonkey 更改 javascript 测试

greasemonkey change javascript test

我想更改 javascript 在网站上所做的测试

<img src="https://img_small.jpg" class="pictures_load" of="true" onclick="var src='https://img_big.jpg';
    if(this.readAttribute('of')) src='/noimagehown.gif';
    

想法是删除每个 javascript 测试线:

if(this.readAttribute('of')) src='/noimagehown.gif';

所以我可以看到大图版本的onclick,我在检查页面代码时通过删除ligne进行了尝试并且它有效。

谢谢

根据您目前提供的内容,意图是阻止以下功能onclick

if(this.readAttribute('of')) src='/noimagehown.gif';

既然上面是依赖于this.readAttribute('of'),那么去掉of="true"

就很容易达到目的了

这是一个例子:
查找具有 of="true" 的所有图像并删除 of 属性

document.querySelectorAll('img[of="true"]').forEach(item => item.removeAttribute('of'));