oxjs/demos/unicode/js/unicode.js

28 lines
870 B
JavaScript
Raw Normal View History

2011-11-30 14:55:36 +00:00
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);
});
});
});