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