This commit is contained in:
2025-09-11 00:02:38 +02:00
parent e78ea9da35
commit 902c8c52a9
6 changed files with 122 additions and 89 deletions

View File

@@ -33,6 +33,15 @@
const normalize = (s) => (s ?? "").toString().trim().toLowerCase();
const proxify = (url) => url ? `/HelloFresh/ProxyPdf?url=${encodeURIComponent(url)}` : "";
// Détection iOS (iPhone/iPad et iPadOS mode desktop)
const IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.userAgent.includes("Mac") && "ontouchend" in document);
els.btnOpen?.addEventListener("click", () => {
const r = RECIPES[CUR]; if (!r?.pdf) return;
const u = `/HelloFresh/ProxyPdf?url=${encodeURIComponent(r.pdf)}`;
if (IS_IOS) window.open(u, "_blank", "noopener"); else openViewer();
});
function buildPdfSrc(rawUrl) {
if (!rawUrl) return "";