$(document).ready(function() { initEmoji(); }); function initEmoji() { if ($('.p').length) { $('.p').each(function() { emoji($(this), $(this).html()); }) } } function emoji(e, content) { var handle = function() { e.html(twemoji.parse(content)).show(200); }; if (typeof jEmoji != 'object') { $.getScript('//twemoji.maxcdn.com/2/twemoji.min.js?11.4', function() { /* $("head").append(""); var css = $("head").children(":last"); css.attr({ rel: "stylesheet", type: "text/css", href: config.script + '/lib/emoji/emoji.css' }); */ return handle(); }); } else { return handle(); } }