• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Add a \'send\' button

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby grugnog » Wed Jun 28, 2006 1:39 pm

This adds a button that sends the chat when it is clicked (equivalent to pressing return). This is for 0.9.7 - I haven't tested it on the version 1 betas yet.
Enjoy!
- Owen

Add this to chat.html.tpl.php in your theme:
- A good place is right above or below the line for the nick button (the only other <input> element)

Code: Select all
<input id="<?php echo $prefix; ?>words_submit" type="button" value="Send Message" title="Send Message" onclick="if (!pfc.isconnected) return false; sendbutton();" />

Add this to chat-post.js.tpl.php in your theme:

Code: Select all
/**
 * Put here the JS code to execute just after the pfcClient object instance creation
 */
 function sendbutton() {
  if (!pfc.isconnected) return false;
  pfc.clearError(Array(pfc.el_words));
  var w = pfc.el_words;
  var wval = w.value;
  re = new RegExp("^(/[a-z]+)( (.*)|)");
  if (wval.match(re))
  {
    /* a user command */
    cmd   = wval.replace(re, '$1');
    param = wval.replace(re, '$2');
    pfc.handleRequest(cmd, param.substr(0,<?php echo $max_text_len; ?> + pfc.clientid.length));
  }
  else
  {
    /* a classic 'send' command*/
    pfc.handleRequest('/send', wval.substr(0,<?php echo $max_text_len; ?>));
  }
  w.value = '';
  return false;
}
grugnog
New member
 
Posts: 4
Joined: Sun Jun 25, 2006 2:07 pm
Top

Postby Rubke » Wed Aug 09, 2006 11:03 pm

got an error with release 1.0-beta4

pfc.handleRequest unknown function..

had to replace it with pfc.sendRequest
Rubke
New member
 
Posts: 5
Joined: Wed Aug 09, 2006 10:39 pm
Top

Postby phpchat » Tue Sep 19, 2006 9:32 am

Anyone know how to do this in the latest version?
phpchat
Member
 
Posts: 20
Joined: Fri Sep 08, 2006 9:20 pm
Top


Post a reply
3 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 7 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub