diff --git a/borgweb/borg/static/borg/js/index.js b/borgweb/borg/static/borg/js/index.js index 8e2b59d..36434fc 100644 --- a/borgweb/borg/static/borg/js/index.js +++ b/borgweb/borg/static/borg/js/index.js @@ -12,32 +12,38 @@ function colourRepo(repo_json, label, container_id) { $(container_id).find(repoLabel).addClass(bg_class); } - -window.addEventListener("DOMContentLoaded", function () { +function stringRequests() { $('[data-json-string-request]').each(function (index, element) { $.getJSON($(this).attr("data-json-string-request"), function (data) { - console.log(index); $(element).html(data['data']); }) }); +} -}, false); - -window.addEventListener("DOMContentLoaded", function () { +function colourRepos() { const container = $('#repo-container'); - $.getJSON(`/repo-list.json`, function (repo_list) { repo_list.labels.forEach(function (repo_label) { $.getJSON(`/repo/${repo_label}.json`, function (repo_json) { colourRepo(repo_json, repo_label, container); }) + }); + }) +} +function createGraphs() { + $.getJSON(`/repo-list.json`, function (repo_list) { + repo_list.labels.forEach(function (repo_label) { $.getJSON(`/repo/${repo_label}/monthly-size.json`, function (repo_size_json) { draw_time_series_graph(`repo-${repo_label}-size-graph`, repo_size_json.repo, repo_size_json.dates, repo_size_json.units); }) - }); }) +} +window.addEventListener("DOMContentLoaded", function () { + setTimeout(createGraphs, 0); + setTimeout(colourRepos, 0); + setTimeout(stringRequests, 0); }, false);