From f0cc73b80ed05a2e7b06ced78b7066a23aa56607 Mon Sep 17 00:00:00 2001 From: Thies Mueller Date: Sat, 20 Jun 2026 00:59:02 +0200 Subject: [PATCH] app promo --- app.js | 56 +++++++++++++++++++++++++++++++++++++++++++++-- config.example.js | 5 ++++- index.html | 4 ++++ 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 52eca37..4591324 100644 --- a/app.js +++ b/app.js @@ -5,11 +5,10 @@ let messageData = {}; document.addEventListener("DOMContentLoaded", () => { initAppUI(); initTabs(); + initAppPromotion(); loadData(); - setInterval(loadData, CONFIG.REFRESH_INTERVAL); }); - function initAppUI() { const fullTitle = `${CONFIG.EVENT_NAME} – Rennplan & Ergebnisse`; @@ -264,4 +263,57 @@ function formatDateTime(dateString) { hour: "2-digit", minute: "2-digit" }); +} + +function initAppPromotion() { + if (CONFIG.IOS_APP_ID) { + const meta = document.createElement("meta"); + meta.name = "apple-itunes-app"; + meta.content = `app-id=${CONFIG.IOS_APP_ID}`; + document.head.appendChild(meta); + } + renderAndroidPromo(); +} + + +function detectPlatform() { + const ua = navigator.userAgent || navigator.vendor || window.opera || ""; + + const isAndroid = /android/i.test(ua); + + const isIOS = + /iphone|ipad|ipod/i.test(ua) || + (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1); + + return { isAndroid, isIOS, ua }; +} +function renderAndroidPromo() { + const promo = document.getElementById("app-promo"); + if (!promo) return; + + const ua = navigator.userAgent.toLowerCase(); + const isAndroid = /android/.test(ua); + + if (!isAndroid || !CONFIG.ANDROID_PACKAGE_NAME) { + promo.classList.add("hidden"); + return; + } + + const playStoreUrl = + `https://play.google.com/store/apps/details?id=${CONFIG.ANDROID_PACKAGE_NAME}`; + + promo.innerHTML = ` +
+
+ Jetzt die Android App herunterladen +
+ + + Öffnen + +
+ `; + + promo.classList.remove("hidden"); } \ No newline at end of file diff --git a/config.example.js b/config.example.js index 93ce18b..860c60e 100644 --- a/config.example.js +++ b/config.example.js @@ -5,5 +5,8 @@ const CONFIG = { RENNPLAN_URL: "https://api.demo.regattatech.de/api/v1/rennplan/current", MESSAGE_URL: "https://api.demo.regattatech.de/api/v1/message", - REFRESH_INTERVAL: 30000 // 30 Sekunden + REFRESH_INTERVAL: 30000, // 30 Sekunden + + ANDROID_PACKAGE_NAME: "de.regattatech.sat", + IOS_APP_ID: "6742361009" }; \ No newline at end of file diff --git a/index.html b/index.html index 64eb670..84a242f 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ + @@ -18,6 +19,9 @@ +
+ +