-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (15 loc) · 702 Bytes
/
script.js
File metadata and controls
21 lines (15 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
window.addEventListener("load", getuuid());
function getuuid() {
var url=window.location.href
console.log(`url: ${url}`)
var after_question_mark = url.substring(url.lastIndexOf('?') + 1, url.length);
console.log(`after_question_mark: ${after_question_mark}`)
var username = after_question_mark.split('=')[1]
awaitGitubRequest(username)
}
async function awaitGitubRequest(username) {
let response = await fetch('https://api.github.com/users/' + username);
let data = await response.json();
document.getElementsByClassName("querystring")[0].innerHTML = username
document.getElementsByClassName("userinfo")[0].innerHTML = JSON.stringify(data, null, " ")
}