Skip to content

Instantly share code, notes, and snippets.

@jiraiyame
Created April 11, 2014 02:26
Show Gist options
  • Save jiraiyame/10437774 to your computer and use it in GitHub Desktop.
Save jiraiyame/10437774 to your computer and use it in GitHub Desktop.
emoji icon from twitter.
var SCOPE_PICTOGRAPHS = [127744, 128359];
var SCOPE_PICTOGRAPHS_EXTRA = [128507, 128511];
var SCOPE_EMOTICONS = [128512, 128591];
var SCOPE_TRANSPORT = [128640, 128709];
function emojiconsString(title, scope, size) {
var html = [title ? '<h2>' + title + '</h2>' : ''];
size = size || [72, 72];
html.push('<ul>');
for (var i = scope[0], end = scope[1]; i <= end; i++)
html.push('<li><img src="https://abs.twimg.com/emoji/v1/' + size[0] + 'x' + size[1] + '/' + i.toString(16) + '.png" title="' + i.toString(16) + '" onerror="invalidIcon(this)">');
html.push('</ul>');
return html.join('');
}
function invalidIcon(e) {
e.parentNode.parentNode.removeChild(e.parentNode);
}
$([
emojiconsString('Miscellaneous Symbols And Pictographs', SCOPE_PICTOGRAPHS),
emojiconsString(null, SCOPE_PICTOGRAPHS_EXTRA),
emojiconsString('Emoticons', SCOPE_EMOTICONS),
emojiconsString('Transport and Map Symbols', SCOPE_TRANSPORT)
].join('')).appendTo('body');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment