From 7f8fb190c3fbb9e98065ccfe0d7d6836fb717ac0 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sat, 15 Aug 2026 17:10:41 +0200 Subject: [PATCH] Show precache progress only while active --- main.inc.php | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/main.inc.php b/main.inc.php index 84301e5..b9df6c7 100644 --- a/main.inc.php +++ b/main.inc.php @@ -1,7 +1,7 @@ +(function(){ + 'use strict'; + function init(){ + var box=document.querySelector('[data-precache-progress]'); + if(!box)return; + var title=box.querySelector('[data-precache-title]'); + box.style.display='none'; + function update(){ + var text=title?title.textContent:''; + var visible=box.classList.contains('is-queued')||box.classList.contains('is-error')||text==='Precache läuft'; + box.style.display=visible?'':'none'; + } + update(); + new MutationObserver(update).observe(box,{subtree:true,childList:true,characterData:true,attributes:true,attributeFilter:['class']}); + } + if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init);}else{init();} +})(); + +HTML; + + $template->append('footer_elements', $script); +}