How To Get Rid Of The Message Bubbles In PMs

As a complete JS newbie, what would be the best way to do this? A while loop or infinitely recursive function seems unideal.


My current solution looks like this:

<script type="text/discourse-plugin" version="0.8">

    api.onPageChange(() =>{
        window.onload = noBubbles();
    });

    async function noBubbles()
    {
        var elements = document.getElementsByClassName('archetype-private_message');
        
        while(elements.length > 0){
            elements[0].classList.remove('archetype-private_message');
        }
    }
</script>

This actually seems decently elegant to my novice eyes but I’m sure somebody will have a more efficient way lol

You’re still going to want to manually undo as much of the bubble stuff as you can via CSS because it does pop up for a split second when you load in but this at least prevents it from sticking around in a very simple manner that should work regardless of future changes to your themes