(function (factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { module.exports = factory(require('jquery')); } else { factory(window.jQuery); } }(function ($) { $.extend($.summernote.plugins, { 'emoji': function (context) { var self = this; var ui = $.summernote.ui; var emojis = ['1', '2', '3', '4', '5','6']; var chunk = function (val, chunkSize) { var R = []; for (var i = 0; i < val.length; i += chunkSize) R.push(val.slice(i, i + chunkSize)); return R; }; /*IE polyfill*/ if (!Array.prototype.filter) { Array.prototype.filter = function (fun /*, thisp*/) { var len = this.length >>> 0; if (typeof fun != "function") throw new TypeError(); var res = []; var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) { var val = this[i]; if (fun.call(thisp, val, i, this)) res.push(val); } } return res; }; } var addListener = function () { $(document).on('click', '.closeEmoji', function(){ $('#emoji-dropdown').modal('hide'); }); $(document).on('click', '.selectEmoji', function(){ var img = new Image(); img.src = '/plugins/pubs/summernote/plugin/emojis/'+$(this).attr('data-value')+'.png'; img.alt = $(this).attr('data-value'); img.className = 'emoji-icon-inline'; context.invoke('editor.insertNode', img); }); }; var render = function (emojis) { var emoList = ''; /*limit list to 24 images*/ var emojis = emojis; var chunks = chunk(emojis, 6); for (j = 0; j < chunks.length; j++) { emoList += '