Last active
January 6, 2021 13:42
-
-
Save dinhanhthi/699aa86bb5fb63fad0a6ab97410b1b5b to your computer and use it in GitHub Desktop.
List of starred Github repositories
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
<ol id="lst_repos"></ol> | |
<script> | |
function htmlEntities(str) { | |
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | |
} | |
var ul = document.getElementById("lst_repos"); | |
fetch("https://api.github.com/users/dinhanhthi/starred?page=1&per_page=10000") | |
.then(response => response.json()) | |
.then(data => { | |
data.forEach(obj => { | |
let li = document.createElement("li"); | |
let a = document.createElement("a"); | |
a.href = obj.html_url; | |
a.innerHTML = obj.full_name; | |
li.appendChild(a); | |
let span = document.createElement("span"); | |
span.innerHTML = ' — ' + htmlEntities(obj.description); | |
li.appendChild(span); | |
ul.appendChild(li); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment