Use separate event methods

This commit is contained in:
George Lacey 2022-04-11 08:30:58 +01:00
parent f16a0d5b65
commit b6f204a15e

View File

@ -14,15 +14,18 @@ function colourRepo(repo_json, label, container_id) {
window.addEventListener("DOMContentLoaded", function () { window.addEventListener("DOMContentLoaded", function () {
// todo: inflate each repo and colour background accordingly
const container = $('#repo-container');
$('[data-json-string-request]').each(function (index, element) { $('[data-json-string-request]').each(function (index, element) {
$.getJSON($(this).attr("data-json-string-request"), function (data) { $.getJSON($(this).attr("data-json-string-request"), function (data) {
console.log(index);
$(element).html(data['data']); $(element).html(data['data']);
}) })
}); });
}, false);
window.addEventListener("DOMContentLoaded", function () {
const container = $('#repo-container');
$.getJSON(`/repo-list.json`, function (repo_list) { $.getJSON(`/repo-list.json`, function (repo_list) {
repo_list.labels.forEach(function (repo_label) { repo_list.labels.forEach(function (repo_label) {
$.getJSON(`/repo/${repo_label}.json`, function (repo_json) { $.getJSON(`/repo/${repo_label}.json`, function (repo_json) {