").appendTo(this.$menu);i.append(this.$menu);i.on("keydown",function(e){if(e.keyCode===o||e.keyCode===u){r.hide()}});i.on("mouseup",function(){r.hide()});s.on("resize",function(){if(r.visible)r.reposition()});this.$menu.on("mouseup","a",function(e){e.stopPropagation();return false});this.$menu.on("click","a",function(n){var i=e(".label",e(this)).text();var s=e(".label",e(this)).parent().parent().attr("group");if(s&&i!==""){t.setTimeout(function(){r.onItemSelected.apply(r,[s,i])},0);n.stopPropagation();return false}});this.load()};h.prototype.onItemSelected=function(e,t){this.emojiarea.insert(e,t);this.hide()};h.prototype.load=function(){var t=[];var n=[];var r=e.emojiarea.icons;var i=e.emojiarea.path;if(i.length&&i.charAt(i.length-1)!=="/"){i+="/"}n.push('
");this.$items.html(t.join(""));this.$menu.prepend(n.join(""));this.$menu.find(".tab_switch").each(function(t){if(t!=0){var n=e(this).attr("href");e(n).hide()}else{e(this).addClass("active")}e(this).click(function(){e(this).addClass("active");e(this).siblings().removeClass("active");e(".select_group").hide();var t=e(this).attr("href");e(t).show()})})};h.prototype.reposition=function(){var e=this.emojiarea.$button;var t=e.offset();t.top+=e.outerHeight();t.left+=Math.round(e.outerWidth()/2);this.$menu.css({top:t.top,left:t.left})};h.prototype.hide=function(e){if(this.emojiarea){this.emojiarea.menu=null;this.emojiarea.$button.removeClass("on");this.emojiarea=null}this.visible=false;this.$menu.hide()};h.prototype.show=function(e){if(this.emojiarea&&this.emojiarea===e)return;this.emojiarea=e;this.emojiarea.menu=this;this.reposition();this.$menu.show();this.visible=true};h.show=function(){var e=null;return function(t){e=e||new h;e.show(t)}}()})(jQuery,window,document);