1
0
Fork 0
forked from 0x2620/oxjs

add unicode demo

This commit is contained in:
rolux 2011-11-30 15:55:36 +01:00
commit 8e68992ea0
3 changed files with 49 additions and 0 deletions

View 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);
});
});
});