An annoyance of mine has always been that web.whatsapp.com doesn't allow switching ctrl-enter and the enter key. As every other chat application that I use has this feature it has happened more often than not that I accidentally send a message whilst trying to write a multiline one. Which is especially annoying considering that WhatsApp messages cannot be edited.
This script provides a solution for that. By overriding the EventTarget.addEventListener
I can completely override how listeners should work and wrap them - if needed - in my own methods that prepare the events before giving them to the real listeners.
Interestingly enough the newest WhatsApp web version will use the Event.isTrusted
property (which is provided by browser) in order to check whether to handle the event or not. Previous version didn't have that. And that is why the code is a bit longer than expected, as I first needed to create an object that looks like a keyevent, tastes like one, but has all it's properties on