diff --git a/lib/js/emojione.js b/lib/js/emojione.js index 37343b812..693dc06f4 100644 --- a/lib/js/emojione.js +++ b/lib/js/emojione.js @@ -154,6 +154,9 @@ ns.ascii = false; // change to true to convert ascii smileys ns.riskyMatchAscii = false; // set true to match ascii without leading/trailing space char + ns.spriteTemplate = '{{alt}}'; + ns.imageTemplate = '{{alt}}'; + ns.regShortNames = new RegExp("]*>.*?<\/object>|]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|("+ns.shortnames+")", "gi"); ns.regAscii = new RegExp("]*>.*?<\/object>|]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)"+ns.asciiRegexp+"(?=\\s|$|[!,.?]))", "gi"); ns.regAsciiRisky = new RegExp("]*>.*?<\/object>|]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(()"+ns.asciiRegexp+"())", "gi"); @@ -270,12 +273,16 @@ // depending on the settings, we'll either add the native unicode as the alt tag, otherwise the shortname alt = (ns.unicodeAlt) ? ns.convert(unicode.toUpperCase()) : shortname; - if(ns.sprites) { - replaceWith = '' + alt + ''; - } - else { - replaceWith = '' + alt + ''; - } + replaceWith = ns.sprites ? ns.spriteTemplate : ns.imageTemplate; + + replaceWith = + replaceWith + .replace('{{src}}', ePath + fname + ns.fileExtension) + .replace('{{size}}', size) + .replace('{{category}}', category) + .replace('{{code}}', fname) + .replace('{{title}}', title) + .replace('{{alt}}', alt); return replaceWith; } @@ -304,12 +311,16 @@ // depending on the settings, we'll either add the native unicode as the alt tag, otherwise the shortname alt = (ns.unicodeAlt) ? ns.convert(unicode.toUpperCase()) : ns.escapeHTML(m3); - if(ns.sprites) { - replaceWith = m2+'' + alt + ''; - } - else { - replaceWith = m2+''+alt+''; - } + replaceWith = ns.sprites ? ns.spriteTemplate : ns.imageTemplate; + + replaceWith = + m2 + replaceWith + .replace('{{src}}', ePath + unicode + ns.fileExtension) + .replace('{{size}}', size) + .replace('{{category}}', category) + .replace('{{code}}', unicode) + .replace('{{title}}', title) + .replace('{{alt}}', alt); return replaceWith; }); @@ -478,4 +489,4 @@ }; }(this.emojione = this.emojione || {})); -if(typeof module === "object") module.exports = this.emojione; \ No newline at end of file +if(typeof module === "object") module.exports = this.emojione;