Thursday, 16 March 2017

How to send the emoji parallel with live chat using core php?

we are using this script for integrate emoji but that is not working in other system. Current sytem can view the emojis but not able to view with other system.

<script>
     // ask user for name with popup prompt    
      var name = prompt("Enter your chat name:", "Guest");

      // default name is 'Guest'
      if (!name || name === ' ') {
     name = "Guest";  
 }
    // strip tags
    name = name.replace(/(<([^>]+)>)/ig,"");
    // display name on page
    $("#name-area").html("You are: <span>" + name + "</span>");
    // kick off chat
    var chat =  new Chat();
    $(function() {
       chat.getState(); 
         // watch textarea for key presses
         $("#sendie").keydown(function(event) {  
           var key = event.which;  
             //all keys including return.  
             if (key >= 33) {
               var maxLength = $(this).attr("maxlength");  
               var length = this.value.length;  

                 // don't allow new content if length is maxed out
                 if (length >= maxLength) {  
                   event.preventDefault();  
               }  
           }  
       });
         // watch textarea for release of key press
         $('#sendie').keyup(function(e) {   
          if (e.keyCode == 13) { 
            e.preventDefault();
            var text = $(this).val();
            var maxLength = $(this).attr("maxlength");  
            var length = text.length; 
            var str = '';
            str = $.trim($("#sendie").val());
                // send 
                if (length <= maxLength + 1) { 
                    $(this).val("");

                    $.ajax({
                        type: "POST",
                        url: "parsetext.php",
                        data: {str: addslashes(str)},
                        cache: false,
                        success: function(html) {

                           chat.send(text, name);  
                            $("#chat-area").append(name + html);

                        },
                        error: function(html) {
                                    //alert("Failed");
                                }
                            });


                } else {

                    $(this).val(text.substring(0, maxLength));

                }   
            }
        });
     });
function addslashes(str) {
    return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g,  '\\0');}
</script>

When we have enter the any text that is viewed in another system but the emoji is not view with them.



via agskarthik

No comments:

Post a Comment