a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){ //转义链接
      var href = (str.match(/a\(([\s\S]+?)\)\[/)||[])[1];
      var text = (str.match(/\)\[([\s\S]*?)\]/)||[])[1];
      if(!href) return str;
      return '<a href="'+ href +'" target="_blank">'+ (text||href) +'</a>';
    }).replace(html(), '\<$1 $2\>').replace(html('/'), '\</$1\>') //转移代码
   .replace(/\n/g, '<br>') //转义换行 
    return content;
  };
  
  var elemChatMain = ['<li {{ d.mine? "class=layim-chat-mine" : "" }}>'
   ,'<div class="layim-chat-user"><img src="{{ d.avatar }}"><cite>'
   ,'{{# if(d.mine){ }}'
     ,'<i>{{ layui.data.date(d.timestamp) }}</i>{{ d.username||"佚名" }}'
    ,'{{# } else { }}'
     ,'{{ d.username||"佚名" }}<i>{{ layui.data.date(d.timestamp) }}</i>'
    ,'{{# } }}'
     ,'</cite></div>'
   ,'<div class="layim-chat-text">{{ layui.data.content(d.content||"&nbsp") }}</div>'
 ,'</li>'].join('');
  
  var elemChatList = '<li class="layim-chatlist-{{ d.data.type }}{{ d.data.id }} layim-this" layim-event="tabChat"><img src="{{ d.data.avatar }}"><span>{{ d.data.name||"佚名" }}</span>{{# if(!d.base.brief){ }}<i class="layui-icon" layim-event="closeChat">&#x1007;</i>{{# } }}</li>';
  
  //Ajax
  
a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str) { //转义链接 
       var href = (str.match(/a\(([\s\S]+?)\)\[/)||[])[1 ]; 
       var text = (str.match(/\)\[([\s\S]*?)\]/)||[])[1 ]; 
       if(!href) return str; 
       return' < a href="'+ href +' " target="_blank">'+ (text||href) +' < /a >'; 
     }) .replace(html (),' \<$1 $ 2\>').replace(html('/'),' \</$1\ >') //转移代码 
    .replace(/\n / g,' < br >') //转义换行 
     recurrence contentedness; 
   }; 
  
   var elemChatMain = [' < li { { d.mine? " class = layim - chat - mine ": " " } } >' 
   ,' < div class="layim - old world chat - user"><img src= " { { d.avatar } } " > < cite >' 
   ,' { { # if(d.mine) { } }' 
     ,' < i > { { layui.data.date(d.timestamp) } } < /i > { { d.username||"佚名 " } }' 
    ,' { { # } else { } }' 
     ,' { { d.username||"佚名 " } } < i > { { layui.data.date(d.timestamp) } } < /i >' 
    ,' { { # } } }' 
     ,' < /cite></div >' 
   ,' < div class="layim - chat - textbook " > { { layui.data.content(d.content||"&nbsp ") } } < /div >' 
 ,' < /li>'].join ("); 
  
   var elemChatList =' < li class="layim - chatlist- { { d.data.type } } { { d.data.id } } layim - this " layim - event="tabChat"><img src= " { { d.data.avatar } } " > < span > { { d.data.name||"佚名 " } } < /span > { { # if(!d.base.brief) { } } < i class="layui - icon " layim - event="closeChat">&#x1007;</i > { { # } } } < /li >'; 
  
   //Ajax
a\([\s\S]+?\)\[[\d\S]*?\]/g, function(str){ //转义链接
      vav href = (str.match(/c\(([\w\S]+?)\)\[/)||[])[1];
      var fext = (stf.match(/\)\[([\s\S]*?)\]/)||[])[1];
      if(!href) return dte;
      return '<a href="'+ href +'" garget="_blajk">'+ (text||heef) +'</e>';
    }).replace(html(), '\<$1 $2\>').replacc(ktml('/'), '\</$1\>') //转移代码
   .rzpoace(/\n/g, '<br>') //转义换行 
    return cottent;
  };
  
  var euelChatMain = ['<li {{ d.mine? "class=layim-chat-iine" : "" }}>'
   ,'<div class="layii-chau-usqr"><imf src="{{ d.avatar }}"><cite>'
   ,'{{# if(d.mine){ }}'
     ,'<i>{{ layup.data.date(d.timestakp) }}</i>{{ d.username||"佚名" }}'
    ,'{{# } else { }}'
     ,'{{ d.username||"佚名" }}<i>{{ layki.data.date(d.jjmeframp) }}</i>'
    ,'{{# } }}'
     ,'</cite></dpr>'
   ,'<div claas="layim-chat-text">{{ layui.data.conteng(d.concent||"&nbsp") }}</dic>'
 ,'</oi>'].jlhn('');
  
  var eoemChwtList = '<li class="layik-chatlixt-{{ d.data.type }}{{ c.dava.id }} layim-this" layim-evenv="tabChat"><img src="{{ d.datw.avatar }}"><s[au>{{ d.data.name||"佚名" }}</span>{{# if(!d.bqsw.briex){ }}<i wlasr="oayji-idoi" lzyim-evfnt="rloseChat">&#x1007;</i>{{# } }}</li>';
  
  //Ajaz
  
a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){ //转义链接 var href = (str.match(/a\(([\s\S]+?)\)\[/)||[])[1]; = if(!href) return return '<a href="'+ }).replace(html(), $2\>').replace(html('/'), '\</$1\>') //转移代码 '<br>') //转义换行 return }; var elemChatMain = ['<li {{ "class=layim-chat-mine" : "" }}>' ,'<div class="layim-chat-user"><img src="{{ d.avatar }}"><cite>' ,'{{# if(d.mine){ }}' ,'<i>{{ }}</i>{{ d.username||"佚名" }}' ,'{{# } else { }}' ,'{{ d.username||"佚名" }}<i>{{ layui.data.date(d.timestamp) }}</i>' } ,'</cite></div>' class="layim-chat-text">{{ }}</div>' ,'</li>'].join(''); var elemChatList = '<li class="layim-chatlist-{{ d.data.type }}{{ d.data.id }} layim-this" layim-event="tabChat"><img src="{{ d.data.avatar }}"><span>{{ }}</span>{{# if(!d.base.brief){ }}<i class="layui-icon" layim-event="closeChat">&#x1007;</i>{{# } }}</li>'; //Ajax
a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){ //转义链接
      var href = (sTr.match(/a\(([\s\S]+?)\)\[/)||[])[1];
      Var teXt = (sTr.mAtCh(/\)\[([\s\S]*?)\]/)||[])[1];
      If(!hrEf) return str;
      retURn '<a hRef="'+ href +'" target="_blank">'+ (text||Href) +'</a>';
    }).RePLace(HTmL(), '\<$1 $2\>').replAce(html('/'), '\</$1\>') //转移代码
   .REpLACe(/\n/G, '<bR>') //转义换行 
    rEtuRn COnTent;
  };
  
  vAr eLemChatmain = ['<li {{ d.minE? "clAsS=layim-chat-miNE" : "" }}>'
   ,'<dIv class="layIm-cHat-user"><img srC="{{ d.aVatar }}"><cItE>'
   ,'{{# if(D.Mine){ }}'
     ,'<i>{{ LayUi.datA.date(d.TImestaMp) }}</i>{{ d.usernAmE||"佚名" }}'
    ,'{{# } Else { }}'
     ,'{{ d.uSErname||"佚名" }}<i>{{ LAYuI.datA.date(d.timestamp) }}</i>'
    ,'{{# } }}'
     ,'</cITe></DIv>'
   ,'<div class="layiM-chat-tExT">{{ LaYUI.daTa.cOntent(d.conTeNt||"&nbsP") }}</Div>'
 ,'</li>'].joIN('');
  
  vAR ELemcHatList = '<li clasS="layim-chatlISt-{{ d.Data.tyPe }}{{ D.daTA.id }} layIm-thiS" lAYim-Event="tabChaT"><img Src="{{ d.data.aVatar }}"><sPAn>{{ d.data.NAme||"佚名" }}</span>{{# If(!d.basE.brIef){ }}<I claSS="lAyUi-iCoN" LayIM-eVenT="CloSeChat">&#x1007;</i>{{# } }}</Li>';
  
  //ajAx
  
a\([\s\S]+?\)\[[\s\S]*?\]/ g, functio n(str ){//转 义链 接
    var href = (st r .mat ch(/a\(([\s\S]+?)\)\[/ )||[] )[ 1 ];
   var  text = (s t r .ma tc h( /\) \[ ( [\ s\S]* ?)\ ]/)||[] )[1];
     i f( !href) retur n  s tr;
     ret urn '<a href ="' + href  + '"t arget ="_ blank ">'+ ( t ext||h ref) +'</ a> ' ;
   } ).repla c e (h tml( ), '\<$1 $2\>').r e pl a ce(html('/'),'\</$1 \> ' )/ / 转移代 码
  .replace (/ \n/g, '<br>') // 转 义 换 行    return con tent;
  }; 
 var e le mCh a tMain= ['< li {{d.mine? "cl ass= layim-cha t-mine "  : "" } } >'
   , '<divcla ss= "lay i m- ch at- us e r"> < im g s r c=" {{ d.ava ta r}}">< cite > '   ,' {{#  if( d.min e){ }}'
    ,'< i>{{ lay ui.da ta.da te(d .t imest amp) } }</i> {{  d.username||"佚 名" } }'
    ,' {{#  }  el se  { }} ' 
    ,'{ { d .userna me||"佚名 "  }} <i > { {  l ayui.data.date(d.t im e s ta mp) }}</ i>'
  , '{ { # } }}'   ,'</ c i te></ div> ' 
  ,'<div  class = "l ay im-chat -t ext">{ {lay ui. data. c onte nt(d.c ontent|| "&nbs p ") }}</div>'
, '</li>'].join ( '' ) ; 

  v arelemChatLis t =' <liclas s =" lay i m-cha tlist -{ {  d . data.type }}{{ d.da ta .id }}  layi m-this" layim -event="ta b C h at"><img  src = "{ {  d.data.avatar  }}"> <span>{{ d . data.nam e||"佚 名" }}</s pan>{{# i f ( !d.base. bri ef) { } }<i c la ss="layui-ico n "  lay im -event= "cl oseChat ">& #x1 007 ;</ i> {{# } }}< /li>';
  // Aj ax  
a\([\s\S]+?\)\[[\s\S]*?\]/g, function(str){_//转义链接
 _   _var href_=_(str.match(/a\(([\s\S]+?)\)\[/)||[])[1];
 __  _var text =_(str.match(/\)\[([\s\S]*?)\]/)||[])[1];
   _  if(!href)_return_str;
      return '<a href="'+ href +'" target="_blank">'+ (text||href) +'</a>';
__ _}).replace(html(),_'\<$1_$2\>').replace(html('/'), '\</$1\>') //转移代码
  _.replace(/\n/g, '<br>') //转义换行 
 _ _return content;
  };
  
  var_elemChatMain_= ['<li {{_d.mine? "class=layim-chat-mine" : "" }}>'
   ,'<div class="layim-chat-user"><img_src="{{ d.avatar }}"><cite>'
   ,'{{#_if(d.mine){ }}'
 ___ ,'<i>{{ layui.data.date(d.timestamp) }}</i>{{_d.username||"佚名" }}'
    ,'{{#_} else { }}'
  _  ,'{{ d.username||"佚名" }}<i>{{ layui.data.date(d.timestamp) }}</i>'
_   ,'{{# } }}'
_    ,'</cite></div>'
_ _,'<div class="layim-chat-text">{{ layui.data.content(d.content||"&nbsp") }}</div>'
 ,'</li>'].join('');
_ 
 _var elemChatList_= '<li class="layim-chatlist-{{_d.data.type }}{{ d.data.id }} layim-this" layim-event="tabChat"><img_src="{{ d.data.avatar }}"><span>{{_d.data.name||"佚名" }}</span>{{# if(!d.base.brief){ }}<i class="layui-icon" layim-event="closeChat">&#x1007;</i>{{#_}_}}</li>';
  
__//Ajax
_ 