-
Notifications
You must be signed in to change notification settings - Fork 3
/
det.js
72 lines (50 loc) · 2.18 KB
/
det.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(function (w, d, u) {
aboutButton = d.getElementById("login-button"),
c = d.getElementById("c"),
window.onload = function() {
var c=localStorage.getItem("c");
if(c==null){
var c = prompt("Please Stackoverflow Userid", "");
localStorage.setItem("d", c);
localStorage.setItem("c", c);
}
var d = localStorage.getItem("d");
$.ajax({
url: "https://api.stackexchange.com/2.2/users/"+d+"?order=desc&sort=reputation&site=stackoverflow",
type: 'GET',
dataType: 'json',
success: function(res) {
var a = ((res.items[0]));
document.getElementById("a").innerHTML = "<b>"+(a.display_name)+"<b>";
document.getElementById("myimg").src = a.profile_image;
document.getElementById("b").innerHTML = "<b>"+(a.location)+"<b>";
document.getElementById("c").innerHTML += "<b>Age "+(a.age)+"<b>";
document.getElementById("gold").innerHTML += "<b>"+(a.badge_counts.gold)+"<b>";
document.getElementById("silver").innerHTML += "<b>"+(a.badge_counts.silver)+"<b></font>";
document.getElementById("bronze").innerHTML += "<b>"+(a.badge_counts.bronze)+"<b></font>";
document.getElementById("repu").innerHTML += "<b>"+(a.reputation)+"<b>";
document.getElementById("gold").style.color = "#000000";
document.getElementById("silver").style.color = "#000000";
document.getElementById("bronze").style.color = "#000000";
}
});
$.ajax({
url: "https://api.stackexchange.com/2.2/users/"+d+"/questions?order=desc&sort=activity&site=stackoverflow",
type: 'GET',
dataType: 'json',
success: function(qus) {
var count = qus.items.length;
document.getElementById("e").innerHTML = "<b>"+(count)+" Questions<b><br>";
}
});
$.ajax({
url: "https://api.stackexchange.com/2.2/users/"+d+"/answers?order=desc&sort=activity&site=stackoverflow",
type: 'GET',
dataType: 'json',
success: function(ans) {
var nans = ans.items.length;
document.getElementById("f").innerHTML = "<b>"+(nans)+" Answers<b>";
}
});
}
})(window, document);