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

4514
tools/areas/admin1Codes.txt Normal file

File diff suppressed because it is too large Load diff

32
tools/areas/areas.js Normal file
View file

@ -0,0 +1,32 @@
/*
http://download.geonames.org/export/dump/admin1Codes.txt
*/
$(function() {
var $body = $("body")
.css({
fontFamily: "Consolas",
fontSize: "12px"
});
$.get("admin1Codes.txt", function(data) {
var lines = data.split("\n"),
countries = {};
lines.pop();
$.each(lines, function(i, v) {
var split = v.split("\t"),
code = split[0].split(".");
if (!countries[code[0]]) {
countries[code[0]] = [];
}
countries[code[0]].push([code[1], split[1]])
});
console.log(countries);
$body.html(
$.map(Ox.keys(countries), function(v) {
return v + ": [<br/>" + Ox.repeat("&nbsp;", 4) + "[" + $.map(countries[v], function(v) {
return '"' + v.join('", "') + '"';
}).join("],<br/>" + Ox.repeat("&nbsp;", 4) + "[") + "]";
}).join("<br/>],<br/>") + "<br/>]"
);
});
});

9
tools/areas/index.html Normal file
View file

@ -0,0 +1,9 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<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="areas.js"></script>
</head>
<body></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
tools/flags/py/.DS_Store vendored Normal file

Binary file not shown.

1022
tools/flags/py/flags.py Normal file

File diff suppressed because it is too large Load diff

BIN
tools/geo/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,6 @@
{
ENG: "England",
NIR: "Northern Ireland",
SCT: "Scotland",
WLS: "Wales"
}

14487
tools/geo/geo.json Normal file

File diff suppressed because it is too large Load diff

260
tools/geo/index.html Normal file
View file

@ -0,0 +1,260 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
body {
margin: 0;
overflow: hidden;
}
#map {
width: 100%;
height: 100%;
}
#data {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 100px;
padding: 0;
border: 0;
background: rgba(0, 0, 0, 0.5);
font-family: Consolas;
font-size: 8px;
color: rgb(255, 255, 255);
overflow: auto;
z-index: 1000;
}
#data:focus {
outline: none;
}
.flag {
position: absolute;
width: 8px;
height: 8px;
margin-left: -4px;
margin-top: -4px;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 128);
-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 128);
}
.flag:hover {
width: 16px;
height: 16px;
margin-left: -8px;
margin-top: -8px;
opacity: 0.5;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 128);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 128);
}
.rect {
position: absolute;
border: 1px solid rgb(255, 255, 255);
z-index: 1;
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 128);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 128);
}
</style>
<script src="../../build/js/jquery-1.3.2.js"></script>
<script src="../../build/js/ox.js"></script>
<script src="../../build/js/ox.data.js"></script>
<script src="../../build/js/ox.geo.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
$(function() {
var $body = $("body"),
$map = $("<img/>")
.attr({
id: "map",
src: "map.png"
})
.appendTo($body),
$data = $("<textarea/>")
.attr({
id: "data"
})
.appendTo($body),
aliases = {
"Ascension Island": "Ascension Island, Saint Helena",
"England": "England, United Kingdom",
"Georgia": "Georgia, Europe",
"Holy See": "Vatican City",
// "Palestine": ["West Bank", "Gaza Strip"],
"Palestine": "West Bank",
"Saint Martin": "Sint Maarten",
"Scotland": "Scotland, United Kingdom",
"Svalbard and Jan Mayen": "Svalbard",
"Wales": "Wales, United Kingdom",
"Yugoslavia": "Serbia"
},
json = {};
///*
$.getJSON("geo.json", function(data) {
json = data;
getPlacemarks($.map(Ox.getCountries(true), function(v) {
return v.code.length == 2 ? v : null;
}));
});
//*/
/*
getPlacemarks($.map(Ox.getCountries(true), function(v) {
return v.code.length == 2 ? v : null;
}));
*/
function getPlacemarks(countries) {
var country = countries.shift();
if (!(country.code in json)) {
console.log(country);
Ox.getPlacemarks(aliases[country.name] || country.name, function(geodata) {
if (!geodata.results) {
console.log(country.name, geodata.status);
}
geodata = geodata.results[0];
data = {
address: aliases[country.name] || country.name,
geocode: {
address_components: geodata.address_components,
formatted_address: geodata.formatted_address,
geometry: {
location: {},
location_type: geodata.geometry.location_type
},
types: geodata.types
},
name: country.name,
time: +new Date()
};
$.each(["lat", "lng"], function(i, crd) {
data.geocode.geometry.location[crd] = parseFloat(
geodata.geometry.location[crd]().toFixed(8)
);
});
$.each(["bounds", "viewport"], function(i, obj) {
if (obj in geodata.geometry) {
data.geocode.geometry[obj] = {};
$.each(["center", "southWest", "northEast"], function(i, pnt) {
data.geocode.geometry[obj][pnt] = {};
$.each(["lat", "lng"], function(i, crd) {
data.geocode.geometry[obj][pnt][crd] = parseFloat(
geodata.geometry[obj][
"get" + pnt[0].toUpperCase() + pnt.substr(1)
]()[crd]().toFixed(8)
);
});
});
}
});
json[country.code] = data;
addFlag(country, json[country.code]);
addData(json)
if (country.name != geodata.formatted_address) {
console.log(country.name, geodata.formatted_address, geodata);
}
if (countries.length) {
setTimeout(function() {
getPlacemarks(countries);
}, 1000);
}
});
} else {
addFlag(country, json[country.code]);
addData(json);
if (countries.length) {
setTimeout(function() {
getPlacemarks(countries);
}, 100);
}
}
}
function addData(json) {
//var scroll = $data[0].scrollTop == $data[0].scrollHeight;
$data.html(
JSON.stringify(json, null, 4)
);
/*
if (scroll) {
$data[0].scrollTop = $data[0].scrollHeight;
}
*/
}
function addFlag(country, data) {
var location = Ox.getXY(data.geocode.geometry.location.lat, data.geocode.geometry.location.lng),
bounds = "bounds" in data.geocode.geometry ? data.geocode.geometry.bounds : data.geocode.geometry.viewport,
southWest = Ox.getXY(bounds.southWest.lat, bounds.southWest.lng),
northEast = Ox.getXY(bounds.northEast.lat, bounds.northEast.lng),
crossesDateline = southWest.x > northEast.x,
$div = [];
if (crossesDateline) {
$div = [
$("<div/>")
.addClass("rect")
.css({
left: "-16px",
top: ($map.height() * northEast.y) + "px",
right: ($map.width() - $map.width() * northEast.x) + "px",
bottom: ($map.height() - $map.height() * southWest.y) + "px",
})
.hide()
.appendTo($body),
$("<div/>")
.addClass("rect")
.css({
left: ($map.width() * southWest.x) + "px",
top: ($map.height() * northEast.y) + "px",
right: "-16px",
bottom: ($map.height() - $map.height() * southWest.y) + "px",
})
.hide()
.appendTo($body),
];
} else {
$div = [
$("<div/>")
.addClass("rect")
.css({
left: ($map.width() * southWest.x) + "px",
top: ($map.height() * northEast.y) + "px",
right: ($map.width() - $map.width() * northEast.x) + "px",
bottom: ($map.height() - $map.height() * southWest.y) + "px",
})
.hide()
.appendTo($body)
];
}
$("<img/>")
.attr({
src: "../../tools/flags/png/16/" + (country.flag.indexOf("-") == 2 ?
country.flag.substr(0, 2) + "/" : "") + country.flag + ".png",
title: country.name + " ((" + bounds.southWest.lat + ", " + bounds.southWest.lng + "), (" + bounds.northEast.lat + ", " + bounds.northEast.lng + "))"
})
.addClass("flag")
.css({
left: (location.x * 100) + "%",
top: (location.y * 100) + "%"
})
.mouseenter(function() {
$(this).css({
zIndex: Ox.uid()
});
$.each($div, function() {
$(this).show();
});
})
.mouseleave(function() {
$.each($div, function() {
$(this).hide();
});
})
.appendTo($body);
window.status = Ox.length(json) + " " + data.address;
}
});
</script>
</head>
<body></body>
</html>

BIN
tools/geo/map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

58
tools/unicode/charts.css Normal file
View file

@ -0,0 +1,58 @@
table { border-spacing: 0; border-collapse: collapse;
border-style: solid; border-color: black; border-width: 1px; }
th, td { border-spacing: 0;
border-style: solid; border-color: teal; border-width: 1px;
color: black; vertical-align: top; }
td { font-size: 120%; text-align: Center; vertical-align: top; width: 48px }
table.headerTable {
border-color: white;
border-width: 0px;
font-size: 120%;
width: 100%;
}
td.headerLeft {
border-color: white;
border-width: 0px;
text-align: left;
font-size: 120%;
}
td.headerCenter {
border-color: white;
border-width: 0px;
text-align: center;
font-size: 120%;
}
td.headerRight {
border-color: white;
border-width: 0px;
text-align: right;
font-size: 120%;
}
td.new, td.cellwnew, td.cellnew {
background-color: #FFFFCC;
}
chart {background-color: red;}
td.p { color: #000000; background-color: #7777FF }
td.s { color: #000000; background-color: #BBBBFF }
td.t { color: #000000; background-color: #DDDDFF }
td.q { color: #000000; background-color: #FFFFFF }
td.ep { color: #000000; background-color: #FF5555 }
td.es { color: #000000; background-color: #FF7777 }
td.et { color: #000000; background-color: #FF9999 }
td.eq { color: #000000; background-color: #FFBBBB }
th { vertical-align: top; font-weight: bold }
th.x { vertical-align: top; font-weight: regular; text-align: Left }
tt { font-size: 50% }
td.name { text-align: left; vertical-align: middle; width: 96% }
body { background-color: #FFFFFF; }
td.g { font-size: 120%; text-align: Center; width: 72px; color: #808080; }
td.n { font-size: 120%; text-align: Center; width: 72px; color: #000000; background-color: #CCCCFF; }
td.z { font-size: 120%; text-align: Center; width: 72px; font-weight: bold; background-color: #EEEEEE; }
td.h { font-size: 120%; text-align: Left; color: #000000; background-color: #EEEEEE; }

9
tools/unicode/index.html Normal file
View file

@ -0,0 +1,9 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<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>

84
tools/unicode/unicode.js Normal file
View file

@ -0,0 +1,84 @@
/*
http://unicode.org/charts/collation/chart_Latin.html
*/
$(function() {
var $body = $("body"),
latin = [];
$.each("ABCDEFGHIJKLMNOPQRSTUVWXYZ", function(i, v) {
latin.push(v);
});
$.each(["AE", "DZ", "NJ", "OE", "SZ"], function(i, v) {
latin.push(v);
});
var unicode = {};
$.each(latin, function(i, v) {
unicode[v] = [];
});
$.each(latin, function(i, v) {
unicode[v.toLowerCase()] = [];
});
$.get("chart_Latin.html", function(data) {
data = "<table>" + data.split("<table>")[1].split("</table>")[0] + "</table>";
$("body").append(data);
$("td").each(function() {
var $this = $(this);
var title = $this.attr('title').split(":")[0].replace("SHARP S", "SZ");
var words = title.split(" ");
if (title.substr(-2, 1) != " "
&& words[0] == "LATIN"
&& $.inArray(words[1], ["CAPITAL", "SMALL"]) > -1
&& $.inArray(words[2], ["LETTER", "LIGATURE"]) > -1
&& $.inArray(words[3], latin) > -1) {
var character = words[1] == "CAPITAL" ? words[3] : words[3].toLowerCase();
unicode[character].push({
character: "\\u" + $(this).children().eq(1).html(),
comment: title.replace("SZ", "SHARP S")
});
}
});
$body.empty();
$.each(unicode, function(k, v) {
unicode[k].sort(function(a, b) {
a = a.character.substr(2);
b = b.character.substr(2);
return (a < b) * -1 + (a > b);
});
});
$div = $("<div/>")
.css({
fontFamily: "Consolas",
fontSize: "12px"
})
.html(
$.map(Ox.keys(unicode), function(v) {
return v + ": [<br/>" + Ox.repeat("&nbsp;", 4) + $.map(unicode[v], function(v_, i) {
return '"' + v_.character + '"' + (i < unicode[v].length - 1 ? "," : "&nbsp;") + " // " + v_.comment;
}).join("<br/>" + Ox.repeat("&nbsp;", 4));
}).join("<br/>],<br/>") + "<br/>]"
)
.appendTo($body);
/*
$.each(unicode, function(k, v) {
$div.append(k + ": [<br/>");
var length = v.length;
$.each(v, function(i, v_) {
$div.append("&nbsp; &nbsp; \"" + v_.character + "\"" + (i < v.length - 1 ? "," : "&nbsp;") + " // " + v_.comment + "<br/>")
});
$div.append("]" + (k != 'sz' ? "," : "") + "<br/>");
});
*/
$div = $("<div/>").css({
fontFamily: "Lucida Grande",
fontSize: "24px"
}).appendTo($body);
$.each(unicode, function(k, v) {
$div.append(k + ": ");
$.each(v, function(i, v_) {
console.log(v_)
$div.append("<span title=\"" + v_.comment + "\">&#x" + v_.character.substr(2) + ";</span>");
});
$div.append("<br/>");
});
});
});

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