From 7dd04a84ab530ef572df3b0df4fa444271f78c7e Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 3 Feb 2020 10:22:56 +0100 Subject: Add ability to see description on list.php --- list.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'list.php') diff --git a/list.php b/list.php index b942fa6..90e6084 100644 --- a/list.php +++ b/list.php @@ -55,7 +55,7 @@ foreach ($events as $event){ echo ' to '.date ('j M',strtotime ($event['end_date'])); echo ''; echo ''.htmlspecialchars ($event['location']).''; - echo ''.htmlspecialchars ($event['title']).''; + echo ''.htmlspecialchars ($event['title']).''; foreach ($event['keywords'] as $i => $kw){ if (!is_null ($selected_keywords) && !in_array ($kw,$selected_keywords)) $event['keywords'][$i]=''.htmlspecialchars ($kw).''; @@ -84,6 +84,33 @@ function check_all_keywords (check) return false; } +function expand_or_collapse (elem,id) +{ + if (elem.parentNode.childNodes.length > 1){ + let p=elem.parentNode.childNodes[1]; + p.style.display=p.style.display=='none' ? 'block' : 'none'; + return; + } + + var xhttp=new XMLHttpRequest(); + xhttp.onreadystatechange=function(){ + if (this.readyState!=4) + return; + if (this.status!=200){ + window.alert ('Failed to fetch event information ('+this.status+')'); + return; + } + + let ev=JSON.parse (xhttp.responseText); + let p=document.createElement ('p'); + p.classList.add ('description'); + p.innerHTML=ev.description; + elem.parentNode.appendChild (p); + }; + xhttp.open ('GET','event.php?id='+id,true); + xhttp.send(); +} + update_keywords_field(); checkboxes.map (cb => cb.onchange=update_keywords_field); -- cgit v1.2.3