From 64ac91a383c82e4be5a6d4fad52e789ee3d41dcb Mon Sep 17 00:00:00 2001 From: grgr Date: Mon, 9 May 2022 02:02:49 +0200 Subject: [PATCH] create key index funct --- contents.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/contents.js b/contents.js index 5b71aff..0efb915 100644 --- a/contents.js +++ b/contents.js @@ -59,18 +59,20 @@ function createIndexSection(contribution) { let table = document.createElement("table"); let title = document.createElement("h4"); title.innerHTML = contribution.title; - contribution.audio.forEach((track) => { - console.log(track); - // let row = document.createElement("tr"); - // let col1 = document.createElement("td"); - // let col2 = document.createElement("td"); - // col1.setAttribute("class", "symbol"); - // col2.setAttribute("class", "filename"); - // col2.innerHTML = track; - // row.appendChild(col1); - // row.appendChild(col2); - // table.appendChild(row); - }); + if (contribution.audio){ + let tracks = contribution.audio; + tracks.forEach((track) => { + let row = document.createElement("tr"); + let col1 = document.createElement("td"); + let col2 = document.createElement("td"); + col1.setAttribute("class", "symbol"); + col2.setAttribute("class", "filename"); + col2.innerHTML = track; + row.appendChild(col1); + row.appendChild(col2); + table.appendChild(row); + }); + } trackList.appendChild(title); trackList.appendChild(table); }