To begin, it is essential to establish a mapping system for translating emoticons like :joy: into their respective unicode strings.
For instance, the unicode representation for :joy: would be 😂
.
This converted unicode string can then be displayed on the webpage...
Here's a simple example to illustrate this concept.
var emojiMapping = {
":joy:" : "😂",
":shades:": "😎",
":happy:" : "😀"
}
var counter = 0;
function displayEmoji(){
setInterval(function(){
if(counter == Object.keys(emojiMapping).length)
counter = 0;
var emojiText = Object.keys(emojiMapping)[counter];
document.getElementById("displayedEmoji").innerHTML = emojiMapping[emojiText];
counter++;
}, 500);
}
displayEmoji();
<div id="displayedEmoji">
</div>
Expanding your unicode mapping object with more emojis and implementing a method to replace placeholders (e.g. ":joy:") with corresponding unicode codes for use within sentences will surely enhance the functionality.