• diegoldenenase

    (@diegoldenenase)


    I’m trying to add in Quick Chat a “user is typing” function, but i’m not a professional and it would be greatful if someone could help to integrate this function to Quick Chat.

    How it should work:
    when my chat partner (user1) starts typing I see in my chat box: “user1 is typing”

    when I (user2) am typing he sees in his chat box: “user2 is typing”.

    The following code should be work, but i dont know how to integrate:

    <script type="text/javascript" language="javascript">
    var timer = 0;
    function reduceTimer(){
    timer = timer - 1;
    isTyping(true);
    }
    function isTyping(val){
    if(val == 'true'){
    document.getElementById('typing_on').innerHTML = "User is typing...";
    }else{
    
    if(timer <= 0){
    document.getElementById('typing_on').innerHTML = "No one is typing -blank space.";
    }else{
    setTimeout("reduceTimer();",500);
    }
    }
    }
    </script>
    
    <label>
    <textarea onkeypress="isTyping('true'); timer=5;" onkeyup="isTyping('false')" name="textarea" id="textarea" cols="45" rows="5"></textarea>
    </label>
    <div id="typing_on">No one is typing - blank speace.</div>

    Could someone help me? That would be a great function for Quick Chat.

    https://wordpress.org/plugins/quick-chat/

The topic ‘"User is typing" function in Quick Chat’ is closed to new replies.