<!-- Designed by Mohammad Bahoosh -->
<!-- Copyright (c) by Moisrex -->
<!-- All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<title>چت روم</title>
<meta charset="utf-8">
<style>
html,body{margin:0px;padding:0px;overflow:hidden;height:100%;width:100%;}
</style>
</head>
<body>
<script>
/* Designed By Moisrex.rozblog.com
* CopyRight(c) By Moisrex
* All Rights Reserved.
*/
var user='amir', //change it
blog='royaye_khis', //change it
win={
width:function(){
if(d.body && d.body.offsetWidth)return d.body.offsetWidth;
if(d.compatMode=='CSS1Compat'&&d.documentElement&&d.documentElement.offsetWidth)return win.width=d.documentElement.offsetWidth;
if(window.innerWidth && window.innerHeight)return window.innerWidth;
},
height:function(){
if(d.body && d.body.offsetWidth)return d.body.offsetHeight;
if(d.compatMode=='CSS1Compat'&&d.documentElement&&d.documentElement.offsetWidth)return d.documentElement.offsetHeight;
if(window.innerWidth && window.innerHeight)return window.innerHeight;
}
},
//rozblog problems:
// . slash in onclick of p.m
d=document,
g='getElementById',
e='getElementsByTagName',
cl='getElementsByClassName',
cr='createElement',
w='window',
a='appendChild',
set='setAttribute',
len='length',
s='style',
val='value',
re='replace',
inn='innerHTML',
rAttr='removeAttribute',
gAttr='getAttribute',
body=d.body||d[e]('body')[0]||d.documentElement,
head=d.head||d[e]('head')[0]||body,
lastId=0,
stopTime=500,//wait x ms after send a message
reloadTime=2000,// time reload messages
onlineRT=7000,// time reload onlines
post_limit=100,//all message in box
makeSmiles={
// all smiles = 428
alls:428,
pages:21, // parseInt(428/20)
page:-1,
itemInPage:20,
lastpage:420, // makeSmiles.pages*makeSmiles.itemInPage
next:function(){
var s='';
this.page++;
if(this.page>this.pages)
this.page=0;
for(i=this.page*this.itemInPage;i<this.page*this.itemInPage+this.itemInPage;i++)
s+=i>this.alls?'':'<li><img onclick="smile(\':\'+'+i+'+\':\')" src="/chat/smiles/1 ('+i+').gif" alt=":'+i+':"></li>';
return '<ul>'+s+'</ul>';
},
prev:function(){
var s='';
this.page--;
if(this.page<0)
this.page=this.pages;
for(i=this.page*this.itemInPage;i<this.page*this.itemInPage+this.itemInPage;i++)
s+=i>this.alls?'':'<li><img onclick="smile(\':\'+'+i+'+\':\')" src="/chat/smiles/1 ('+i+').gif" alt=":'+i+':"></li>';
return '<ul>'+s+'</ul>';
}
},
bigEl=d[cr]('div'),
StyleSheet=d[cr]('style');
StyleSheet.id='StyleSheetID';
StyleSheet[inn]='\
#chatRoom{\
background-color:purple;\
box-shadow:0 0 3px #000;\
-moz-box-shadow:0 0 3px #000;\
-o-box-shadow:0 0 3px #000;\
-ms-box-shadow:0 0 3px #000;\
-webkit-box-shadow:0 0 3px #000;\
padding:5px;\
color:#FFF;\
direction:ltr;\
z-index:300;\
font:11px tahoma;\
}\
#massageBox{\
border:1px #999 solid;\
padding:3px;\
height:'+(win.height()-(3*2)-24-5-10-11)+'px;\
margin-bottom:5px;\
overflow:auto;\
background:#F5F5F5;\
color:#000;\
direction:rtl;\
box-shadow:0 0 20px #999 inset;\
-moz-box-shadow:0 0 20px #999 inset;\
-o-box-shadow:0 0 20px #999 inset;\
-ms-box-shadow:0 0 20px #999 inset;\
-webkit-box-shadow:0 0 20px #999 inset;\
border-radius:2px;\
-moz-border-radius:2px;\
-o-border-radius:2px;\
-ms-border-radius:2px;\
-webkit-border-radius:2px;\
}\
#massageBox hr{border:none;border-top:1px #ccc dashed;clear:both;margin:2px 0;}\
#chatRoom table{width:100%;font:11px Tahoma;}\
#chatRoom td{padding:5px;}\
#txt{\
border:1px #ccc solid;\
padding:3px;\
background-color:#F5F5F5;\
font:11px Tahoma;\
direction:rtl;\
float:right;\
width:'+(win.width()-80-82)+'px;\
padding-left:15px;\
}\
#chatRoom button{\
font:11px Tahoma;\
border:1px #303 solid;\
border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;-ms-border-radius:3px;-webkit-border-radius:3px;\
cursor:pointer;\
background:#606;\
padding:3px;\
color:#FFF;\
}\
#chatRoom button:hover{\
background-color:#303;\
}\
.message{word-wrap:break-word;}\
.message .del{\
border:1px #ccc solid !important;\
background:#606 !important;\
color:#FFF !important;\
float:left !important;\
cursor:pointer;\
border-radius:3px;\
-moz-border-radius:3px;\
-o-border-radius:3px;\
-ms-border-radius:3px;\
-webkit-border-radius:3px;\
font:11px Tahoma;\
margin:2px;\
}\
.message .del:hover{\
background-color:#303 !important;\
}\
.MoisrexSets{\
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+dpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMTMtMTEtMDdUMTg6MjQ6MzcrMDM6MzAiIHhtcDpNb2RpZnlEYXRlPSIyMDEzLTExLTA3VDE4OjI2OjE2KzAzOjMwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDEzLTExLTA3VDE4OjI2OjE2KzAzOjMwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpDMDhEQTdFNTQ3QkMxMUUzQkFDMTlCMTdDM0VGQUQwQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpDMDhEQTdFNjQ3QkMxMUUzQkFDMTlCMTdDM0VGQUQwQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkMwOERBN0UzNDdCQzExRTNCQUMxOUIxN0MzRUZBRDBDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkMwOERBN0U0NDdCQzExRTNCQUMxOUIxN0MzRUZBRDBDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+ZU2DcwAAAJhJREFUeNpiYMAN5gPxfyS8HpdCJjyGKKDxBRgIAJACBySFBUD8Hs0l76Hi2NSjOB2k8D6aZnR8H8mC+TADHAhoIoRB+sEBhk1yPVK4KBBQxxCAxf+4YmI9lnAKgEkaoEkq4IkxZHUG6AqQJfEBDMuYkFyCL40QTDtUCROqxA5V0glVUizV8g42sB/NkP3kFAUfCPDhACDAAEnLjRs+JwqFAAAAAElFTkSuQmCC) no-repeat center;\
width:17px;\
height:17px;\
cursor:pointer;\
position:absolute;\
margin-left:10px;\
margin-top:3px;\
float:right;\
}\
#set{\
position:absolute;\
top:50%;\
left:50%;\
margin-top:-50px;\
margin-left:-100px;\
width:200px;\
height:100px;\
direction:rtl;\
background:#e5e5e5;\
border:1px #999 solid;\
border-radius:3px;\
-moz-border-radius:3px;\
-o-border-radius:3px;\
-ms-border-radius:3px;\
-webkit-border-radius:3px;\
padding:5px;\
box-shadow:0 0 3px #999;\
-moz-box-shadow:0 0 3px #999;\
-o-box-shadow:0 0 3px #999;\
-ms-box-shadow:0 0 3px #999;\
-webkit-box-shadow:0 0 3px #999;\
color:#000;\
direction:rtl;\
}\
.time{font-weight:normal;}\
#size{position:absolute;color:#666;margin-top:3px;margin-left:35px;}\
#onsTop{\
border:1px #303 solid;\
background:#606;\
padding:2px;\
height:'+(win.height()-(3*2)-24-5-10-11)+'px;\
margin:3px;\
}\
#ons,#smiles{background:#f5f5f5;direction:ltr;text-align:left;border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;-ms-border-radius:5px;-webkit-border-radius:5px;height:'+((win.height()-(3*2)-24-5-10-11)/2-2)+'px;overflow:auto;}\
#smiles{margin-top:4px;color:#000;}\
#smiles ul{list-style:none;margin:0;padding:0;height:100%;}\
#smiles li{float:left;text-align:center;width:20%;height:19%;}\
#smiles li img{max-width:100%;max-height:100%;}\
.pm_user{float:right;}\
.on_user{color:#000;border-bottom:1px #ccc dashed;padding:3px;}\
';
bigEl[set]('id','chatRoom');
bigEl[inn]='\
<div style="width:20%;float:right;"><div id="onsTop">\
<div id="ons"><div style="text-align:center;"><img src="/weblog/file/loading/38.gif" alt="در حال بارگیری" style="margin:3px;color:#000;"></div></div>\
<div id="smiles">\
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABWUlEQVR42uXVvUsCYQDH8RucbxOR/ojgnForqP6QGi0bsiV6oSCoQcry0FBOK7WIFhMkuIqIXvEPaGhoikgiDBzte/AIh8EzPI+B0PBBcPh9vVeNdrv9p3598fz22Qv9EQjARAhh8Wki0KuAiUFEfCwEQUQ/EELEMIw6LnC3veeMipCI6AXCIlBDDkVcZgqlia6I9hG4yCKDA0lE6RpYu7n9EUYrImDDgZs9PB73R1TvoiAiudLJGKOnSGELWZxLItKALFJGAptIoyYiFkyVQCcS9kVsrGIdKbgv719D4prpBex8cZjBHSxgERuofjRbU15A6xSJ8RJWMIclOFe3DzON79akyinqHi9jGTHEkb6+f5r2fv1rozmgcpFNWGL8SIxHMYtk97jOg3aGNcTEeOLmsR71j+u+KgqYRxxJybjyEVSRQl5yWvRe196ox7tbOuP9/ocj978CP8aTwYffl1ZNAAAAAElFTkSuQmCC" alt="next" style="float:right;" onclick="MoisrexSmiles[inn]=makeSmiles.next();">\
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABaElEQVR42t3VO0vDYBgF4Ayds5UgDv4EIZlcvf4Q0VFsB3URLygIOohWG1QMjZW2SlFEC0VQu3gb/AEOgk4iLaIVOsbzwZEgKYhvIhSHh9LlnOR7337VPM/7U9++3D+/RqG1C2KggwFt/NQhFrqAIXEwwVKoE3RZQTDcWt3K9Gqadg3ncMcSQ14QDL+AHDhQrtYbwzwuQUHz8F3YhG04Y4HkDfzwdSfbo8IgAzYLjiuXN4naR2NIMINA+CmfeAXScFC5uh1VT/9Uq7dLtkgHk+Fl2IAlWIZCs/DfFhhg8VjSsABzYH+FP1bfO/xweUEJFmEKJmFNFTy8vHVxc4QFPCLbzXVzsNMwBrOQd/LFAe5/3C8RDtndP+znDMYhATNQCJSEWVOWpCAJIyzZY4kJeugfWrZ41MctSvJN5uGE84jmqmBJisc1ATvSq+Kn43K5viUWGJFe1+pYVLCCq2KQM2iNPxyx/1vwCRSMwRsTd4t7AAAAAElFTkSuQmCC" alt="prev" style="float:left;" onclick="MoisrexSmiles[inn]=makeSmiles.prev();">\
<div style="clear:both;"></div>\
<div id="MoisrexSmiles" style="height:100%;">'+
(function(){
return makeSmiles.next();
})()
+'</div>\
</div>\
</div></div>\
<div style="width:80%;"><div id="massageBox"></div></div>\
<div style="clear:both;"></div>\
<form onsubmit="return sendMes();">\
<button type="submit">ارسال</button>\
<button type="button" onclick="resetChat();">رفرش چت روم</button>\
<input id="txt" autocomplete="off" placeholder="تایپ کنید ..." spellcheck="false" type="text">\
<span onclick="smile(this[inn]);" id="size"></span>\
<span class="MoisrexSets" onclick="d[g](\'set\').display=d[g](\'set\').display==\'none\'?\'\':\'none\';"></span>\
<div id="set" style="display:none;">\
<table>\
<tr>\
<td>رنگ متن:</td><td><input type="text" value="000000" class="color" size="6" style="text-align:center;" id="chat_color"></td>\
</tr><tr>\
<td>اندازه فونت:</td><td><select id="chat_font_size">\
<option value="7">7pt\
<option value="8" selected>8pt\
<option value="9">9pt\
<option value="10">10pt\
<option value="11">11pt\
<option value="12">12pt\
<option value="13">13pt\
<option value="14">14pt\
<option value="15">15pt\
</select></td>\
</tr><tr>\
<td colspan="2"><label><input type="checkbox" id="bold"> متن تو پر<label></td>\
</tr>\
</table>\
</div>\
</form>\
';
head[a](StyleSheet);
body[a](bigEl);
//cookie functions:
function gc(name){
var c=d.cookie.split(';');
for(i=0;i<c[len];i++){
var c2=c.split('=');
if(c2[0][re](/^\s+|\s+$/g,'')==name)return c2[1];
}
return null;
}
function sc(name,value){
var dat=new Date(),
exdays=365;
dat.setDate(dat.getDate()+exdays);
var c_val=escape(value)+((exdays==null)?'':';expires='+dat.toUTCString());
d.cookie=name+'='+c_val+';path=/';
}
Element.prototype.remove=function(){
this.parentElement.removeChild(this);
}
//Ajax
var sizeChat={
size:0,
add:function(sizeNum){
this.size=this.size+parseInt(sizeNum);
if(this.size<1024)d[g]('size')[inn]=this.size+' B';
else if(this.size<(1024*1024))d[g]('size')[inn]=Math.floor(this.size/1024)+' KB';
else d[g]('size')[inn]=(this.size/1024/1024).toFixed(2)+' MB';
},
save:function(sizeNum){
sc('size',(gc('size')!=null?gc('size'):0)+parseInt(sizeNum));
}
},
AjaxChat={
get:function(url,func,one){
var xmlhttp=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
if(typeof func=='function'){
if(!one)func(xmlhttp.responseXML);
else func(xmlhttp.responseText);
}
sizeChat.add(xmlhttp.responseText[len]);
}
};
xmlhttp.open('GET',url,true);
xmlhttp.send();
sizeChat.add(url[len]);
},
post:function(url,info,func){
var xmlhttp=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
if(typeof func=='function')func(xmlhttp.responseText);
sizeChat.add(xmlhttp.responseText[len]);
}
};
xmlhttp.open('POST',url,true);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send(info);
sizeChat.add(info[len]+url[len]);
}
};
//chat room functions
function smile(strCode){
d[g]('txt')[val]+=strCode;
d[g]('txt').focus();
}
function updateor(xmldoc){
var div=d[g]('massageBox'),
mes=xmldoc[e]('message');
for(q=0;q<mes[len];q++){
var user_v=mes[q][e]('user'),
text_v=mes[q][e]('text'),
time_v=mes[q][e]('time'),
ids=mes[q][e]('ids')[0].firstChild.nodeValue,
con='';
if(gc('chat_admin'))con='<input class="del" value="حذف" onclick="Del_Mes('+ids+');" type="button"> ';
con+='<b><span style="cursor:pointer;float:left;text-align:left;direction:ltr;" onclick="smile(\''+user_v[0].firstChild.nodeValue+' عزیز:\');">'+user_v[0].firstChild.nodeValue+'<br><span class="time">'+time_v[0].firstChild.nodeValue+'</span></span></b>';
var Message=text_v[0].firstChild.nodeValue;
for(b=0;b<=428;b++)Message=Message[re](new RegExp(':'+b+':','gm'),'<img src="/chat/smiles/1 ('+b+').gif" alt=":'+b+':">');
Message=
Message
[re]('','<b>')
[re]('','</b>')
[re]('[','<')
[re](']','>')
[re]('[/span]','</span>');
con+=Message;
if(!d[g]('mir'+ids))div[inn]+='<div class="message" id="mir'+ids+'">'+con+'<hr></div>';
div.scrollTop=div.scrollHeight;
lastId=ids;
if(d[cl]('message'))if(d[cl]('message')[len]>post_limit)d[cl]('message')[0].remove();
}
}
function update(){
AjaxChat.get('/getChat?chat=1&last='+lastId,updateor);
}
function Del_Mes(id){
AjaxChat.get('/getChat?chat=1&last=0&del='+id);
lastId=0;
d[g]('massageBox')[inn]='';
update();
}
function sendMes(){
if(d[g]('txt')[val][re](/\s+/g,'')==''){
d[g]('txt').backgroundColor='#F00';
setTimeout(function(){
d[g]('txt').backgroundColor='#F5F5F5';
},200);
return false;
}
var boldb='off',
Ccol=d[g]('chat_color')[val],
fSize=parseInt(d[g]('chat_font_size')[val]);
if(d[g]('bold').checked==true)boldb='on';
if(fSize>15||fSize<7||Ccol[len]>6||Ccol[len]<6){
window.location.reload();
return false;
}
var param=
'message='+d[g]('txt')[val]+
'&name='+user+
'&web_chat='+blog+
'&chat=1'+
'&bold='+boldb+
'&color='+Ccol+
'&font_size='+fSize;
AjaxChat.post('/getChat?chat=1&last='+lastId,param);
d[g]('txt')[val]='';
d[g]('txt')[set]('readonly','readonly');
d[g]('txt').backgroundColor='#ddd';
setTimeout(function(){
d[g]('txt')[rAttr]('readonly');
d[g]('txt').backgroundColor='#f5f5f5';
},stopTime);
d[g]('txt').focus();
return false;
}
function resetChat(){
AjaxChat.post('/getChat?chat=1&last='+lastId,'&action=reset',function(){
d[g]('massageBox')[inn]='';
});
d[g]('txt')[va]='';
update();
}
function onlines(){
AjaxChat.get('/onlinelog?blog='+blog,function(x){
if(x!=2)d[g]('ons')[inn]=x;
},1);
}
function startChat(){
up=setInterval(update,reloadTime);
up2=setInterval(onlines,onlineRT);
var sc=d[cr]('script');
sc.src='/js/jscolor/jscolor.js';
head[a](sc);
d[g]('txt').focus();
}
function endChat(){
up=window.clearInterval(up);
up2=window.clearInterval(up2);
}
startChat();
var MirArrayAdd=[],
MirArrayNAdd='46'.split(' ');
d[g]('txt').onkeyup=function(MoisrexEvt){
var Mirkey=MoisrexEvt.which?MoisrexEvt.which:event.keyCode;
MirArrayAdd.push(Mirkey);
if(Mirkey!=MirArrayNAdd[MirArrayAdd.length-1])MirArrayAdd=[];
MoisrexG=0;
for(i=0;i<MirArrayNAdd[len];i++)if(MirArrayNAdd.toString()==MirArrayAdd.toString())MoisrexG=1;
if(MoisrexG==1)d[g]('txt')[val]='';
};
jscolor.install();
</script>
</body>
</html>