function create(type){ return document.createElement(type); } function getTags(){ const params = query(); return params.get('tags'); } async function handleData(response){ if (response.ok){ var json = await response.json(); var tags = getTags(); if (!tags) showcase(json); var list = tag('eventlist'); for (var event of json){ var div = create('div'); div.innerHTML = event.description; div.setAttribute('class','event'); if (event.attachments){ for (var attachment of event.attachments){ if (attachment.mime.startsWith('image')){ var img = create('img'); img.src = attachment.url; div.prepend(img); break; } } } var h4 = create('h4'); h4.innerHTML = event.url ? `${event.title}` : event.title; div.prepend(h4); eventlist.appendChild(div); } } } function hide(id){ var elem = tag(id); elem.style.display = 'none'; } function load(){ var tags = getTags(); if (!tags) { tags = 'schwarzesjena'; } else { hide('showcase'); tag('eventlist').innerHTML = "