diff --git a/static/js/emoji.js b/static/js/emoji.js index fc194b8730..8cc5cf3a49 100644 --- a/static/js/emoji.js +++ b/static/js/emoji.js @@ -19,18 +19,19 @@ var zulip_emoji = { _.each(emoji_codes.names, function (value) { var base_name = emoji_codes.name_to_codepoint[value]; - default_emojis.push({emoji_name: value, emoji_url: "/static/generated/emoji/images/emoji/unicode/" + base_name + ".png"}); + default_emojis.push({emoji_name: value, + codepoint: emoji_codes.name_to_codepoint[value], + emoji_url: "/static/generated/emoji/images/emoji/unicode/" + base_name + ".png"}); }); _.each(emoji_codes.codepoints, function (value) { - default_unicode_emojis.push({emoji_name: value, emoji_url: "/static/generated/emoji/images/emoji/unicode/" + value + ".png"}); + default_unicode_emojis.push({emoji_name: value, + codepoint: value, + emoji_url: "/static/generated/emoji/images/emoji/unicode/" + value + ".png"}); }); exports.emoji_name_to_css_class = function (emoji_name) { - if (emoji_name.indexOf("+") >= 0) { - return emoji_name.replace("+", ""); - } - return emoji_name; + return emoji_codes.name_to_codepoint[emoji_name]; }; exports.update_emojis = function update_emojis(realm_emojis) { @@ -50,7 +51,7 @@ exports.update_emojis = function update_emojis(realm_emojis) { exports.emojis_by_name = {}; exports.emojis_name_to_css_class = {}; - _.each(exports.emojis, function (emoji) { + _.each(default_emojis, function (emoji) { var css_class = exports.emoji_name_to_css_class(emoji.emoji_name); exports.emojis_name_to_css_class[emoji.emoji_name] = css_class; exports.emojis_by_name[emoji.emoji_name] = emoji.emoji_url; @@ -65,7 +66,7 @@ exports.initialize = function initialize() { // Load the sprite image in the background so that the browser // can cache it for later use. var sprite = new Image(); - sprite.src = '/static/generated/emoji/sprite.png'; + sprite.src = '/static/generated/emoji/sheet_google_32.png'; }; exports.update_emojis(page_params.realm_emoji); diff --git a/static/styles/zulip.css b/static/styles/zulip.css index 6e99bb0804..66b26d22a7 100644 --- a/static/styles/zulip.css +++ b/static/styles/zulip.css @@ -2337,6 +2337,16 @@ button.topic_edit_cancel { margin-top: -7px; } +div.emoji { + /* This is needed when using the sprite sheets */ + top: 6px; +} + +img.emoji { + /* This is the right offset for style emoji */ + top: 3px; +} + .emoji.realm-emoji { background-size: contain; background-position: center; diff --git a/templates/zerver/index.html b/templates/zerver/index.html index 52cadce27d..045ba60432 100644 --- a/templates/zerver/index.html +++ b/templates/zerver/index.html @@ -14,7 +14,7 @@ var page_params = {{ page_params }}; {% block customhead %} - +