简体   繁体   English

油脂猴改javascript测试

[英]greasemonkey change javascript test

I'd like to change a test made by a javascript on a website我想更改一个 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';

the idea is to remove each javascript test line:这个想法是删除每个 javascript 测试线:

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

so I could see the big image version onclick, I tried it by removing the ligne when inspecting the page code and it worked.所以我可以看到大图像版本 onclick,我在检查页面代码时通过删除 ligne 进行了尝试,它有效。

Thanks谢谢

Based on what you have provided so far, the intension is to prevent the function of the following onclick .根据您到目前为止提供的内容,其目的是防止以下 onclick 的onclick

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

Since above is dependent on this.readAttribute('of') , then the goal can be achieved easily be removing of="true"由于上述依赖于this.readAttribute('of') ,因此可以通过删除of="true"轻松实现目标

Here is an example:这是一个例子:
Look for all images with of="true" and remove of attribute查找所有带有of="true" of并删除属性

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM