簡體   English   中英

油脂猴改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 的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'));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM