var im={
minid:999999999,
init:function(){
strformat.emotspath='web/';
this.type = receinfor.type;
this.gid = receinfor.gid;
this.showobj = $('#showview');
this.inputobj = $('#contentss');
$('#btn').click(function(){
im.sendcont();
});
this.loaddata();
this.readinforshow();
im.touchobj = $('#showview').rockdoupull({
downbgcolor:'',
downbool:true,
ondownsuccess:function(){
im.dropdown_success();
}
});
this.resizehei();
$(window).resize(this.resizehei);
},
submitinput:function(){
try{im.sendcont();}catch(e){}
return false;
},
getheight:function(ss){
var hei = 50;if(!ss)ss=0;
if(get('header_title'))hei+=50;
return $(window).height()-hei+ss;
},
resizehei:function(){
var h = im.getheight();
im.showobj.css('height',''+h+'px');
im.touchobj.resize();
},
loaddata:function(o1, iref){
if(this.boolload)return;
var iref = (!iref)?false:true;
var minid= 0;
if(iref)minid=this.minid;
if(o1)$(o1).html('
加载中...');
this.boolload = true;
this.isshangla = false;
js.ajax('reim','getrecord',{type:this.type,gid:this.gid,minid:minid,lastdt:''},function(ret){
if(o1)$(o1).html('');
im.boolload = false;
im.loaddatashow(ret, iref);
},'none', false,false,'get');
},
readinforshow:function(){
setTimeout('im.readinforshows()',1000*10);
},
readinforshows:function(){
var minid=this.minid;
js.ajax('reim','getrecord',{type:this.type,gid:this.gid,minid:0,lastdt:this.lastdt},function(ret){
im.loaddatashow(ret, false, true);
im.readinforshow();
},'none', false,false,'get');
},
loaddatashow:function(ret,isbf, isls){
var a = ret.rows;
this.lastdt = ret.nowdt;
var i,len = a.length,cont,lex,nas,fase,nr,d,na=[],rnd,sid;
$('#loadmored').remove();
if(isbf){
if(len>0)this.showobj.prepend('
'+a[i], num:a[i]});
js.showmenu({
data:da,width:150,align:'left',
onclick:function(d){
im.addinput(d.num);
}
});
},
sendfile:function(){
if(typeof(uploadobj)=='undefined')uploadobj = $.rockupload({
inputfile:'allfileinput',
updir:'reimchat',
urlparams:{noasyn:'yes'}, //不需要同步到文件平台上
initpdbool:true,
onchange:function(d){
im.sendfileshow(d);
},
onprogress:function(f,per,evt){
strformat.upprogresss(per);
},
onsuccess:function(f,str,o1){
im.sendfileok(f,str);
},
onerror:function(str){
js.msg('msg', str);
im.senderror(im.upfilearr.nuid);
}
});
strformat.upobj = uploadobj;
uploadobj.click();
},
sendfileshow:function(f){
f.face = adminface;
var fa = strformat.showupfile(f);
var cont= fa.cont;
this.upfilearr = fa;
this.addcont(cont);
},
sendfileok:function(f,str){
var tm= this.upfilearr,conss='';
var a = js.decode(str);
a.isimg = f.isimg;
strformat.upsuccess(a);
if(f.isimg){
conss = '[图片 '+a.filesizecn+']';
}else{
conss = '['+f.filename+' '+f.filesizecn+']'
}
this.sendconts(jm.base64encode(conss), tm.nuid, tm.optdt, a.id);
},
fileyulan:function(pn,fid){
var url = '?m=public&a=fileviewer&id='+fid+'';
js.location(url);
}
}
strformat.clickfile=function(fid,lx){
js.fileopt(fid,lx);
}