zulip/static/js/emoji.js

62 lines
35 KiB
JavaScript
Raw Normal View History

var emoji = (function () {
var exports = {};
exports.emojis = [];
exports.emojis_by_name = {};
exports.emojis_name_to_css_class = {};
exports.emojis_by_unicode = {};
var default_emojis = [];
var default_unicode_emojis = [];
var emoji_names = ["+1", "-1", "100", "1234", "8ball", "a", "a_button", "ab", "ab_button", "abc", "abcd", "accept", "admission_tickets", "aerial_tramway", "airplane", "airplane_arrival", "airplane_departure", "alarm_clock", "alien", "alien_monster", "ambulance", "american_football", "amphora", "anchor", "angel", "anger", "anger_symbol", "angry", "angry_face", "anguished", "anguished_face", "ant", "antenna_bars", "anticlockwise_arrows_button", "apple", "aquarius", "aries", "arrow_backward", "arrow_double_down", "arrow_double_up", "arrow_down", "arrow_down_small", "arrow_forward", "arrow_heading_down", "arrow_heading_up", "arrow_left", "arrow_lower_left", "arrow_lower_right", "arrow_right", "arrow_right_hook", "arrow_up", "arrow_up_down", "arrow_up_small", "arrow_upper_left", "arrow_upper_right", "arrows_clockwise", "arrows_counterclockwise", "art", "articulated_lorry", "artist_palette", "astonished", "astonished_face", "athletic_shoe", "atm", "atm_sign", "atom_symbol", "automobile", "b", "b_button", "baby", "baby_angel", "baby_bottle", "baby_chick", "baby_symbol", "back", "back_arrow", "backhand_index_pointing_down", "backhand_index_pointing_left", "backhand_index_pointing_right", "backhand_index_pointing_up", "badminton", "baggage_claim", "balloon", "ballot_box_with_ballot", "ballot_box_with_check", "bamboo", "banana", "bangbang", "bank", "bar_chart", "barber", "barber_pole", "baseball", "basketball", "bath", "bathtub", "battery", "beach_with_umbrella", "bear", "bear_face", "beating_heart", "bed", "bee", "beer", "beer_mug", "beers", "beetle", "beginner", "bell", "bell_with_slash", "bellhop_bell", "bento", "bento_box", "bicycle", "bicyclist", "bike", "bikini", "billiards", "bird", "birthday", "birthday_cake", "black_circle", "black_joker", "black_large_square", "black_medium_small_square", "black_medium_square", "black_nib", "black_small_square", "black_square_button", "blossom", "blowfish", "blue_book", "blue_car", "blue_circle", "blue_heart", "blush", "boar", "boat", "bomb", "book", "bookmark", "bookmark_tabs", "books", "boom", "boot", "bottle_with_popping_cork", "bouquet", "bow", "bow_and_arrow", "bowling", "boy", "bread", "bride_with_veil", "bridge_at_night", "briefcase", "bright_button", "broken_heart", "bug", "building_construction", "bulb", "bullettrain_front", "bullettrain_side", "burrito", "bus", "bus_stop", "busstop", "bust_in_silhouette", "busts_in_silhouette", "cactus", "cake", "calendar", "calling", "camel", "camera", "camera_with_flash", "camping", "cancer", "candle", "candy", "capital_abcd", "capricorn", "car", "card_file_box", "card_index", "card_index_dividers", "carousel_horse", "carp_streamer", "castle", "cat", "cat2", "cat_face", "cat_face_with_tears_of_joy", "cat_face_with_wry_smile", "cd", "chains", "chart", "chart_decreasing", "chart_increasing", "chart_increasing_with_yen", "chart_with_downwards_trend", "chart_with_upwards_trend", "checkered_flag", "cheese_wedge", "chequered_flag", "cherries", "cherry_blossom", "chestnut", "chicken", "children_crossing", "chipmunk", "chocolate_bar", "christmas_tree", "church", "cinema", "circled_accept_ideograph", "circled_advantage_ideograph", "circled_letter_m", "circus_tent", "city_sunrise", "city_sunset", "cityscape", "cityscape_at_dusk", "cl", "clap", "clapper", "clapper_board", "clapping_hands", "classical_building", "clinking_beer_mugs", "clipboard", "clock1", "clock10", "clock1030", "clock11", "clock1130", "clock12", "clock1230", "clock130", "clock2", "clock230", "clock3", "clock330", "clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8", "clock830", "clock9", "clock930", "clockwise_vertical_arrows", "closed_book", "closed_lock_with_key", "closed_mailbox_with_lowered_flag", "closed_mailbox_with_raised_flag", "closed_umbrella", "cloud", "cloud_with_lightning", "cloud_with_lightning_and_rain", "cloud_with_rain", "cloud_with_snow", "clubs", "cn", "cocktail", "cocktail_glass", "coffee", "coffin", "cold_sweat", "collision", "compression", "computer", "computer_mouse", "confetti_ball", "confounded", "confounded_face", "
var unicode_emoji_names = ["1f198", "1f3ed", "0034", "1f341", "1f3d7", "26f9", "1f32c", "1f314", "1f199", "1f6b2", "267b", "270c", "1f622", "1f4ad", "1f698", "1f618", "1f3a8", "1f3eb", "1f3ae", "1f45f", "1f624", "1f437", "1f6b2", "1f193", "1f69f", "1f564", "1f4a9", "1f335", "1f69d", "1f498", "1f373", "1f195", "262e", "1f33f", "1f63e", "1f499", "1f4af", "1f343", "1f3a2", "1f432", "1f6b8", "1f69a", "2195", "1f5fb", "1f51f", "1f637", "1f4b7", "1f621", "1f250", "1f697", "1f51d", "1f3e5", "1f534", "1f5fa", "1f51a", "1f6e5", "1f1ee", "260e", "1f573", "1f45d", "1f3ee", "1f535", "1f004", "2199", "1f3b2", "1f4cc", "1f21a", "1f42c", "1f303", "25fd", "1f61a", "1f30e", "1f51a", "23ea", "1f355", "1f4bc", "1f63c", "1f6c3", "1f371", "1f497", "1f387", "2728", "261d", "1f337", "1f5e3", "1f691", "2614", "1f3e2", "1f3ac", "1f606", "1f5fe", "1f3e4", "1f635", "1f47f", "1f458", "1f194", "1f3ee", "1f55d", "2615", "1f461", "1f519", "1f62e", "1f4c3", "1f3e6", "1f35e", "1f506", "1f447", "1f694", "2651", "1f356", "1f5fc", "1f55b", "1f3a3", "1f44e", "1f51e", "1f52d", "1f915", "1f577", "1f21a", "1f4f8", "1f360", "1f50f", "1f1f7", "1f62f", "1f6c4", "1f338", "2747", "1f4a6", "1f449", "1f3b7", "1f3a3", "1f3b4", "1f423", "1f193", "1f4a8", "1f684", "1f357", "1f347", "1f63c", "1f36d", "25fe", "1f3e7", "1f4d4", "1f44d", "1f49d", "2702", "1f3b0", "1f3c0", "1f51d", "1f561", "1f6e4", "1f485", "1f38c", "1f606", "271d", "1f690", "1f6bf", "1f3bc", "1f415", "1f50a", "1f54b", "1f3c3", "1f6f3", "270d", "1f400", "1f391", "1f30c", "1f454", "1f63d", "2744", "1f58c", "1f52e", "1f201", "1f444", "2611", "1f55a", "24c2", "1f415", "1f5fe", "1f44e", "1f34d", "1f631", "1f4a3", "1f4e1", "1f4fb", "1f984", "1f237", "1f17f", "1f498", "1f31a", "1f192", "1f35a", "1f42f", "1f576", "1f22f", "1f1e9", "231a", "1f626", "1f349", "1f492", "1f232", "1f49d", "1f52c", "2049", "1f479", "1f473", "262a", "1f309", "1f6ad", "1f528", "1f61b", "1f4ee", "24c2", "1f6be", "2652", "1f629", "1f340", "1f55c", "1f37e", "1f404", "2755", "2b1c", "1f61a", "1f43d", "26f8", "1f643", "1f329", "1f624", "1f37a", "1f3df", "1f6eb", "1f436", "2797", "1f503", "1f344", "23fa", "1f644", "1f41c", "1f605", "1f390", "1f4fd", "2693", "0037", "1f363", "1f5c3", "1f46b", "1f4ab", "25b6", "1f3bb", "1f401", "1f194", "23eb", "1f49f", "1f313", "1f570", "1f6f0", "270b", "1f384", "1f381", "1f494", "1f61d", "1f30a", "2665", "1f614", "26c4", "2b06", "1f4b4", "1f4cf", "1f33e", "1f62a", "1f34f", "1f4c8", "25fb", "1f33b", "1f642", "1f61f", "1f629", "1f607", "1f639", "1f54e", "1f33d", "262f", "1f325", "1f55c", "1f6ec", "1f4c6", "1f381", "1f4ff", "1f61b", "1f50e", "1f4a9", "1f4ed", "1f451", "1f617", "1f496", "2663", "1f46e", "1f646", "1f64e", "1f32b", "1f361", "1f536", "1f197", "261d", "1f33d", "2733", "1f3c6", "1f4b0", "1f55f", "25aa", "2b55", "1f515", "1f35b", "1f62d", "1f312", "1f405", "0032", "1f198", "1f51c", "1f5dc", "2716", "1f3be", "1f493", "1f386", "1f632", "1f4f2", "3297", "1f647", "2754", "2196", "1f619", "23eb", "1f6a9", "1f34e", "1f604", "264a", "1f6a2", "1f4a9", "1f3a5", "1f505", "1f196", "1f332", "1f3c8", "2649", "1f69b", "1f51b", "1f693", "1f50f", "1f633", "2660", "1f636", "1f4fc", "1f377", "1f563", "1f608", "1f3bf", "1f3ec", "1f40a", "1f533", "27b0", "1f6a0", "1f348", "1f623", "1f531", "1f233", "1f6e0", "1f192", "1f506", "1f913", "1f333", "1f4ae", "00ae", "1f52b", "1f68f", "1f500", "1f55e", "2b05", "1f5dd", "1f538", "25ab", "1f52a", "1f5c2", "1f4c1", "1f522", "1f608", "1f3fa", "1f366", "26be", "1f466", "1f64c", "2795", "1f647", "1f688", "1f486", "1f239", "1f6a8", "1f4e4", "1f55e", "1f376", "1f616", "1f620", "1f4f6", "1f38d", "1f319", "1f605", "2648", "1f33e", "1f401", "1f47c", "1f482", "2709", "1f4b8", "1f37b", "1f645", "1f620", "1f399", "1f4a5", "1f697", "1f408", "0033", "1f3bd", "26f4", "2764", "1f4c8", "1f49a", "1f615", "1f475", "264f", "26f5", "1f4ec", "1f418", "1f4d6", "1f625", "1f238", "1f6e3", "1f31e", "1f382", "1f50d", "1f4c5", "1f54a", "1f468", "1f419", "267f", "1f69a", "1f202", "1f6e1", "1f487", "1f561", "2b07", "1f31c", "1f3f5", "1f4b1", "1f4ed", "1f5de", "23f3", "1f6c0", "1f42d", "1f564", "1f3b3", "1f422", "
emoji_names.push("zulip");
_.each(emoji_names, function (value) {
default_emojis.push({emoji_name: value, emoji_url: "/static/generated/emoji/images/emoji/" + value + ".png"});
});
_.each(unicode_emoji_names, function (value) {
default_unicode_emojis.push({emoji_name: value, emoji_url: "/static/generated/emoji/images/emoji/unicode/" + value + ".png"});
});
exports.update_emojis = function update_emojis(realm_emojis) {
// Copy the default emoji list and add realm-specific emoji to it
exports.emojis = default_emojis.slice(0);
_.each(realm_emojis, function (data, name) {
exports.emojis.push({emoji_name:name, emoji_url: data.display_url});
});
exports.emojis_by_name = {};
exports.emojis_name_to_css_class = {};
_.each(exports.emojis, function (emoji) {
exports.emojis_by_name[emoji.emoji_name] = emoji.emoji_url;
exports.emojis_name_to_css_class[emoji.emoji_name] = emoji.emoji_name;
if (emoji.emoji_name.indexOf("+") >= 0) {
exports.emojis_name_to_css_class[emoji.emoji_name] = emoji.emoji_name.replace("+", "");
}
});
exports.emojis_by_unicode = {};
_.each(default_unicode_emojis, function (emoji) {
exports.emojis_by_unicode[emoji.emoji_name] = emoji.emoji_url;
});
};
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';
};
exports.update_emojis(page_params.realm_emoji);
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = emoji;
}