Insert this code into the <head> tags of the page with your chatroom (Default index.php)
- Code: Select all
<script type="text/javascript"> //additional Javascript to set commandbuttons
function setBox(txt) {
var thebox=document.getElementById("pfc_words")
if (thebox) {
thebox.value = txt
pfc.doSendMessage()
}
}
</script>
That creates a function that will send commands sent from outside the chat box.
Step 2:
Create your list using the HTML list tags.
- Code: Select all
<u>Channels</u>
<ul>
<li>
Channel 1
</li>
<li>
Channel 2
</li>
</ul>
This list goes in somewhere in the <body> section of your HTML, position it accordingly to where you want the list to appear (You'll need to know some HTML/CSS to be able to do this cleanly).
Step 3:
Add the function calls with the arguments into the list items.
- Code: Select all
<u>Channels</u>
<ul>
<li onClick="setBox('/join Channel 1')">
Channel 1
</li>
<li onClick="setBox('/join Channel 2')">
Channel 2
</li>
</ul>
In this case, because we used an HTML list it's the <li> tags that define the link, you can change the lists to a divider, a table, anything. When you click in it, the function will be called with the argument "/join", with some sense, you can change this to many things.
Notes:
If you want it to be a standard hyperlink, use the anchor <a> tag as normal, the href="" should point to the function call like so:
- Code: Select all
<a href="setBox('/join Channel 2')">Join Channel 2</a>
If you want to grab a list of all channels with user count > 0 you'll need to know a bit more code, I haven't figured this one out yet as I don't yet need to, I'll update if I create the code or someone here posts it before me
Additional:
If you want to add commands to execute before they join the room (At one point I used the /leave command to leave the current room then join the new one), simply find this section in the function:
- Code: Select all
thebox.value = txt
pfc.doSendMessage()
And then add this before it:
- Code: Select all
thebox.value = "/leave"
pfc.doSendMessage()
That will make the user leave their current channel then join the channel they clicked on.
There are some timing bugs with doing another command AFTER joining the new channel, it sort of works but editing the join.class.php command is more likely to work.