oxjs/demos/unicode/js/unicode.js
2011-11-30 15:55:36 +01:00

28 lines
No EOL
870 B
JavaScript

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