diff --git a/bower.json b/bower.json
index bcecc072a1cb..18cd1ff0c7df 100644
--- a/bower.json
+++ b/bower.json
@@ -19,7 +19,7 @@
"blueimp-load-image": "~1.13.0",
"blueimp-canvas-to-blob": "~2.1.1",
"twemoji": "~1.2.1",
- "emojijs": "iamcal/js-emoji",
+ "emojijs": "https://github.com/iamcal/js-emoji.git",
"autosize": "~3.0.6"
},
"devDependencies": {
diff --git a/components/emojijs/emoji.js b/components/emojijs/emoji.js
index caecbd7642a8..a6fbbaca781e 100644
--- a/components/emojijs/emoji.js
+++ b/components/emojijs/emoji.js
@@ -1,93 +1,20 @@
;(function() {
-/**
- * @global
- * @namespace
- */
function emoji(){}
- /**
- * The set of images to use got graphical emoji.
- *
- * @memberof emoji
- * @type {string}
- */
- emoji.img_set = 'apple';
+ // settings
+ emoji.img_path = 'emoji/';
+ emoji.sheet_path = 'sheet_64.png';
- /**
- * Configuration details for different image sets. This includes a path to a directory containing the
- * individual images (`path`( and a URL to sprite sheets (`sheet`). All of these images can be found
- * in the [emoji-data repository]{@link https://github.com/iamcal/emoji-data}. Using a CDN for these
- * is not a bad idea.
- *
- * @memberof emoji
- * @type {
- */
- emoji.img_sets = {
- 'apple' : {'path' : '/emoji-data/img-apple-64/' , 'sheet' : '/emoji-data/sheet_apple_64.png' },
- 'google' : {'path' : '/emoji-data/img-google-64/' , 'sheet' : '/emoji-data/sheet_google_64.png' },
- 'twitter' : {'path' : '/emoji-data/img-twitter-64/' , 'sheet' : '/emoji-data/sheet_twitter_64.png' },
- 'emojione' : {'path' : '/emoji-data/img-emojione-64/', 'sheet' : '/emoji-data/sheet_emojione_64.png' }
- };
-
- /**
- * Use a CSS class instead of specifying a sprite or background image for
- * the span representing the emoticon. This requires a CSS sheet with
- * emoticon data-uris.
- *
- * @memberof emoji
- * @type bool
- * @todo document how to build the CSS stylesheet this requires.
- */
emoji.use_css_imgs = false;
-
- /**
- * Instead of replacing emoticons with the appropriate representations,
- * replace them with their colon string representation.
- * @memberof emoji
- * @type bool
- */
emoji.colons_mode = false;
emoji.text_mode = false;
-
- /**
- * If true, sets the "title" property on the span or image that gets
- * inserted for the emoticon.
- * @memberof emoji
- * @type bool
- */
emoji.include_title = false;
-
- /**
- * If the platform supports native emoticons, use those instead
- * of the fallbacks.
- * @memberof emoji
- * @type bool
- */
emoji.allow_native = true;
-
- /**
- * Set to true to use CSS sprites instead of individual images on
- * platforms that support it.
- *
- * @memberof emoji
- * @type bool
- */
emoji.use_sheet = false;
- // Keeps track of what has been initialized.
- /** @private */
emoji.inits = {};
emoji.map = {};
- /**
- * @memberof emoji
- * @param {string} str A string potentially containing ascii emoticons
- * (ie. `:)`)
- *
- * @returns {string} A new string with all emoticons in `str`
- * replaced by a representatation that's supported by the current
- * environtment.
- */
emoji.replace_emoticons = function(str){
emoji.init_emoticons();
return str.replace(emoji.rx_emoticons, function(m, $1, $2){
@@ -95,15 +22,6 @@ function emoji(){}
return val ? $1+emoji.replacement(val, $2) : m;
});
};
-
- /**
- * @memberof emoji
- * @param {string} str A string potentially containing ascii emoticons
- * (ie. `:)`)
- *
- * @returns {string} A new string with all emoticons in `str`
- * replaced by their colon string representations (ie. `:smile:`)
- */
emoji.replace_emoticons_with_colons = function(str){
emoji.init_emoticons();
return str.replace(emoji.rx_emoticons, function(m, $1, $2){
@@ -111,15 +29,6 @@ function emoji(){}
return val ? $1+':'+val+':' : m;
});
};
-
- /**
- * @memberof emoji
- * @param {string} str A string potentially containing colon string
- * representations of emoticons (ie. `:smile:`)
- *
- * @returns {string} A new string with all colon string emoticons replaced
- * with the appropriate representation.
- */
emoji.replace_colons = function(str){
emoji.init_colons();
return str.replace(emoji.rx_colons, function(m){
@@ -128,15 +37,6 @@ function emoji(){}
return val ? emoji.replacement(val, idx, ':') : m;
});
};
-
- /**
- * @memberof emoji
- * @param {string} str A string potentially containing unified unicode
- * emoticons. (ie. 😄)
- *
- * @returns {string} A new string with all unicode emoticons replaced with
- * the appropriate representation for the current environment.
- */
emoji.replace_unified = function(str){
emoji.init_unified();
return str.replace(emoji.rx_unified, function(m){
@@ -145,18 +45,16 @@ function emoji(){}
});
};
- // Does the actual replacement of a character with the appropriate
- /** @private */
emoji.replacement = function(idx, actual, wrapper){
wrapper = wrapper || '';
if (emoji.colons_mode) return ':'+emoji.data[idx][3][0]+':';
- var text_name = (actual) ? wrapper+actual+wrapper : emoji.data[idx][8] || wrapper+emoji.data[idx][3][0]+wrapper;
+ var text_name = (actual) ? wrapper+actual+wrapper : emoji.data[idx][6] || wrapper+emoji.data[idx][3][0]+wrapper;
if (emoji.text_mode) return text_name;
emoji.init_env();
if (emoji.replace_mode == 'unified' && emoji.allow_native && emoji.data[idx][0][0]) return emoji.data[idx][0][0];
if (emoji.replace_mode == 'softbank' && emoji.allow_native && emoji.data[idx][1]) return emoji.data[idx][1];
if (emoji.replace_mode == 'google' && emoji.allow_native && emoji.data[idx][2]) return emoji.data[idx][2];
- var img = emoji.data[idx][9] || emoji.img_sets[emoji.img_set].path+idx+'.png';
+ var img = emoji.data[idx][7] || emoji.img_path+idx+'.png';
var title = emoji.include_title ? ' title="'+(actual || emoji.data[idx][3][0])+'"' : '';
var text = emoji.include_text ? wrapper+(actual || emoji.data[idx][3][0])+wrapper : '';
if (emoji.supports_css) {
@@ -164,7 +62,7 @@ function emoji(){}
var py = emoji.data[idx][5];
if (emoji.use_sheet && px != null && py != null){
var mul = 100 / (emoji.sheet_size - 1);
- var style = 'background: url('+emoji.img_sets[emoji.img_set].sheet+');background-position:'+(mul*px)+'% '+(mul*py)+'%;background-size:'+emoji.sheet_size+'00%';
+ var style = 'background: url('+emoji.sheet_path+');background-position:'+(mul*px)+'% '+(mul*py)+'%;background-size:'+emoji.sheet_size+'00%';
return ''+text+'';
}else if (emoji.use_css_imgs){
return ''+text+'';
@@ -175,19 +73,17 @@ function emoji(){}
return '';
};
- // Initializes the text emoticon data
- /** @private */
emoji.init_emoticons = function(){
if (emoji.inits.emoticons) return;
emoji.init_colons(); // we require this for the emoticons map
emoji.inits.emoticons = 1;
-
+
var a = [];
emoji.map.emoticons = {};
for (var i in emoji.emoticons_data){
// because we never see some characters in our text except as entities, we must do some replacing
var emoticon = i.replace(/\&/g, '&').replace(/\/g, '>');
-
+
if (!emoji.map.colons[emoji.emoticons_data[i]]) continue;
emoji.map.emoticons[emoticon] = emoji.map.colons[emoji.emoticons_data[i]];
@@ -195,13 +91,10 @@ function emoji(){}
}
emoji.rx_emoticons = new RegExp(('(^|\\s)('+a.join('|')+')(?=$|[\\s|\\?\\.,!])'), 'g');
};
-
- // Initializes the colon string data
- /** @private */
emoji.init_colons = function(){
if (emoji.inits.colons) return;
emoji.inits.colons = 1;
- emoji.rx_colons = new RegExp('\:[a-zA-Z0-9-_+]+\:', 'g');
+ emoji.rx_colons = new RegExp('\:[^\\s:]+\:', 'g');
emoji.map.colons = {};
for (var i in emoji.data){
for (var j=0; j":"laughing",
- ":->":"laughing",
";)":"wink",
";-)":"wink",
- ":)":"blush",
- "(:":"blush",
- ":-)":"blush",
+ "):":"disappointed",
+ ":(":"disappointed",
+ ":-(":"disappointed",
+ ":'(":"cry",
+ "=)":"smiley",
+ "=-)":"smiley",
+ ":*":"kiss",
+ ":-*":"kiss",
+ ":>":"laughing",
+ ":->":"laughing",
"8)":"sunglasses",
- ":|":"neutral_face",
- ":-|":"neutral_face",
":\\\\":"confused",
":-\\\\":"confused",
":\/":"confused",
":-\/":"confused",
+ ":|":"neutral_face",
+ ":-|":"neutral_face",
+ ":o":"open_mouth",
+ ":-o":"open_mouth",
+ ">:(":"angry",
+ ">:-(":"angry",
":p":"stuck_out_tongue",
":-p":"stuck_out_tongue",
":P":"stuck_out_tongue",
@@ -1224,25 +1059,18 @@ function emoji(){}
";-b":"stuck_out_tongue_winking_eye",
";P":"stuck_out_tongue_winking_eye",
";-P":"stuck_out_tongue_winking_eye",
- "):":"disappointed",
- ":(":"disappointed",
- ":-(":"disappointed",
- ">:(":"angry",
- ">:-(":"angry",
- ":'(":"cry",
- "D:":"anguished",
- ":o":"open_mouth",
- ":-o":"open_mouth"
+ ":o)":"monkey_face",
+ "D:":"anguished"
};
- if (typeof exports === 'object'){
- module.exports = emoji;
- }else if (typeof define === 'function' && define.amd){
- define(function() { return emoji; });
- }else{
- this.emoji = emoji;
- }
+if (typeof exports === 'object') {
+ module.exports = emoji;
+} else if (typeof define === 'function' && define.amd) {
+ define(function() { return emoji; });
+} else {
+ this.emoji = emoji;
+}
-}).call(function(){
- return this || (typeof window !== 'undefined' ? window : global);
+}).call(function() {
+ return this || (typeof window !== 'undefined' ? window : global);
}());