FEATURE: Adds ~200 more emoji
This includes all new emoji from Unicode 7 and Unicode 8 with the exception of skin tones which will require a new interface.
|
@ -333,7 +333,7 @@ export default Ember.Component.extend({
|
|||
term = term.toLowerCase();
|
||||
|
||||
if (term === "") {
|
||||
return resolve(["slightly_smiling", "smile", "wink", "sunny", "blush"]);
|
||||
return resolve(["slight_smile", "smile", "wink", "sunny", "blush"]);
|
||||
}
|
||||
|
||||
if (Discourse.Emoji.translations[full]) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// TODO @robin to move this whole thing to es6
|
||||
Discourse.Emoji = {};
|
||||
|
||||
// bump up this number to expire all emojis
|
||||
Discourse.Emoji.ImageVersion = "1"
|
||||
Discourse.Emoji.ImageVersion = "2"
|
||||
|
||||
var emoji = <%= Emoji.standard.map(&:name).flatten.inspect %>;
|
||||
var aliases = <%= Emoji.aliases.inspect.gsub("=>", ":") %>;
|
||||
|
@ -108,8 +109,8 @@ function imageFor(code) {
|
|||
|
||||
// Also support default emotions
|
||||
var translations = {
|
||||
':)' : 'slightly_smiling',
|
||||
':-)' : 'slightly_smiling',
|
||||
':)' : 'slight_smile',
|
||||
':-)' : 'slight_smile',
|
||||
':(' : 'frowning',
|
||||
':-(' : 'frowning',
|
||||
';)' : 'wink',
|
||||
|
|
|
@ -20,19 +20,19 @@ class Emoji
|
|||
end
|
||||
|
||||
def self.all
|
||||
Discourse.cache.fetch("all_emojis") { standard | custom }
|
||||
Discourse.cache.fetch("all_emojis:v2") { standard | custom }
|
||||
end
|
||||
|
||||
def self.standard
|
||||
Discourse.cache.fetch("standard_emojis") { load_standard }
|
||||
Discourse.cache.fetch("standard_emojis:v2") { load_standard }
|
||||
end
|
||||
|
||||
def self.aliases
|
||||
Discourse.cache.fetch("aliases_emojis") { load_aliases }
|
||||
Discourse.cache.fetch("aliases_emojis:v2") { load_aliases }
|
||||
end
|
||||
|
||||
def self.custom
|
||||
Discourse.cache.fetch("custom_emojis") { load_custom }
|
||||
Discourse.cache.fetch("custom_emojis:v2") { load_custom }
|
||||
end
|
||||
|
||||
def self.exists?(name)
|
||||
|
@ -52,7 +52,7 @@ class Emoji
|
|||
end
|
||||
|
||||
def self.create_from_db_item(emoji)
|
||||
name = emoji["aliases"].first
|
||||
name = emoji["name"]
|
||||
filename = "#{name}.png"
|
||||
Emoji.new.tap do |e|
|
||||
e.name = name
|
||||
|
@ -91,16 +91,19 @@ class Emoji
|
|||
end
|
||||
|
||||
def self.load_standard
|
||||
db.map { |emoji| Emoji.create_from_db_item(emoji) }
|
||||
db['emojis'].map {|e| Emoji.create_from_db_item(e) }
|
||||
end
|
||||
|
||||
def self.load_aliases
|
||||
aliases = {}
|
||||
return @aliases if @aliases
|
||||
|
||||
db.select { |emoji| emoji["aliases"].count > 1 }
|
||||
.each { |emoji| aliases[emoji["aliases"][0]] = emoji["aliases"][1..-1] }
|
||||
@aliases ||= db['aliases']
|
||||
|
||||
aliases
|
||||
# Fix how `slightly_smiling` was mislabeled
|
||||
@aliases['slight_smile'] ||= []
|
||||
@aliases['slight_smile'] << 'slightly_smiling'
|
||||
|
||||
@aliases
|
||||
end
|
||||
|
||||
def self.load_custom
|
||||
|
@ -121,10 +124,19 @@ class Emoji
|
|||
def self.unicode_replacements
|
||||
return @unicode_replacements if @unicode_replacements
|
||||
|
||||
@unicode_replacements = Hash[db.map {|e| [e['emoji'], e['aliases'][0]] }]
|
||||
|
||||
@unicode_replacements = {}
|
||||
db['emojis'].each do |e|
|
||||
hex = e['code'].hex
|
||||
# Don't replace digits or letters
|
||||
if hex > 128
|
||||
@unicode_replacements[[hex].pack('U')] = e['name']
|
||||
end
|
||||
end
|
||||
|
||||
@unicode_replacements["\u{2639}"] = 'frowning'
|
||||
@unicode_replacements["\u{263A}"] = 'slightly_smiling'
|
||||
@unicode_replacements["\u{263B}"] = 'slightly_smiling'
|
||||
@unicode_replacements["\u{263A}"] = 'slight_smile'
|
||||
@unicode_replacements["\u{263B}"] = 'slight_smile'
|
||||
@unicode_replacements["\u{2661}"] = 'heart'
|
||||
@unicode_replacements["\u{2665}"] = 'heart'
|
||||
|
||||
|
|
12593
lib/emoji/db.json
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.9 KiB |