NChat - No SQL Save BW shoutbox

Started by nvcnvn, April 13, 2011, 11:30:28 AM

Previous topic - Next topic

roughkut


Luis-

I sound like such an idiot but how can I edit it by adding new colours to the colours tab?

- Luis.

xrunner

nvcnvn,

I know you are busy now, but I sincerely hope you can find time to make a second version and incorporate some additional suggestions in the future. I think with a few more improvements it's going to be the best shout box available for SMF.

Thanks.

nvcnvn

Quote from: Luis Geramia on May 10, 2011, 10:57:30 AM
I sound like such an idiot but how can I edit it by adding new colours to the colours tab?

- Luis.

Luis, nothing idiot here! :)
You can open the NChatBoardIndex.php
FInd:

<option style="background: Orange;" value="Orange">'.$txt['NChat_orange'].'</option>

and add after

<option style="background: #c0c0c0;" value="#c0c0c0">Gray</option>

this will add the gray color (not sure this color called gray ornot ;)) my Enlgish very bad :D ). You should now something about RGB format for more color!


Hi xrunner!
Quote from: xrunner on May 10, 2011, 11:47:11 AM
I know you are busy now, but I sincerely hope you can find time to make a second version and incorporate some additional suggestions in the future.
yes, i'm trying but just one 1 or 1/2h per day so I thought the next version should be at the end of August. Hmm first year in university make me quite of busy and stress...! I'm waiting for the summer vacation at the end of July :(

roughkut

Is it possible to make links clickable? Or is that a new feature on the next version?

nvcnvn

Quote from: roughkut on May 12, 2011, 01:08:37 AM
Is it possible to make links clickable? Or is that a new feature on the next version?
Nice guest! yes it will on the next version.
But maybe if you want you can:
Open NChatHandle.php Find:

function NChatParser($subject = ''){
global $NChat, $smilies;

Add after

// Only do this if the preg survives. These line is SMF's code :P
if (is_string($result = preg_replace(
'~(?<=[\s>\.(;\'"]|^)((?:http|https)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'
,'<a href="$1" target="_blank">$1</a>'
, $subject)))
$subject = $result;

steeltape

how can i make so that guest can see the chat but not able to chat?
thanks.. great mod here

roughkut

Thank you, the code works! (But I had to make sure that wordwrap wasn't checked in notepad)  ;D

nvcnvn

Quote from: roughkut on May 13, 2011, 01:49:02 AM
Thank you, the code works! (But I had to make sure that wordwrap wasn't checked in notepad)  ;D
:D can you tell me more detail! the fact is my englsh very bad, and I not sure what is your means!

Quote from: steeltape on May 12, 2011, 11:50:13 PM
how can i make so that guest can see the chat but not able to chat?
thanks.. great mod here

1 Remeber to disable Guest.
2. Edit these code:
2a. Open NChatBoardIndex.php
find

if($NChatInfo['can_chat'] == true){
echo '

replace

if(true){
echo '


2b. Open NChatHandle.php
find

function NChatReader(){
global $NChat, $NChatInfo;
if($NChatInfo['can_chat'] == true){

replace

function NChatReader(){
global $NChat, $NChatInfo;
if(true){

steeltape


3voLutioN

hello...at first i have to say your Shoutbox is really great good work.....Now to my question...is it possible to change the Background of the Shoutbox?

nvcnvn

Quote from: 3voLutioN on May 17, 2011, 06:24:08 PM
hello...at first i have to say your Shoutbox is really great good work.....Now to my question...is it possible to change the Background of the Shoutbox?

Open NChatHandler.php
Find
<div id="NChat_admin_shoutbox" style="width:100%;height:150px;overflow:auto;border-style:solid;border-width:0.5px;"></div>
Replace
<div id="NChat_admin_shoutbox" style="width:100%;height:150px;overflow:auto;border-style:solid;border-width:0.5px;background-color:yellow;"></div>

For the background as yellow!

Have some fun!

xrunner

That background code doesn't have any effect on my forum. I tried many different colors and checked the code - it has no effect.

nvcnvn

Quote from: xrunner on May 18, 2011, 07:05:09 PM
That background code doesn't have any effect on my forum. I tried many different colors and checked the code - it has no effect.
So unusual!
Can I have you forum link with an ID?

xrunner

Quote from: nvcnvn on May 18, 2011, 08:47:35 PM

Can I have you forum link with an ID?

Just click on my banner - but I don't know what you mean by "id". If you want to register you can.

nvcnvn

hi xrunner
I'm not sure which browser platform you are using but I have tested in Google Chrome (Ubuntu 10.04)

xrunner

I use Firefox. It doesn't seem to work under that browser.

nvcnvn

Quote from: xrunner on May 18, 2011, 09:27:24 PM
I use Firefox. It doesn't seem to work under that browser.
I'm sure that there is a misstake here!
Please try to edit the code as I said, and reply this topic that I can sure that you edit it at the correct way!

Tomas1

#78
thise are my simple custom changes to the NChat MOD ( Browser - Mozzila Firefox ) :

Step 1 : Find and add these lines :

.../NChat/NChatBoardIndex.php

find -if($NChatInfo['can_chat'] == true){
echo '


add after - <center>
<span style="text-align:justify;color:red;text-shadow:4px 4px 8px #758ACC;"><blink><font size="4";>Oui5 General Chat[/color]</font></blink></span>
</center>
<p> </p>



find - <div id="NChat_admin_shoutbox" style="width:100%;height:150px;overflow:auto;border-style:solid;border-width:0.5px;"></div>

replace with - <div id="NChat_admin_shoutbox" style="width:100%;height:150px;overflow:auto;border-style:solid;border-width:0.5px;background-color:#DCE3E9;"></div>
<div style="height:35px;">
<p> </p>




find - <input id="NChat_input" onkeypress="if((event.keyCode == 13) && (this.value.length > 0)){ NChat_sender(); return false;}" contenteditable="true" style="width:100%;" />

replace with - <p> </p>
<center><blink><b><span style="color:darkblue;text-shadow:4px 4px 8px #758ACC;">Type here :</span></b><blink> <input id="NChat_input" onkeypress="if((event.keyCode == 13) && (this.value.length > 0)){ NChat_sender(); return false;}" contenteditable="true" style="width:70%;background-color:#DCE3E9" /></center>
<p> </p>
<hr>


New Full .../NChat/NChatBoardIndex.php will look like this :


<?php
//Now, some setiing for chating, make sure you know how to change it!
$NChat unserialize(file_get_contents($boarddir.'/NChat/NChatSetting.php'NULLNULL14));

$NChatInfo['url'] = $boardurl.'/NChat/index.php';
//Check if user can or not
//Set some value and change it
$NChatInfo['name']      = $context['user']['name'];
$NChatInfo['time']      = $context['current_time'];
$NChatInfo['NChatMess'] = $boarddir.'/NChat/'.$NChat['NChatMess'];
$NChatInfo['admin']     = false;
$NChatInfo['mod']       = false;
$NChatInfo['guest']     = false;
$NChatInfo['can_mod']   = false;
$NChatInfo['can_chat']  = true;
if(
$context['user']['is_admin']){
$NChatInfo['admin'] = true;
$NChatInfo['can_mod'] = true;
}
if(
$context['user']['is_mod'] && !$context['user']['is_admin']){
$NChatInfo['mod'] = true;
$NChatInfo['can_mod'] = true;
}
if(
$context['user']['is_guest']){
$NChatInfo['guest'] = true;
if($NChat['guest'] != true)
$NChatInfo['can_chat'] = false;
}
//Load Yahoo Smile to use if need!
if($NChat['smile'] == 1)
$smilies unserialize(file_get_contents($boarddir.'/NChat/NChatSmiles.txt'));

if(
$NChatInfo['admin'] == true){
echo '
<div id="NChat_tools">
<button onclick="NChat_ajax(\'NChat=clean\');">'
.$txt['NChat_clean'].'</button>
<button onclick="NChat_ajax(\'NChatSetting=guest&NChatSettingVal='
.($NChat['guest'] ? 'disableguest\');window.location.reload();">'.$txt['NChat_disable_guest'] : 'enableguest\');window.location.reload();">'.$txt['NChat_enable_guest']).'</button>';
echo '
</div><br />'
;
}
if(
$NChatInfo['can_chat'] == true){
echo '
<center>
<span style="text-align:justify;color:red;text-shadow:4px 4px 8px #758ACC;"><blink><font size="4";>Oui5 General Chat</font></blink></span>
</center>
<p> </p>
<div id="NChat_admin_shoutbox" style="width:100%;height:150px;overflow:auto;border-style:solid;border-width:0.5px;background-color:#DCE3E9;"></div>
<div style="height:35px;">
<p> </p>
<button id="bold" onclick="NChat_format(this.id);" style="width:35px;font-weight:bold;">'
.$txt['NChat_blod'].'</button>
<button id="underline" onclick="NChat_format(this.id);" style="width:35px;text-decoration:underline;">'
.$txt['NChat_underline'].'</button>
<button id="italic" onclick="NChat_format(this.id);" style="width:35px;font-style:italic;">'
.$txt['NChat_italic'].'</button>
<button onclick="document.getElementById(\'NChat_smiles\').style.display = \'block\';">'
.$txt['NChat_add_smileys'].'</button>
<select onchange="NChat_color();" id="NChat_color">
<option selected="selected" value="Black">'
.$txt['NChat_black'].'</option>
<option style="background: Red;" value="Red">'
.$txt['NChat_red'].'</option>
<option style="background: Teal;" value="Teal">'
.$txt['NChat_teal'].'</option>
<option style="background: Blue;" value="Blue">'
.$txt['NChat_blue'].'</option>
<option style="background: Green;" value="Green">'
.$txt['NChat_green'].'</option>
<option style="background: Brown;" value="Brown">'
.$txt['NChat_brown'].'</option>
<option style="background: Orange;" value="Orange">'
.$txt['NChat_orange'].'</option>
</select>
</div>'
;
if($NChat['smile'] == 1){
echo '
<div id="NChat_smiles" style="display:none;">'
;
$faces array_values($smilies);
$icons array_keys($smilies);
$i 0;
$j 0;
while($j<20){
if($faces[$i] != $faces[$i 1]){
echo '<span onclick="NChat_smile(this.id)" id="'.$icons[$i].'">'.$faces[$i].'</span>';
$j ++;
}
$i++;
}
echo '<a href="#" onclick="document.getElementById(\'NChat_smiles_2\').style.display = \'block\';">'.$txt['NChat_more_smileys'].'</a>
<div id="NChat_smiles_2" style="display:none;">'
;
for($j=$i;$j<=85;$j++){
if($faces[$j] != $faces[$j 1]){
echo '<span onclick="NChat_smile(this.id)" id="'.$icons[$j].'">'.$faces[$j].'</span>';
}
}
echo '
</div>
</div>'
;
}
echo '
<div>
<p> </p>
<center><blink><b><span style="color:darkblue;text-shadow:4px 4px 8px #758ACC;">Type here :</span></b><blink> <input id="NChat_input" onkeypress="if((event.keyCode == 13) && (this.value.length > 0)){ NChat_sender(); return false;}" contenteditable="true" style="width:70%;background-color:#DCE3E9" /></center>
<p> </p>
<hr>
</div>
<script type="text/javascript">
var refreshtime = '
.($NChat['time']*1000).';
var NChatUrl = "'
.$NChatInfo['url'].'";
var NChatInput = document.getElementById("NChat_input");
var format_bold = false;
var format_underline = false;
var format_italic = false;
function NChat_reload()
{
NChat_ajax("NChat=read");
reload = setTimeout("NChat_reload();",refreshtime);
}
function NChat_ajax(param)
{
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4){
if (xmlhttp.status == 200)
document.getElementById("NChat_admin_shoutbox").innerHTML = xmlhttp.responseText;
else
document.getElementById("NChat_admin_shoutbox").innerHTML = "<div class=\'errorbox\'>'
.$txt['NChat_index_unavailable'].'</div>";

}
}
//xmlhttp.open("GET", NChatUrl, true);
//xmlhttp.send();

xmlhttp.open("POST", NChatUrl, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", param.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(param);
}
function NChat_replace(str)
{
str = str.replace(/\+/g, "%2B");
str = str.replace(/\&/g, "%26");
str = str.replace(/\#/g, "%23");
return str;
}
function NChat_format(what)
{
if(document.getElementById(what).innerHTML.length > 1) {
document.getElementById(what).innerHTML = document.getElementById(what).innerHTML[0];
if(what == "bold"){
NChatInput.style.fontWeight = "normal";
format_bold = false;
}
if(what == "italic"){
NChatInput.style.fontStyle = "normal";
format_italic = false;
}
if(what == "underline"){
NChatInput.style.textDecoration = "none";
format_underline = false;
}
}else{
document.getElementById(what).innerHTML += "*";
if(what == "bold"){
NChatInput.style.fontWeight = "bold";
format_bold = true;
}
if(what == "italic"){
NChatInput.style.fontStyle = "italic";
format_italic = true;
}
if(what == "underline"){
NChatInput.style.textDecoration = "underline";
format_underline = true;
}
}
NChatInput.focus();
}
function NChat_color()
{
NChatInput.style.color = document.getElementById(\'NChat_color\').value;
NChatInput.focus();
}
function NChat_smile(what)
{
NChatInput.value += what;
NChatInput.focus();
}
function NChat_sender()
{
var formatString = "";
if(format_bold) formatString += "&&bold=true";
if(format_underline) formatString += "&&underline=true";
if(format_italic) formatString += "&&italic=true";
formatString += "&&color=" + document.getElementById("NChat_color").value;
sender = NChat_ajax("NChat=write&&NChat_mess=" + NChat_replace(NChatInput.value) + formatString);
clearTimeout(reload);
NChat_reload();
NChatInput.value = "";
}
NChat_reload();
window.onunload = function() {
clearTimeout(reload);
};
</script>'
;
}
?>




Nice MOD dude thx for sharing it

The result will be this :

web835,
www.oui5.com

nvcnvn


Advertisement: