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

Here is how to add the \"Send\" button

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

Post a reply
3 posts • Page 1 of 1

Postby bcc » Thu Jun 22, 2006 5:21 am

I think I'm not the only one getting comments from users of my little community stating that they don't know how to send the messages. Apparently, hitting enter is not intuitive enough for most people when it comes to browser-based applications.

I don't know if the devs are going to add an option to display a button in the future or not, but I needed a quick solution now.

So if anyone else needs a button, here is a patch for 0.9.3.
Disclaimer: this is a really ugly (and possibly not safe) hack of a lazy man who knows neither php nor javascript. So use at your own risk.

Code: Select all
Index: themes/default/templates/chat.html.tpl.php
===================================================================
--- themes/default/templates/chat.html.tpl.php   (revision 1333)
+++ themes/default/templates/chat.html.tpl.php   (working copy)
@@ -18,7 +18,21 @@
   </div>
 
   <div id="<?php echo $prefix; ?>input_container">
-    <input id="<?php echo $prefix; ?>words" type="text" title="<?php echo _pfc("Enter your message here"); ?>" maxlength="<?php echo $max_text_len-25; ?>" />
+    <input id="<?php echo $prefix; ?>words" type="text" title="<?php echo _pfc("Enter your message here"); ?>" maxlength="<?php echo $max_text_len-25; ?>" />
+   
+   <script type="text/javascript">
+      function fakeKeyEvent(){
+         this.keyCode=13;
+      }
+      function fireFakeKeyEvent(){
+         var fakeKeyEvt=new fakeKeyEvent();
+         window.pfc.callbackWords_OnKeypress(fakeKeyEvt);
+      }
+   </script>
+   <input type="button" value="Send" style="border:black solid 1px; padding:0 4px 0 4px; color:black; background-color:#CCCCCC; text-align:center; margin-top:3px; margin-bottom:2px;" onclick="fireFakeKeyEvent();">
+
+
+   
     <div id="<?php echo $prefix; ?>cmd_container">
       <input id="<?php echo $prefix; ?>handle" type="button" title="<?php echo _pfc("Enter your nickname here"); ?>" maxlength="<?php echo $max_nick_len; ?>" value="<?php echo $nick; ?>" onclick="if (!pfc.isconnected) return false; pfc.el_words.focus(); pfc.handleRequest('/asknick');" />
       <div class="<?php echo $prefix; ?>btn"><img src="<?php echo $c->getFileUrlFromTheme('images/logout.gif'); ?>" alt="" title="" id="<?php echo $prefix; ?>loginlogout" onclick="pfc.connect_disconnect()" /></div>
Last edited by bcc on Thu Jun 22, 2006 5:24 am, edited 1 time in total.
bcc
Member
 
Posts: 54
Joined: Wed Mar 08, 2006 4:09 am
Top

Postby Drakester » Sat Jun 24, 2006 7:44 pm

I hope you don't mind but I took your programming and made a few changes. If you take this portion of your code and place it on Approximtly line 34 of ../../chat.html.tpl.php (if this file has not been previously changed) this will put your button directly after the Who's online image. By the way your code works great
Thanks


<script type="text/javascript">
function fakeKeyEvent(){
this.keyCode=13;
}
function fireFakeKeyEvent(){
var fakeKeyEvt=new fakeKeyEvent();
window.pfc.callbackWords_OnKeypress(fakeKeyEvt);
}
</script>
<input type="button" value="Send" style="border:black solid 1px; padding:0 4px 0 4px; color:black; background-color:#CCCCCC; text-align:center; margin-top:3px; margin-bottom:2px;" onclick="fireFakeKeyEvent();">
<div id="<?php echo $prefix; ?>cmd_container"></div>
Last edited by Drakester on Sat Jun 24, 2006 10:57 pm, edited 1 time in total.
"Wise men talk because they have something to say. Fools talk because they have to say something."
-- Plato
Drakester
New member
 
Posts: 6
Joined: Sun Jun 11, 2006 12:53 am
Location: Sioux City, IA. USA
  • Website
Top

Postby phpchat » Wed Sep 20, 2006 6:39 pm

Will this work in

style.css.tpl.php ?

I really need this, so I'm willing to pay...
Last edited by phpchat on Wed Sep 20, 2006 6:51 pm, edited 1 time in total.
phpchat
Member
 
Posts: 20
Joined: Fri Sep 08, 2006 9:20 pm
Top


Post a reply
3 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 13 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