So, I'm learning some jQuery and I've decided to use as a training ground a request a friend made me. I'm trying to create a script for greasemonkey that when a selected user posts something in a thread on the Overwatch forums: (https://us.forums.blizzard.com/en/overwatch/c/general-discussion) it hides that specific comment from the entire thread.
The forum in question identifies the users by a tag called: data-user-id="XXXX"
which is what I want to use as a target of my script while selecting which posts to hide
The expected behaviour is that when the script runs and finds that a certain user by the user ID I've provided has written something it will just hide its entire post in the thread I'm currently reading.
These are some of the experiments I made:
//Experiment 1
$('#post_2:contains("data-user-id="XXXX"")').remove();
//Experiment 2
$('.boxed.onscreen-post:contains("XXXX")').remove();
//Experiment 3
$("#post_2 > .boxed.onscreen-post:contains('XXXX')").remove();
I'm struggling a bit with the concept of dynamic IDs to target the element in question and to make it read the content of the div to find the ID of the user.
These queries really didn't give me any error so my guess is that they couldn't find the string of text required to act.