articles/helperFns.html
2020-06-26 01:28:05 +05:30

23 lines
749 B
HTML

<script>
(async () => {
let repourl = "https://api.github.com/repos/ranchimall/articles/contents";
let repocontent = null;
let window.articles = {}
repocontent = await (await fetch(repourl)).json();
for (var i = 0; i < repocontent.length; i++) {
if (repocontent[i]['name'] == 'articles') {
var articlefolder = await (await fetch(repocontent[i]['url'])).json()
}
}
for (var i = 0; i < articlefolder.length; i++) {
articlehtml = await (await fetch(articlefolder[i]["download_url"])).text()
articles[articlefolder[i]['name'].slice(0,articlefolder[i]['name'].length - 5)] = articlehtml
}
})();
</script>