Emoji converter for WhatsApp web - from ":P" to "😝"
- Get link
- X
- Other Apps
I don't use emoji's on WhatsApp very often. But recently, as I was texting using WhatsApp web, I inserted in an emoji and just as I was about to send it, I decided to select everything (ctrl + A) and cut it (ctrl + X). Later during the conversation, I decided to paste what I had selected and I observed that the emoji that I added was coming up just as it was. I was curious to know if WhatsApp uses a rich text editor, but it doesn't. Aparently, the emoji that I was using is a standalone Unicode character. I did a quick printing on Chrome developer console to verify that and Google search to know more about it.
"😝" is the emoji that I used to use very frequently. Infact, back in the day when I was using the initial versions of Facebook chat, I used to press on ":P" after almost every message. After entering the WhatsApp days, I changed my habit as the shortcut no longer works. Now that I discovered the emoji is a Unicode character, I have decided to have some fun with it. I shall write a simple JavaScript code to automatically convert ":P" into "😝".
To begin with, I opened up WhatsApp web, chose a person to message and then opened up the Chrome Developer Console and inserted the following code. Node that I used 'querySelectorAll' with the parameter specified in the code after inspecting the HTML element where we type the message.
var div = document.querySelectorAll('[spellcheck=true]')[0];
div.addEventListener("DOMCharacterDataModified", function (event) {
div.innerHTML = div.innerText.replaceAll(':P', '😝');
});
var div = document.querySelectorAll('[spellcheck=true]')[0];div.addEventListener("DOMCharacterDataModified", function (event) {div.innerText = (event.prevValue + event.newValue[0]).replaceAll(':P', '😝');});
- Get link
- X
- Other Apps
Comments
Post a Comment