mirror of
https://github.com/twitter/twemoji.git
synced 2024-06-15 03:35:16 +00:00
added previews
This commit is contained in:
parent
b53af0264a
commit
1720e9b22f
47
2/templates/preview.html
Normal file
47
2/templates/preview.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Twitter Emoji (Twemoji) Preview</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<style>
|
||||
ul.emoji-list * {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
ul.emoji-list li {
|
||||
font-size: 36px;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
padding: 2px;
|
||||
margin: 4px;
|
||||
}
|
||||
img.emoji {
|
||||
cursor: pointer;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
margin: 0 .05em 0 .1em;
|
||||
vertical-align: -0.1em;
|
||||
}
|
||||
</style>
|
||||
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<ul class="emoji-list">
|
||||
{{emoji-list}}
|
||||
</ul>
|
||||
<script>
|
||||
twemoji.parse(document.getElementsByTagName('ul')[0], {{emoji-options}});
|
||||
(function (img, metaKey, i) {
|
||||
function copyToClipboard(e) {
|
||||
prompt('Copy to clipboard via ' + metaKey + '+C and Enter', this.alt);
|
||||
}
|
||||
for (i = 0; i < img.length; img[i++].onclick = copyToClipboard) {}
|
||||
}(
|
||||
document.getElementsByTagName('img'),
|
||||
/\b(?:Mac |i)OS\b/i.test(navigator.userAgent) ? 'Command' : 'Ctrl'
|
||||
));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1707
2/test/preview-svg.html
Normal file
1707
2/test/preview-svg.html
Normal file
File diff suppressed because it is too large
Load Diff
1707
2/test/preview.html
Normal file
1707
2/test/preview.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
function file(which) {
|
||||
return path.join(__dirname, '../', which);
|
||||
return path.join(__dirname, '..', which);
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
|
@ -10,7 +10,7 @@ var http = require('http');
|
||||
var path = require('path');
|
||||
|
||||
function file(which) {
|
||||
return path.join(__dirname, '../../', which);
|
||||
return path.join(__dirname, '../..', which);
|
||||
}
|
||||
|
||||
// Twitter assets by property name
|
||||
|
44
2/utils/preview
Executable file
44
2/utils/preview
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
|
||||
https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
|
||||
*/
|
||||
|
||||
// dependencies
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
function file(which) {
|
||||
return path.join(__dirname, '..', which);
|
||||
}
|
||||
|
||||
fs.readdir(file('assets'), function (err, files) {
|
||||
var page = fs.readFileSync(file('templates/preview.html')).toString().replace(
|
||||
'{{emoji-list}}',
|
||||
'<li>' + files.map(function (file) {
|
||||
return file.replace('.ai', '').split('-').map(function (hex) {
|
||||
return '&#x' + hex.toUpperCase() + ';';
|
||||
}).join('');
|
||||
}).join('</li>\n <li>')+ '</li>'
|
||||
);
|
||||
fs.writeFileSync(
|
||||
file('test/preview.html'),
|
||||
page.replace(
|
||||
'{{emoji-options}}',
|
||||
JSON.stringify({
|
||||
size: 72
|
||||
})
|
||||
)
|
||||
);
|
||||
fs.writeFileSync(
|
||||
file('test/preview-svg.html'),
|
||||
page.replace(
|
||||
'{{emoji-options}}',
|
||||
JSON.stringify({
|
||||
folder: 'svg',
|
||||
ext: '.svg',
|
||||
base: ''
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
Loading…
Reference in New Issue
Block a user