diff --git a/Resources/Plugins/emoji-keyboard/.meta b/Resources/Plugins/emoji-keyboard/.meta index 016615cc..8042fe31 100644 --- a/Resources/Plugins/emoji-keyboard/.meta +++ b/Resources/Plugins/emoji-keyboard/.meta @@ -3,6 +3,7 @@ Emoji keyboard [description] - Adds an emoji keyboard when writing tweets +- Emoji list provided by http://unicode.org/emoji/charts/emoji-ordering.html [author] chylex diff --git a/Resources/Plugins/emoji-keyboard/browser.js b/Resources/Plugins/emoji-keyboard/browser.js index cf213438..89108ed0 100644 --- a/Resources/Plugins/emoji-keyboard/browser.js +++ b/Resources/Plugins/emoji-keyboard/browser.js @@ -102,13 +102,10 @@ ready(){ }; $TDP.readFileRoot(this.$token, "emoji-ordering.txt").then(contents => { - let generated = [ - "<p style='font-size:13px;color:#444;margin:4px;text-align:center'>Please, note that most emoji will not show up properly in the text box above, but they will display in the tweet.</p>" - ]; + let generated = []; let addDeclaration = decl => { - let emoji = decl.split(" ").map(pt => convUnicode(parseInt(pt, 16))).join(""); - generated.push(TD.util.cleanWithEmoji(emoji)); + generated.push(decl.split(" ").map(pt => convUnicode(parseInt(pt, 16))).join("")); }; let skinTones = [ @@ -116,29 +113,29 @@ ready(){ ]; for(let line of contents.split("\n")){ - if (line[0] === '#'){ - continue; - } - else if (line[0] === '@'){ - generated.push("<div class='separator'></div>"); - continue; - } - - let decl = line.substring(0, line.indexOf(";")); - let skinIndex = decl.indexOf('$'); - - if (skinIndex !== -1){ - let declPre = decl.substring(0, skinIndex); - let declPost = decl.substring(skinIndex+1); - - skinTones.map(skinTone => declPre+skinTone+declPost).forEach(addDeclaration); + if (line[0] === '@'){ + generated.push("___"); } else{ - addDeclaration(decl); + let decl = line.slice(0, line.indexOf(";")); + let skinIndex = decl.indexOf('$'); + + if (skinIndex !== -1){ + let declPre = decl.slice(0, skinIndex); + let declPost = decl.slice(skinIndex+1); + + for(let newDecl of skinTones.map(skinTone => declPre+skinTone+declPost)){ + addDeclaration(newDecl); + } + } + else{ + addDeclaration(decl); + } } } - this.emojiHTML = generated.join(""); + let start = "<p style='font-size:13px;color:#444;margin:4px;text-align:center'>Please, note that most emoji will not show up properly in the text box above, but they will display in the tweet.</p>"; + this.emojiHTML = start+TD.util.cleanWithEmoji(generated.join("")).replace("___", "<div class='separator'></div>"); }).catch(err => { $TD.alert("error", "Problem loading emoji keyboard: "+err.message); }); diff --git a/Resources/Plugins/emoji-keyboard/emoji-ordering.txt b/Resources/Plugins/emoji-keyboard/emoji-ordering.txt index 5cbe2acb..8da966aa 100644 --- a/Resources/Plugins/emoji-keyboard/emoji-ordering.txt +++ b/Resources/Plugins/emoji-keyboard/emoji-ordering.txt @@ -1,7 +1,3 @@ -# Machine-readable version of the emoji ordering for v4.0 (corresponding to CLDR). -# Note that the skin-tone modifiers are primary-ignorable in the CLDR collation rules. -# For a listing with the groups and subgroups, and the non-qualified sequences, -# see http://unicode.org/Public/emoji/4.0/emoji-test.txt 1F600; 😀 grinning face 1F601; 😁 grinning face with smiling eyes 1F602; 😂 face with tears of joy