From 614f498d116b0ba5f8e877ca89ef9eb33df83f0a Mon Sep 17 00:00:00 2001 From: Kantine Wrapper Date: Thu, 26 Feb 2026 10:01:17 +0100 Subject: [PATCH] fix: defer favicon injection with setTimeout for htmlpreview compat (v1.4.29) --- build-bookmarklet.sh | 17 ++++++++++------- changelog.md | 3 +++ version.txt | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build-bookmarklet.sh b/build-bookmarklet.sh index b0bc38b..847b8ed 100755 --- a/build-bookmarklet.sh +++ b/build-bookmarklet.sh @@ -243,13 +243,16 @@ $CHANGELOG_HTML EOF cat >> "$DIST_DIR/install.html" << INSTALLEOF - // Dynamic favicon injection (overrides proxy defaults like htmlpreview.github.io) - document.querySelectorAll('link[rel*="icon"]').forEach(function(el) { el.remove(); }); - var fi = document.createElement('link'); - fi.rel = 'icon'; - fi.type = 'image/png'; - fi.href = '$FAVICON_URL'; - document.head.appendChild(fi); + // Dynamic favicon injection — setTimeout ensures it runs AFTER + // htmlpreview.github.io's document.write() processing completes + setTimeout(function() { + document.querySelectorAll('link[rel*="icon"]').forEach(function(el) { el.remove(); }); + var fi = document.createElement('link'); + fi.rel = 'icon'; + fi.type = 'image/png'; + fi.href = '$FAVICON_URL'; + document.head.appendChild(fi); + }, 0); document.getElementById('bookmarklet-link').textContent = 'Kantine $VERSION'; diff --git a/changelog.md b/changelog.md index 59e0edf..0f8f3cd 100755 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## v1.4.29 +- 🐛 **Bugfix**: Favicon-Injection in `install.html` mit `setTimeout(0)` verzögert, sodass sie nach dem `document.write()` von htmlpreview.github.io läuft. Chrome erkennt Favicon-Änderungen erst im nächsten Event-Loop-Tick. + ## v1.4.28 - 🎨 **Favicon**: Eigenes Favicon-Design aus `favicon_base.png` (2048x2048) auf 32x32 skaliert. Wird beim Build automatisch als PNG-Data-URI in Bookmarklet und Installer injiziert. diff --git a/version.txt b/version.txt index a5422ad..554a63d 100755 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v1.4.28 +v1.4.29