added home button

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-01-04 00:25:16 +01:00
parent 80f0c6f9df
commit fbd9b6f6f3
2 changed files with 14 additions and 0 deletions

View File

@@ -169,4 +169,7 @@ table#eventlist{
} }
.eventlist tr:nth-child(4n) { .eventlist tr:nth-child(4n) {
background: khaki; background: khaki;
}
.home{
float:left;
} }

View File

@@ -16,6 +16,10 @@ function attachmentList(json){
} }
} }
function goHome(){
window.location.href = '/';
}
async function handleEventData(response){ async function handleEventData(response){
if (response.ok){ if (response.ok){
var event = await response.json(); var event = await response.json();
@@ -52,6 +56,13 @@ function loadEventData(){
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
var id = urlParams.get('id'); var id = urlParams.get('id');
if (id) fetch('/api/event?id='+id).then(handleEventData); if (id) fetch('/api/event?id='+id).then(handleEventData);
if (window.self == window.top){
var btn = document.createElement('button');
btn.innerHTML = '⌂ home';
btn.onclick = goHome;
btn.setAttribute('class','home');
element('buttons').appendChild(btn);
}
} }
async function handleDeleted(response){ async function handleDeleted(response){