Enter to chat / comment

This mod is simple, you set it up so that the comment will be submitted and chat messages will be sent when you hit enter. To add new lines, users can hit Shift + Enter.
 
At the moment, the script will do the following
- Detect Enter key and "click" the submit / reply button automatically
- Do nothing if the user Shift + Enter
- Do nothing if the user is tagging someone or selecting emoticons
- Do nothing if the user is using mobile devices

the script can be found here http://pastebin.com/rgur51TK

To install, put this script on the header file.
Then go to your admin dashboard > Theme Manager > Base Theme, copy out Elements > activities.ctp, activities_chrono.ctp, comment_form.ctp to your theme
In all those files, find this text:
 
$this->Form->textarea
 
add this right after array(
 
'onkeydown' => 'kd(event, this)',

remember to include the comma as well.
 
Hit save and test
 
If you have any bugs, please tell me in the comment, thanks
Posted in Modifications on 05/25/16 at 09:30
Comments (5)
How can I do that? I did not quite get it. Could you help?
Aister  
at what stage do you need help with?
if a picture expression would be great.
Aister  
http://i.imgur.com/DGPG0jf.png this is Dashboard > Theme Manager > Base Theme, clicked on Elements and then activities.ctp. After loading you will see the "Copy" button. Click on Copy will copy the file to your theme. Do the same to the rest of the files.

Then go to your theme, and again, click on Elements and the files.

If you don't know how to put the script on the header, you can put the script above the <?php if($this->request->is('ajax&#039): ?> lines, and then follow the rest of the ins...  more
Thank you, Aister, for your contribution!
No login
Login or register to post your comment
Cookies on mooCommunity - Social Networking Script.
This site uses cookies to store your information on your computer.