1
0
Fork 0
forked from 0x2620/oxjs
This commit is contained in:
Rolux 2010-01-07 21:21:07 +01:00
commit 5b8b31271c
87 changed files with 73788 additions and 0 deletions

34740
tools/unicode2/NamesList.txt Normal file

File diff suppressed because it is too large Load diff

16
tools/unicode2/index.html Normal file
View file

@ -0,0 +1,16 @@
<html>
<head>
<title>Oxjs Tools - Unicode</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style>
body {
font-family: Consolas;
font-size: 12px;
}
</style>
<script type="text/javascript" src="../../build/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../build/js/ox.js"></script>
<script type="text/javascript" src="unicode.js"></script>
</head>
<body></body>
</html>

38
tools/unicode2/unicode.js Normal file
View file

@ -0,0 +1,38 @@
getNames();
function getNames() {
var //url = "http://unicode.org/Public/UNIDATA/NamesList.txt",
url = "NamesList.txt";
$.get(url, function(data) {
data = data.replace(/<control>\n\t=/g, "<control>");
var names = {}, json = "", split = [];
$.each(data.replace(/\n/g, "\n\n").match(/\n[0-9A-F]{4}\t.+\n/g), function(i, v) {
names["0x" + v.substr(1, 4)] = v.substr(6, v.length - 7);
});
json = JSON.stringify(names, null, 4)
$.each(data.match(/\n@@\t[0-9A-F]{4}\t.+\n/g), function(i, v) {
split = v.split("\t");
split[1] = "0x" + split[1];
xx = 0
while (split[1] in names == false && xx < 10) {
console.log(split[2],split[1])
split[1] = inc(split[1]);
xx++;
}
json = json.replace("\"" + split[1], "// " + split[2] + "\n \"" + split[1])
});
json = json
.replace(/ /g, "&nbsp;&nbsp;&nbsp;&nbsp;")
.replace(/\"0x/g, "0x")
.replace(/\":/g, ":")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/\n/g, "<br/>");
$("body").html(json);
});
}
function inc(str) {
str = (parseInt(str, 16) + 1).toString(16).toUpperCase();
return "0x" + new Array(5 - str.length).join("0") + str;
}