forked from 0x2620/oxjs
add unicode demo
This commit is contained in:
parent
0c4a30ecc5
commit
8e68992ea0
3 changed files with 49 additions and 0 deletions
28
demos/unicode/js/unicode.js
Normal file
28
demos/unicode/js/unicode.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Ox.load({UI: {}, Unicode: {}}, function() {
|
||||
|
||||
var ascii = {},
|
||||
$body = Ox.UI.$body.css({overflow: 'auto'}),
|
||||
$table = $('<table>').appendTo($body);
|
||||
|
||||
Ox.forEach(Ox.UNICODE_CHARACTERS, function(data, char) {
|
||||
if (data.ascii) {
|
||||
ascii[data.ascii] = ascii[data.ascii] || [];
|
||||
ascii[data.ascii].push({char: char, names: data.names});
|
||||
}
|
||||
});
|
||||
|
||||
Ox.print(ascii);
|
||||
|
||||
Ox.forEach(Object.keys(ascii).sort(function(a, b) {
|
||||
return a.length * 1000000 + a.charCodeAt(0)
|
||||
- b.length * 1000000 - b.charCodeAt(0);
|
||||
}), function(char) {
|
||||
var $tr = $('<tr>').appendTo($table);
|
||||
$('<td>').html(char).appendTo($tr)
|
||||
ascii[char].forEach(function(data) {
|
||||
$('<td>').attr({title: data.names.join('\n')})
|
||||
.html(data.char).appendTo($tr);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue