ACMS.Dispatch.Edit._emojiedit=function(acms_textarea,item){var callback=function(html){var $target=$(".emoji-edit",item),type=$(':input[name^="text_tag_"]',item).val();$target.selection();if($(".emoji-edit > *",item).length)return false;else $target.append(html);if("wysiwyg"===type)$(".js-tag_insertion",item).hide();$(item).show(0,function(){$('textarea[name^="text_text_"]',this).focus(function(){acms_textarea=this})});$("a.emoji-trigger-tag",$target).click(function(){var txt=$(acms_textarea).selection(),
tag=this.rel;if(txt===void 0)txt="";if("markdown"==$('select[name^="text_tag_"]',$(this).parents(ACMS.Config.Edit.itemMark)).val())switch(tag){case "a":var url=prompt(this.title,"http://");if(url&&url!="http://")$(acms_textarea).selection(["[",txt,"](",url,")"].join(""));break;case "em":$(acms_textarea).selection("*"+txt+"*");break;case "strong":$(acms_textarea).selection("**"+txt+"**");break;case "u":$(acms_textarea).selection("<u>"+txt+"</u>");break;default:}else switch(tag){case "a":var res=prompt(this.title,
"http://");if(res&&res!="http://")$(acms_textarea).selection('<a href="'+res+'">'+txt+"</a>");break;default:$(acms_textarea).selection("<"+tag+">"+txt+"</"+tag+">")}return false});$("a.emoji-trigger-text",$target).click(function(){var select=$(acms_textarea).selection();$(acms_textarea).selection('<span class="'+this.rel+'">'+select+"</span>");return false});$("a.emoji-trigger-emoji",$target).click(function(){var select=$(acms_textarea).selection();$(acms_textarea).selection(this.rel+select);return false});
$target.show()};var self=arguments.callee;if(self.html)callback(self.html);else if(self.stack)self.stack.push(callback);else{self.stack=[callback];var url=ACMS.Library.acmsLink({tpl:"ajax/emoji-edit.html"},true);$.get(url,function(html){self.html=html;while(self.stack.length)self.stack.shift()(html)})}};
