KindEditor.plugin('emoticons',function(K){var self=this,name='emoticons',lang=self.lang(name+'.'),path=(self.emoticonsPath||self.pluginsPath+'emoticons/images/'),allowPreview=self.allowPreviewEmoticons===undefined?true:self.allowPreviewEmoticons;var elements=[],tempInfo=[],tempName='',tempTotal=0,tempSize=0,colsHalf=Math.floor(12/2);self.clickToolbar(name,function(){var menu=self.createMenu({name:name,beforeRemove:function(){removeEvent();}});var html=['<div style="padding:10px;">','<div class="tabs"></div>','<div class="tab">','<div class="ke-plugin-emoticons"></div>','</div>','</div>'].join(''),div=menu.div;div.append(html);var wrapperDiv=K('.ke-plugin-emoticons',div),previewDiv,previewImg;if(allowPreview){previewDiv=K('<div class="ke-preview"></div>').css('right',0);previewImg=K('<img class="ke-preview-img" src="'+path+'0.gif" />');wrapperDiv.append(previewDiv);previewDiv.append(previewImg);}var tabs=K.tabs({src:K('.tabs',div),afterSelect:function(i){createEmoticonsUl(i);K('.tab',div).show();}});for(var pro in emoticons.smilmgName){var temp=emoticons.smilmgName[pro];tabs.add({title:self.lang(name+'.'+temp),panel:K('.tab',div)});}tabs.select(0);function bindCellEvent(cell,i){if(previewDiv){cell.mouseover(function(){if(i>colsHalf){previewDiv.css('left',0);previewDiv.css('right','');}else{previewDiv.css('left','');previewDiv.css('right',0);}previewImg.attr('src',path+tempName+'/'+(i+1)+'.gif');K(this).addClass('ke-on');});}else{cell.mouseover(function(){K(this).addClass('ke-on');});}cell.mouseout(function(){K(this).removeClass('ke-on');});cell.click(function(e){self.insertHtml('<img class="ke-icon" src="'+path+tempName+'/'+(i+1)+'.gif" border="0" title="'+tempInfo[i]+'" />').hideMenu().focus();e.stop();});}wrapperDiv.append(K('<ul class="ke-table ke-clearfix"></ul>'));function createEmoticonsUl(num){removeEvent();tempName=emoticons.smilmgName['tab'+num];tempTotal=emoticons.smilmgTotal['tab'+num];tempSize=emoticons.smilmgSize['tab'+num];tempInfo=emoticons.smileyInfo['tab'+num];var ulDiv=K('.ke-table').html('');if(previewDiv){ulDiv.mouseover(function(){previewDiv.show('block');});ulDiv.mouseout(function(){previewDiv.hide();});elements.push(ulDiv);}for(var i=0;i<tempTotal;i++){var cell=K('<li class="ke-cell"></li>');bindCellEvent(cell,i);var span=K('<span class="ke-img" title="'+tempInfo[i]+'"></span>').css('width',tempSize+'px').css('height',tempSize+'px').css('background-position','0px -'+(tempSize*i)+'px').css('background-image','url('+path+tempName+'/'+tempName+'.gif)');cell.append(span);ulDiv.append(cell);elements.push(cell);}return;}createEmoticonsUl(0);function removeEvent(){K.each(elements,function(){this.unbind();});}});var emoticons={smilmgName:{tab0:'jx',tab1:'tsj',tab2:'ldw',tab3:'bobo',tab4:'babycat',tab5:'face',tab6:'youa'},smilmgTotal:{tab0:84,tab1:40,tab2:52,tab3:63,tab4:20,tab5:50,tab6:40},smilmgSize:{tab0:35,tab1:35,tab2:35,tab3:35,tab4:35,tab5:25,tab6:35},smileyInfo:{tab0:['Kiss','Love','Yeah','啊！','背扭','顶','抖胸','88','汗','瞌睡','鲁拉','拍砖','揉脸','生日快乐','大笑','瀑布汗~','惊讶','臭美','傻笑','抛媚眼','发怒','打酱油','俯卧撑','气愤','?','吻','怒','胜利','HI','KISS','不说','不要','扯花','大心','顶','大惊','飞吻','鬼脸','害羞','口水','狂哭','来','发财了','吃西瓜','套牢','害羞','庆祝','我来了','敲打','晕了','胜利','臭美','被打了','贪吃','迎接','酷','微笑','亲吻','调皮','惊恐','耍酷','发火','害羞','汗水','大哭','','加油','困','你NB','晕倒','开心','偷笑','大哭','滴汗','叹气','超赞','??','飞吻','天使','撒花','生气','被砸','吓傻','随意吐'],tab1:['Kiss','Love','Yeah','啊！','背扭','顶','抖胸','88','汗','瞌睡','鲁拉','拍砖','揉脸','生日快乐','摊手','睡觉','瘫坐','无聊','星星闪','旋转','也不行','郁闷','正Music','抓墙','撞墙至死','歪头','戳眼','飘过','互相拍砖','砍死你','扔桌子','少林寺','什么？','转头','我爱牛奶','我踢','摇晃','晕厥','在笼子里','震荡'],tab2:['大笑','瀑布汗~','惊讶','臭美','傻笑','抛媚眼','发怒','我错了','money','气愤','挑逗','吻','怒','胜利','委屈','受伤','说啥呢？','闭嘴','不','逗你玩儿','飞吻','眩晕','魔法','我来了','睡了','我打','闭嘴','打','打晕了','刷牙','爆揍','炸弹','倒立','刮胡子','邪恶的笑','不要不要','爱恋中','放大仔细看','偷窥','超高兴','晕','松口气','我跑','享受','修养','哭','汗','啊~','热烈欢迎','打酱油','俯卧撑','?'],tab3:['HI','KISS','不说','不要','扯花','大心','顶','大惊','飞吻','鬼脸','害羞','口水','狂哭','来','泪眼','流泪','生气','吐舌','喜欢','旋转','再见','抓狂','汗','鄙视','拜','吐血','嘘','打人','蹦跳','变脸','扯肉','吃To','吃花','吹泡泡糖','大变身','飞天舞','回眸','可怜','猛抽','泡泡','苹果','亲','','骚舞','烧香','睡','套娃娃','捅捅','舞倒','西红柿','爱慕','摇','摇摆','杂耍','招财','被殴','被球闷','大惊','理想','欧打','呕吐','碎','吐痰'],tab4:['发财了','吃西瓜','套牢','害羞','庆祝','我来了','敲打','晕了','胜利','臭美','被打了','贪吃','迎接','酷','顶','幸运','爱心','躲','送花','选择'],tab5:['微笑','亲吻','调皮','惊讶','耍酷','发火','害羞','汗水','大哭','得意','鄙视','困','夸奖','晕倒','疑问','媒婆','狂吐','青蛙','发愁','亲吻','','爱心','心碎','玫瑰','礼物','哭','奸笑','可爱','得意','呲牙','暴汗','楚楚可怜','困','哭','生气','惊讶','口水','彩虹','夜空','太阳','钱钱','灯泡','咖啡','蛋糕','音乐','爱','胜利','赞','鄙视','OK'],tab6:['男兜','女兜','开心','乖乖','偷笑','大笑','抽泣','大哭','无奈','滴汗','叹气','狂晕','委屈','超赞','??','疑问','飞吻','天使','撒花','生气','被砸','口水','泪奔','吓傻','吐舌头','点头','随意吐','旋转','困困','鄙视','狂顶','篮球','再见','欢迎光临','恭喜发财','稍等','我在线','恕不议价','库房有货','货在路上']}};});