I have chat applications based on NodeJS that using Jquery-typing for detecting user activity. This plugin is great, but i facing some problem with enter keys.
I make some script if user press “ENTER”, it will send message. But seems Jquery-typing detect “ENTER” key as start typing activity. It will make my chat application give stop typing notification into another users which message already send. I want to disable some keys in Jquery Typing.
So, i fork from original github and add-ed some additional feature called “keyClear”. Here are some implementation. “ENTER” keyCode is 13. So, i add it into keyclear options :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $(‘#text-input’).typing({ start: function (event, $elem) { if(checkVariable(now.name, now.roomId)){ now.statusOnWriting(); } }, stop: function (event, $elem) { if(checkVariable(now.name, now.roomId)){ now.statusOffWriting(); } }, keyclear: 13, delay: 1000 }); |
Now when people press “ENTER” it make not activity, not start or stop typing either.
You can clone it on : https://github.com/yodiaditya/jquery-typing.