mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
emoji.js: Refactor to make better use of initialize().
This commit is contained in:
@@ -44,6 +44,11 @@ add_dependencies({
|
|||||||
util: 'js/util.js',
|
util: 'js/util.js',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
set_global('Image', function () {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
emoji.initialize();
|
||||||
|
|
||||||
var doc = "";
|
var doc = "";
|
||||||
set_global('document', doc);
|
set_global('document', doc);
|
||||||
|
|
||||||
|
|||||||
@@ -19,19 +19,6 @@ var zulip_emoji = {
|
|||||||
deactivated: false,
|
deactivated: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(emoji_codes.names, function (value) {
|
|
||||||
var base_name = emoji_codes.name_to_codepoint[value];
|
|
||||||
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,
|
|
||||||
codepoint: value,
|
|
||||||
emoji_url: "/static/generated/emoji/images/emoji/unicode/" + value + ".png"});
|
|
||||||
});
|
|
||||||
|
|
||||||
exports.update_emojis = function update_emojis(realm_emojis) {
|
exports.update_emojis = function update_emojis(realm_emojis) {
|
||||||
// exports.all_realm_emojis is emptied before adding the realm-specific emoji to it.
|
// exports.all_realm_emojis is emptied before adding the realm-specific emoji to it.
|
||||||
// This makes sure that in case of deletion, the deleted realm_emojis don't
|
// This makes sure that in case of deletion, the deleted realm_emojis don't
|
||||||
@@ -79,14 +66,28 @@ exports.update_emojis = function update_emojis(realm_emojis) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.initialize = function initialize() {
|
exports.initialize = function initialize() {
|
||||||
|
|
||||||
|
_.each(emoji_codes.names, function (value) {
|
||||||
|
var base_name = emoji_codes.name_to_codepoint[value];
|
||||||
|
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,
|
||||||
|
codepoint: value,
|
||||||
|
emoji_url: "/static/generated/emoji/images/emoji/unicode/" + value + ".png"});
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.update_emojis(page_params.realm_emoji);
|
||||||
|
|
||||||
// Load the sprite image in the background so that the browser
|
// Load the sprite image in the background so that the browser
|
||||||
// can cache it for later use.
|
// can cache it for later use.
|
||||||
var sprite = new Image();
|
var sprite = new Image();
|
||||||
sprite.src = '/static/generated/emoji/sheet_google_32.png';
|
sprite.src = '/static/generated/emoji/sheet_google_32.png';
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.update_emojis(page_params.realm_emoji);
|
|
||||||
|
|
||||||
exports.build_emoji_upload_widget = function () {
|
exports.build_emoji_upload_widget = function () {
|
||||||
|
|
||||||
var get_file_input = function () {
|
var get_file_input = function () {
|
||||||
|
|||||||
@@ -251,7 +251,8 @@ $(function () {
|
|||||||
people.initialize();
|
people.initialize();
|
||||||
bot_data.initialize(); // Must happen after people.initialize()
|
bot_data.initialize(); // Must happen after people.initialize()
|
||||||
message_fetch.initialize();
|
message_fetch.initialize();
|
||||||
markdown.initialize();
|
emoji.initialize();
|
||||||
|
markdown.initialize(); // Must happen after emoji.initialize()
|
||||||
composebox_typeahead.initialize();
|
composebox_typeahead.initialize();
|
||||||
search.initialize();
|
search.initialize();
|
||||||
tutorial.initialize();
|
tutorial.initialize();
|
||||||
@@ -262,7 +263,6 @@ $(function () {
|
|||||||
pointer.initialize();
|
pointer.initialize();
|
||||||
unread_ui.initialize();
|
unread_ui.initialize();
|
||||||
activity.initialize();
|
activity.initialize();
|
||||||
emoji.initialize();
|
|
||||||
emoji_picker.initialize();
|
emoji_picker.initialize();
|
||||||
compose_fade.initialize();
|
compose_fade.initialize();
|
||||||
pm_list.initialize();
|
pm_list.initialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user