1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 05:11:44 +03:00
semantic/prototype/UI/index.html

56 lines
1.4 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
<head>
<title>semantic-diff</title>
2015-10-09 22:27:44 +03:00
<style type="text/css">
#left {
position: absolute;
left: 0; top: 0;
width: 50%;
outline: 1px solid green;
}
#right {
position: absolute;
right: 0; top: 0;
width: 50%;
outline: 1px solid red;
}
</style>
<script type="text/javascript">
function loadJSON(path, callback) {
var request = new XMLHttpRequest();
request.overrideMimeType("application/json");
request.open('GET', '' + path, true);
request.onreadystatechange = function () {
if (request.readyState == 4 && (request.status == "200" || request.status == 0)) {
2015-10-09 21:36:18 +03:00
callback(JSON.parse(request.responseText));
}
};
request.send(null);
}
function toDOM(json) {
if (json instanceof Array) {
2015-10-13 17:16:54 +03:00
console.log("it's an array");
for (index in json) {
2015-10-13 17:16:54 +03:00
console.log(json[index]);
}
} else if (json instanceof Object) {
for (key in json) {
2015-10-13 17:16:54 +03:00
console.log(key);
}
}
}
</script>
</head>
<body>
2015-10-09 22:27:44 +03:00
<div id="left"></div>
<div id="right"></div>
<script type="text/javascript">
2015-10-09 21:36:38 +03:00
loadJSON('Fixtures/swift.json', function (json) {
2015-10-13 16:47:52 +03:00
toDOM(json)
});
</script>
</body>
</html>