Option to hide chatbox
3 posters
Page 1 of 1
Option to hide chatbox
Is it possible to create an option to hide chatbox (with cookie)?
Extra question: Also, is it possible to move the chatbox up and down the main page?
Extra question: Also, is it possible to move the chatbox up and down the main page?
Tonight- Forumember
- Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia
Re: Option to hide chatbox
Up. I want like a toggle option.
Tonight- Forumember
- Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia
Re: Option to hide chatbox
Hello @Tonight,
Could you provide some information please ?
Thanks
Could you provide some information please ?
- The version of your forum
- Are you using the default chatbox ?
Thanks
Re: Option to hide chatbox
phpBB3
default chatbox
default chatbox
Tonight- Forumember
- Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia
Re: Option to hide chatbox
Go to Administration Panel > Modules > JavaScript codes management > Create a new script
Title : Your choice
Placement : In the homepage
Paste the code below and submit :
Then add this to your stylesheet
Display > Colors > CSS stylesheet
Title : Your choice
Placement : In the homepage
Paste the code below and submit :
- Code:
$(function() {
if (!document.getElementById('frame_chatbox')) return;
var fa = document.getElementById('frame_chatbox'), frame;
// create toggle buttons
$('#chatbox_top').before('<div class="online-chat">Members in chat : <span id="members-chat" style="color:#F00;">0</span></div><div id="cbOpen" class="cbButton">Click to open chatbox</div><div id="cbClose" class="cbButton">Click to close chatbox</div>');
$('#chatbox_top, #cbClose').hide();
fa.onload = function() {
if (fa.contentDocument) frame = fa.contentDocument;
else if (fa.contentWindow) frame = fa.contentWindow.document;
// kill the interval if archives are toggled
var a = frame.getElementsByTagName('A');
for (i=0; i<a.length; i++) if (/archives/.test(a[i].href)) a[i].onclick = function() { window.clearInterval(_chat_refresh) };
// get the amount of members and compare change
then = frame.getElementById('chatbox_members').getElementsByTagName('li').length;
var members = document.getElementById('members-chat');
members.innerHTML = then;
_chat_refresh = window.setInterval(function() {
var now = frame.getElementById('chatbox_members').getElementsByTagName('li').length;
// change the chat member number
if (now < 1 || then < 1) members.style.color = '#F00';
else if (now > 0 || then > 0) members.style.color = '#39C';
// check if there is a change in members
if (now > then || now < then) {
members.innerHTML = now;
then = now;
}
},1);
};
// open chat function
$('#cbOpen').click(function() {
$('#chatbox_top, #cbClose').show();
$('#cbOpen').hide();
// adjust scroll
if (fa.contentDocument) fa.contentDocument.getElementById('chatbox').scrollTop = 99999;
else if (fa.contentWindow) fa.contentWindow.document.getElementById('chatbox').scrollTop = 99999;
});
// close chat function
$('#cbClose').click(function() {
$('#chatbox_top, #cbClose').hide();
$('#cbOpen').show();
});
});
Then add this to your stylesheet
Display > Colors > CSS stylesheet
- Code:
.cbButton {
cursor:pointer;
text-align:center;
font-weight:bold;
font-size:12px;
margin:3px;
}
Re: Option to hide chatbox
ange can you make this for phpbb2 defult browser 2. seems like a cool thing to have
Similar topics
» Seamless Player Hide/Show option
» I want to remove the option to hide my online status on user profiles.
» Option for members to 'Hide my online status' has disappeared from Profile Preferences
» Option to turn the chatbox into a shoutbox.
» Hide Admin Online Status & Hide Rank Title
» I want to remove the option to hide my online status on user profiles.
» Option for members to 'Hide my online status' has disappeared from Profile Preferences
» Option to turn the chatbox into a shoutbox.
» Hide Admin Online Status & Hide Rank Title
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum