这是我正在查看的代码:
<div class="blotter_workshopitempublished blotter_entry">
<div class="blotter_author_block">
<div class="blotter_avatar_holder">
<a href="https://steamcommunity.com/profiles/steam_profile_id">
<div class="playerAvatar online">
<img src="https://steamcdn-a_medium.jpg" data-miniprofile="number">
</div>
</a>
</div>
<div>
<a href="https://steamcommunity.com/profiles/steam_profile_id" data-miniprofile="number">nickname</a>
</div>
<div>
added an item to their favorites </div>
</div>
我想隐藏所有基于“ steam_profile_id”或“昵称”(我不在乎,但最好使用“ id”)的“ blotter_workshopitempublished blotter_entry”的出现divs。
我看了其他几个类似的问题,但仍然需要帮助;我将在Tampermonkey脚本中使用它。
谢谢
答案 0 :(得分:1)
这样的事情应该有所帮助:
const blotters = document.querySelectorAll('.blotter_workshopitempublished.blotter_entry');
blotters.forEach(blotter => {
const id = blotter.querySelector('a').href.split('/').pop();
if (id === "put whatever id you want to hide in here") {
blotter.style.display = "none";
}
});