!function(){var t=null;UM.registerWidget("emotion",{tpl:'<link type="text/css" rel="stylesheet" href="<%=emotion_url%>emotion.css"><div class="edui-emotion-tab-Jpanel edui-emotion-wrapper"><ul class="edui-emotion-Jtabnav edui-tab-nav"><li class="edui-tab-item"><a data-context=".edui-emotion-Jtab0" hideFocus="true" class="edui-tab-text">表情</a></li></ul><div class="edui-tab-content edui-emotion-JtabBodys"><div class="edui-emotion-Jtab0 edui-tab-pane"></div></div><div class="edui-emotion-JtabIconReview edui-emotion-preview-box"><img src="<%=cover_img%>" class=\'edui-emotion-JfaceReview edui-emotion-preview-img\'/></div>',sourceData:{emotion:{tabNum:7,SmilmgName:{"edui-emotion-Jtab0":["i_f",50]},imageFolders:{"edui-emotion-Jtab0":"face/"},imageCss:{"edui-emotion-Jtab0":"pp"},imageCssOffset:{"edui-emotion-Jtab0":25},SmileyInfor:{"edui-emotion-Jtab0":["微笑","亲吻","调皮","惊讶","耍酷","发火","害羞","汗水","大哭","得意","鄙视","困","夸奖","晕倒","疑问","媒婆","狂吐","青蛙","发愁","亲吻","","爱心","心碎","玫瑰","礼物","哭","奸笑","可爱","得意","呲牙","暴汗","楚楚可怜","困","哭","生气","惊讶","口水","彩虹","夜空","太阳","钱钱","灯泡","咖啡","蛋糕","音乐","爱","胜利","赞","鄙视","OK"]}}},initContent:function(e,i){var o=this,a=o.sourceData.emotion,n=e.getLang("emotion")["static"],r=UMEDITOR_CONFIG.UMEDITOR_HOME_URL+"dialogs/emotion/",s=$.extend({},n,{emotion_url:r}),u=o.root();return o.inited?(o.preventDefault(),void this.switchToFirst()):(o.inited=!0,t=e,this.widget=i,a.SmileyPath=e.options.emotionLocalization===!0?r+"images/":"http://img.baidu.com/hi/",a.SmileyBox=o.createTabList(a.tabNum),a.tabExist=o.createArr(a.tabNum),s.cover_img=a.SmileyPath+(t.options.emotionLocalization?"0.gif":"default/0.gif"),u.html($.parseTmpl(o.tpl,s)),o.tabs=$.eduitab({selector:".edui-emotion-tab-Jpanel"}),o.previewBox=u.find(".edui-emotion-JtabIconReview"),o.previewImg=u.find(".edui-emotion-JfaceReview"),void o.initImgName())},initEvent:function(){var t=this;t.root().on("click",function(){return!1}),t.root().delegate("td","mouseover mouseout",function(e){var i=$(this),o=i.attr("data-surl")||null;return o&&t[e.type](this,o,i.attr("data-posflag")),!1}),t.root().delegate("td","click",function(e){var i=$(this),o=i.attr("data-realurl")||null;return o&&t.insertSmiley(o.replace(/'/g,"\\'"),e),!1}),t.tabs.edui().on("beforeshow",function(e){var i=$(e.target).attr("data-context").replace(/^.*\.(?=[^\s]*$)/,"");e.stopPropagation(),t.updateTab(i)}),this.switchToFirst()},initImgName:function(){var t=this.sourceData.emotion;for(var e in t.SmilmgName){var i=t.SmilmgName[e],o=t.SmileyBox[e],a="";if(o.length)return;for(var n=1;n<=i[1];n++)a=i[0],10>n&&(a+="0"),a=a+n+".gif",o.push(a)}},switchToFirst:function(){this.root().find(".edui-emotion-Jtabnav .edui-tab-text:first").trigger("click")},updateTab:function(t){var e=this,i=e.sourceData.emotion;e.autoHeight(t),i.tabExist[t]||(i.tabExist[t]=!0,e.createTab(t))},autoHeight:function(){this.widget.height(this.root()+2)},createTabList:function(t){for(var e={},i=0;t>i;i++)e["edui-emotion-Jtab"+i]=[];return e},mouseover:function(t,e,i){i-=0,$(t).css("backgroundColor","#fff9ec"),this.previewImg.css("backgroundImage","url("+e+")"),i&&this.previewBox.addClass("edui-emotion-preview-left"),this.previewBox.show()},mouseout:function(t){$(t).css("backgroundColor","transparent"),this.previewBox.removeClass("edui-emotion-preview-left").hide()},insertSmiley:function(e,i){var o={src:e};o._src=o.src,t.execCommand("insertimage",o),i.ctrlKey||(this.previewBox.removeClass("edui-emotion-preview-left").hide(),this.widget.edui().hide())},createTab:function(e){for(var i,o,a,n,r,s,u="?v=1.1",m=this,d=this.root().find("."+e),l=m.sourceData.emotion,c=l.SmileyPath+l.imageFolders[e],h=5.5,g=iHeight=35,f=l.imageCss[e],p=l.imageCssOffset[e],v=['<table border="1" class="edui-emotion-smileytable">'],b=0,w=l.SmileyBox[e].length,x=10;w>b;){v.push("<tr>");for(var y=0;x>y;y++,b++)i=l.SmileyBox[e][b],i?(o=c+i+u,a=c+i,n=h>y?0:1,r=p*b*-1-1,s=l.SmileyInfor[e][b],v.push('<td  class="edui-emotion-'+f+'" data-surl="'+o+'" data-realurl="'+a+'" data-posflag="'+n+'" align="center">'),v.push("<span>"),v.push('<img  style="background-position:left '+r+'px;" title="'+s+'" src="'+l.SmileyPath+(t.options.emotionLocalization?'0.gif" width="':'default/0.gif" width="')+g+'" height="'+iHeight+'"></img>'),v.push("</span>")):v.push('<td bgcolor="#FFFFFF">'),v.push("</td>");v.push("</tr>")}v.push("</table>"),v=v.join(""),d.html(v)},createArr:function(t){for(var e=[],i=0;t>i;i++)e[i]=0;return e},width:315,height:120})}();