1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-06-15 03:35:16 +00:00
This commit is contained in:
Faged9nank 2017-04-22 00:52:16 +00:00 committed by GitHub
commit a740f19bb3
8 changed files with 23 additions and 9 deletions

View File

@ -12,6 +12,12 @@ Just use the following in the `<head>` tag of your HTML document(s):
<script src="//twemoji.maxcdn.com/twemoji.min.js"></script> <script src="//twemoji.maxcdn.com/twemoji.min.js"></script>
``` ```
Alternatively you can use [cdnjs](https://cdnjs.com/) if you prefer:
```html
<script src="//cdnjs.cloudflare.com/ajax/libs/twemoji/1.3.2/twemoji.min.js"></script>
```
## API ## API
Following all methods exposed through the `twemoji` namespace. Following all methods exposed through the `twemoji` namespace.

View File

@ -1,7 +1,6 @@
{ {
"name": "twemoji", "name": "twemoji",
"description": "A Unicode standard based way to implement emoji across all platforms.", "description": "A Unicode standard based way to implement emoji across all platforms.",
"version": "v1.3.2",
"main": "./twemoji.amd.js", "main": "./twemoji.amd.js",
"ignore": [ "ignore": [
".git", ".git",

View File

@ -1,5 +1,5 @@
{ {
"version": "1.3.2", "version": "1.4.1",
"name": "twemoji", "name": "twemoji",
"license": ["MIT", "CC-BY-4.0"], "license": ["MIT", "CC-BY-4.0"],
"description": "A Unicode standard based way to implement emoji across all platforms.", "description": "A Unicode standard based way to implement emoji across all platforms.",
@ -15,7 +15,8 @@
], ],
"devDependencies": { "devDependencies": {
"uglify-js": ">= 0.0.0", "uglify-js": ">= 0.0.0",
"phantomjs": ">= 0.0.0" "phantomjs": ">= 0.0.0",
"regenerate": ">= 0.0.0"
}, },
"author": { "author": {
"name": "Twitter, Inc.", "name": "Twitter, Inc.",

View File

@ -217,6 +217,14 @@ Queue([
console.log('generating a RegExp for available assets'); console.log('generating a RegExp for available assets');
var sensitive = []; var sensitive = [];
var regular = []; var regular = [];
var regenerate = require('regenerate');
var regenerated = function (arr) {
return regenerate.apply(null, arr.map(function (emoji) {
return JSON.parse('"' + emoji + '"').split('').reduce(function (p, c) {
return p + c.codePointAt(0);
}, 0);
})).toRegExp().toString().slice(1, -1);
};
q.emojiSource.forEach(function (codePoint) { q.emojiSource.forEach(function (codePoint) {
var u; var u;
if (q.ignore.indexOf(codePoint) < 0) { if (q.ignore.indexOf(codePoint) < 0) {
@ -231,8 +239,8 @@ Queue([
// create a RegExp with properly ordered matches // create a RegExp with properly ordered matches
q.re = '((?:' + q.re = '((?:' +
regular.join('|') + ')|(?:(?:' + regenerated(regular) + ')|(?:(?:' +
sensitive.join('|') + regenerated(sensitive) +
')([\\uFE0E\\uFE0F]?)))'; ')([\\uFE0E\\uFE0F]?)))';
q.next(); q.next();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
twemoji.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long