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

Add new font size buttons

A collection of how-to's, submitted by users for other users!

Moderator: re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby Calman45 » Fri Oct 22, 2010 7:25 am

Hi Folks,

This example will help you set up a couple of small icons/routines to add additional font sizes to your chat room.

Firstly, open up pfcclient.js and search for "// try to parse bbcode". Below this note, you will see the existing scripts for "font-weight" ... "font-style" ... "underline" etc.

What we are going to do, is add a couple of new scripts, to allow you to add custom font sizes! (let's call them "enhanced text" & "large text")

Now, add this code below these existing scripts mentioned above (leave a blank line between them)

Code: Select all
rx = new RegExp('\[size=1\](.+?)\[/size\]','ig');
msg = msg.replace(rx, '<span style="font-size: [b]20[/b];">$1</span>');
   
rx = new RegExp('\[size=2\](.+?)\[/size\]','ig');
msg = msg.replace(rx, '<span style="font-size: [b]30[/b];">$1</span>');

Save your pfcclient.js file.



Now open chat.html.tpl.php and locate the segment below:

Code: Select all
      <div id="pfc_bt_delete_btn" class="pfc_btn">
        <img src="<?php echo $c->getFileUrlFromTheme('images/bt_del.gif'); ?>"
             id="pfc_bt_delete"
             alt="<?php echo _pfc("Delete"); ?>"
             title="<?php echo _pfc("Delete"); ?>"
             class="pfc_bt_delete"
             onclick="pfc.insert_text('[s]','[/s]',true)" />
      </div>

On a new line below (again, leave a blank line space) ... add this new segment below:

Code: Select all
     <div id="pfc_bt_delete_btn" class="pfc_btn">
        <img src="<?php echo $c->getFileUrlFromTheme('images/[b]YOURBUTTON1.gif[/b].gif'); ?>"
             id="pfc_bt_delete"
             alt="Enhanced Text""
             title="Enhanced Text""
             class="pfc_bt_delete"
             onclick="pfc.insert_text('[size=[b]1[/b]]','[/size]',true)" />
      </div>
    
     <div id="pfc_bt_delete_btn" class="pfc_btn">
        <img src="<?php echo $c->getFileUrlFromTheme('images/[b]YOURBUTTON2.gif[/b]'); ?>"
             id="pfc_bt_delete"
             alt="Large Text""
             title="Large Text""
             class="pfc_bt_delete"
             onclick="pfc.insert_text('[size=[b]2[/b]]','[/size]',true)" />
      </div>

I have highlighted in bold "size=1" and "size=2" ... as these are the references from the pfcclient.js file, where I set the font sizes to 20pt and 30pt (you can make them whatever works best for your set up)


** Please back up your files, before carrying out these changes, thank you!


All the best,
Cal :)
Last edited by Calman45 on Fri Oct 22, 2010 7:28 am, edited 1 time in total.
Calman45
Support Team
 
Posts: 150
Joined: Sun Oct 26, 2008 11:09 pm
Location: Western Canada
  • Website
Top

Postby quutoo » Mon Jun 13, 2011 4:51 am

IT seems it does not work
222
quutoo
Member
 
Posts: 12
Joined: Sat Jun 11, 2011 1:40 pm
Top

Postby Calman45 » Tue Jun 14, 2011 11:47 pm

quutoo, trust me! ... it does work, as I tested it extensively before posting the routine here.

- make sure you "rehash" your chat room!

All the best,
Cal :)
Calman45
Support Team
 
Posts: 150
Joined: Sun Oct 26, 2008 11:09 pm
Location: Western Canada
  • Website
Top


Post a reply
3 posts • Page 1 of 1

Return to How-to (v1.x)

Who is online

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