Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
jQuery("#mytextarea").on("change keyup", 
  function() {
    var text = jQuery("#mytextarea").val();
    text = text.replace(
      new RegExp("(\\:\/:(\w+\\):)$", "gi")/gi,
      function(matchall, code) {
        // Emoji Match

       if (typeof LIVECHATSDK.LIVECHAT.emojiShortNames[ match.replace(/\:/g, "") ] !== "undefined") {
          return LIVECHATSDK.LIVECHAT.emojiShortNames[ match.replace(/\:/g, "") ];
        } else {
          return match;
        }code] || code;
      }
    );
    jQuery("#mytextarea").val( text );
  }
);

...