Last active
September 11, 2019 17:19
-
-
Save Rizwan-Hasan/b41f6ea541fd8e490e86173cd20427d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Total Download</title> | |
</head> | |
<body> | |
<p style="font-size: 500%; text-align: center">Total Downloads:</p> | |
<p id="download" style="font-size:1000%; text-align: center"></p> | |
<script type="text/javascript"> | |
let userName = "magpie-robins"; // User name of the repository | |
let repoName = "gpa-calculator-android"; // Repository name | |
let releaseTag = "latest"; // Using tag 'latest' for latest released download count | |
let url = `https://api.github.com/repos/${userName}/${repoName}/releases/${releaseTag}`; | |
let request = new XMLHttpRequest(); | |
request.open('GET', url, true); | |
request.onload = function () { | |
let users = JSON.parse(this.response); | |
let output = users['assets'][0]["download_count"]; | |
console.log(output); | |
document.getElementById('download').innerHTML = output; | |
}; | |
request.send(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment