manifest.json: http://dumpz.org/8553/

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<style type="text/css">
.data {
padding: 2px;
margin: 1px;
font-size: 14px;
}
#karma {
background: #74C262;
}
#force {
background: #25A8FF;
}
</style>
<script type="text/javascript">
function doRequest(url, callback) {
var xhr;
xhr = new XMLHttpRequest();
xhr.onreadystatechange = ensureReadiness;
function ensureReadiness() {
if (xhr.readyState < 4) {
return;
}
if (xhr.status !== 200) {
return;
}
if(xhr.readyState === 4) {
callback(xhr);
}
}
xhr.open('GET', url, true)
xhr.send('');
}
function getKarmaAndRating() {
doRequest("http://habrahabr.ru/api/profile/barttos/", function(response) {
response = response.responseText;
XmlParser = new DOMParser();
XmlDocument = XmlParser.parseFromString(response, "text/xml");
karma = XmlDocument.getElementsByTagName("karma")[0].childNodes[0].nodeValue;
rating = XmlDocument.getElementsByTagName("rating")[0].childNodes[0].nodeValue;
document.getElementById("karma").innerHTML = karma;
document.getElementById("force").innerHTML = rating;
});
}
</script>
</head>
<body onload="window.setTimeout(getKarmaAndRating, 0)" onclick="getKarmaAndRating()">
<p id="karma" class="data">0.00</p>
<p id="force" class="data">0.00</p>
</body>
</html>