2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
//include whatwg-fetch/fetch.js
|
2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
const url = 'https://bigchaindb-github.now.sh'
|
2017-05-06 18:41:04 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
function injectData(data) {
|
|
|
|
const repos = data
|
2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
// just grab the first item of array
|
|
|
|
// should always be bigchaindb/bigchaindb cause of ordering by most stars
|
|
|
|
const repo = repos[0]
|
|
|
|
const stars = repo.stars
|
|
|
|
const release = repo.release
|
2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
document.getElementById('stars').innerText = stars
|
|
|
|
document.getElementById('stars').style.opacity = 1
|
|
|
|
document.getElementById('release').innerText = release
|
|
|
|
document.getElementById('release').style.opacity = 1
|
|
|
|
}
|
2017-05-04 14:27:12 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
fetch(url)
|
|
|
|
.then(function(response) {
|
|
|
|
return response.json()
|
|
|
|
})
|
|
|
|
.then(function(data) {
|
|
|
|
injectData(data)
|
|
|
|
})
|
|
|
|
.catch(function(error) {
|
|
|
|
console.log(error)
|
|
|
|
})
|
2017-05-06 18:41:04 +02:00
|
|
|
|
2017-05-10 00:10:27 +02:00
|
|
|
})
|