function upload_banner(t, hole_name) { postToast(t, `/h/${hole_name}/settings/banners`, { "image": t.files[0] }, (xhr) => { const list = document.getElementById('hole-banners') const url = JSON.parse(xhr.response)['url'] const html = `
/h/${hole_name} banner
` list.insertAdjacentHTML('afterbegin', html); register_new_elements(list); const nobanners = document.getElementById('hole-banner-no-banners') if (nobanners) nobanners.remove() } ); } function upload_sidebar(t, hole_name) { postToast(t, `/h/${hole_name}/settings/sidebars`, { "image": t.files[0] }, (xhr) => { const list = document.getElementById('hole-sidebars') const url = JSON.parse(xhr.response)['url'] const html = `
/h/${hole_name} sidebar
` list.insertAdjacentHTML('afterbegin', html); register_new_elements(list); const nosidebars = document.getElementById('hole-sidebar-no-sidebars') if (nosidebars) nosidebars.remove() } ); } function delete_image(t, url) { postToast(t, url, { "url": t.previousElementSibling.src }, () => { t.parentElement.remove(); } ); }