function createCorpusElement(corpus) { corpusElement = document.createElement("a"); corpusElement.classList.add("avatar", "collection-item"); corpusElement.dataset.key = "id"; corpusElement.dataset.value = corpus.id; corpusElement.href = `/corpora/${corpus.id}`; corpusDescriptionElement = document.createElement("p"); corpusDescriptionElement.dataset.key = "description"; corpusDescriptionElement.innerText = corpus.description; corpusIconElement = document.createElement("i"); corpusIconElement.classList.add("circle", "material-icons"); corpusIconElement.innerText = "book"; corpusTitleElement = document.createElement("span"); corpusTitleElement.classList.add("title"); corpusTitleElement.dataset.key = "title"; corpusTitleElement.innerText = corpus.title; corpusElement.appendChild(corpusIconElement); corpusElement.appendChild(corpusTitleElement); corpusElement.appendChild(corpusDescriptionElement); return corpusElement; } function createCorpusElements(corpusList) { for (corpus of corpora) { corpusList.list.appendChild(createCorpusElement(corpus)); } corpusList.reIndex(); corpusList.update(); updatePagination(corpusList); }