-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
97 lines (62 loc) · 2.28 KB
/
app.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$(document).ready(function () {
dados = [];
langua = "";
count = 0;
$.ajax({
url : '/languages.json',
type: 'get',
dataType : 'json'
}).done(function (links) {
// links.forEach(function (link) {
// console.log(link);
// $.ajax({
// url : link,
// type: 'get',
// dataType : 'json'
// }).done(function (result) {
// console.log(result);
// })
//
//
// })
// console.log(links.length);
// console.log(links);
for(var i = 0; i < links.length; i++)
{
$.ajax({
url : links[i] + '?client_id=df980e9eafe017a6552a&client_secret=c088af81d772840eabd4a3fe1a67b3c9d1dfe51e',
type: 'get',
dataType : 'json',
async : false
}).done(function (result) {
// console.log(result);
// if(result.Kotlin != undefined) {
if(true){
var total = 0;
for(var language in result) {
console.log(result[language]);
if(language != "Kotlin" && language != "Java") {
total += result[language];
}
}
var newRow = $("<tr>");
var cols = "";
cols += '<td>' + count + '</td>';
cols += '<td>' + links[count] + '</td>';
cols += '<td>' + (result.Kotlin == undefined ? 0 : result.Kotlin) + '</td>';
cols += '<td>' + (result.Java == undefined ? 0 : result.Java) + '</td>';
cols += '<td>' + total + '</td>';
newRow.append(cols);
$("#products-table").append(newRow);
}
dados[count] = result;
count++;
});
}
console.log(dados);
//console.log(links[0]);
//?client_id=df980e9eafe017a6552a&client_secret=c088af81d772840eabd4a3fe1a67b3c9d1dfe51e
});
// $('body').append(JSON.stringify(dados))
// $('body').append(JSON.parse(dados) + ',<br />');
});