Author Topic: how can i send message by pressing enter key  (Read 27816 times)

0 Members and 1 Guest are viewing this topic.

raj123

  • Jr. Member
  • **
  • Posts: 2
how can i send message by pressing enter key
« on: February 04, 2009, 11:22:27 AM »
Hello,

webim working fine.

our clients wants by pessing enter key message has to send.

how can i send message by pressing enter key.

so Let me know where i have to make changes(i.e.  file name)


Arockia Raj

thisgarryhas2rs

  • Full Member
  • ***
  • Posts: 6
Re: how can i send message by pressing enter key
« Reply #1 on: March 02, 2009, 09:49:00 PM »
I'd like to know this to. This would be useful since people are used to just hitting Enter.

squirrelist

  • Full Member
  • ***
  • Posts: 8
    • Personal website
Re: how can i send message by pressing enter key
« Reply #2 on: March 06, 2009, 02:14:46 PM »
Agreed!

Caba

  • Jr. Member
  • **
  • Posts: 4
Re: how can i send message by pressing enter key
« Reply #3 on: March 06, 2009, 04:47:17 PM »
Hello everyone!
I´d like too knowing how to do this!
Thanks!

squirrelist

  • Full Member
  • ***
  • Posts: 8
    • Personal website
Re: how can i send message by pressing enter key
« Reply #4 on: March 06, 2009, 07:31:35 PM »
I discovered that on Opera it's simply "Enter". Don't know if that helps anyone find the code that needs to be modified.

Caba

  • Jr. Member
  • **
  • Posts: 4
Re: how can i send message by pressing enter key
« Reply #5 on: March 10, 2009, 11:22:59 PM »
Hi everyone!
Finally! After two long nights studying the code I found a way to send messages by pressing Enter key!
The key is in /js/chat.js in a function called function(k) (better look for it using a editor). This function uses two variables: k and kh to store the ASCII code of each one of the characters we enter in the textarea and the ASCII code for the CTRL key; so, the first step is to remove this kh variable (inside the if-else structure near to the declaration of the function).
The second step is to remove the myRealAgent variable from the condition clausule:if(this.pq.xt&&((k==015&&(kh||myRealAgent=='o\160er\141'))||(k==012))) (also remove kh)
After this two steps we should get a function like this:
function(k){if(k){k=k.which;} else{k=event.keyCode;} if(this.pq.xt&&((k==015)||(k==012))){...}.
Finally, we should change the message that appears in the bottom-right corner of the chat window (CTRL-Enter) by editing the file /libs/chat.php. Search for $page['send_shortcut'] PHP variable and change its value for "Enter" (for example).
Restart the chat! Et voilá! (unless it worked perfectly in IE and Firefox, don´t know Opera nor Safari, sorry ;D).
Hope this may be useful!
Bye!
PD: Sorry for my English... ;)

squirrelist

  • Full Member
  • ***
  • Posts: 8
    • Personal website
Re: how can i send message by pressing enter key
« Reply #6 on: March 11, 2009, 12:09:06 AM »
Thank you Caba!

Attached are the two files which I have edited with your instructions. Confirmed working on Safari 4 for Mac. I'll check it with Safari 3 and Opera tomorrow.

Please consider using this code in the next release or at least providing an option in the interface to switch.

Inspirer

  • Mibew Project founder
  • Native
  • *****
  • Posts: 262
    • Mibew Messenger
Re: how can i send message by pressing enter key
« Reply #7 on: March 12, 2009, 01:31:12 AM »
Hi everyone!

Of course, I'll add this option in 1.6.

You can download the original (not minimized/obfuscated javascript here):
http://mibew.org/forums/index.php?topic=86.msg238#msg238

Have to remove some code in chat.js:
  handleKeyDown: function(k) {
   if( k ){ ctrl=k.ctrlKey;k=k.which; } else { k=event.keyCode;ctrl=event.ctrlKey;   }
   if( this._options.message && ((k==13 && (ctrl || myRealAgent == 'opera')) || (k==10)) ) {
      var mmsg = this._options.message.value;


AND

   'a#sndmessagelnk' : function(el) {
      if( myRealAgent == 'opera' ) {
         el.innerHTML = el.innerHTML.replace('Ctrl-','');
      }
   },

PS: it is exactly the same as Caba done
« Last Edit: August 02, 2013, 10:11:14 PM by faf »

mihainord

  • Jr. Member
  • **
  • Posts: 4
Re: how can i send message by pressing enter key
« Reply #8 on: April 02, 2009, 06:27:15 AM »
Great. I've also made the modification.

As a footnote I'd like to add that this script beats a lot of very expensive other same-purpose scripts. I hope it'll evolve faster and faster and people start donating because it would be great to see this script recongnized by many others as one of the best out there.