app promo
This commit is contained in:
@@ -5,11 +5,10 @@ let messageData = {};
|
|||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
initAppUI();
|
initAppUI();
|
||||||
initTabs();
|
initTabs();
|
||||||
|
initAppPromotion();
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
setInterval(loadData, CONFIG.REFRESH_INTERVAL);
|
setInterval(loadData, CONFIG.REFRESH_INTERVAL);
|
||||||
});
|
});
|
||||||
|
|
||||||
function initAppUI() {
|
function initAppUI() {
|
||||||
const fullTitle = `${CONFIG.EVENT_NAME} – Rennplan & Ergebnisse`;
|
const fullTitle = `${CONFIG.EVENT_NAME} – Rennplan & Ergebnisse`;
|
||||||
|
|
||||||
@@ -265,3 +264,56 @@ function formatDateTime(dateString) {
|
|||||||
minute: "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 = `
|
||||||
|
<div class="bg-indigo-50 border border-indigo-200 text-indigo-800 p-4 rounded-xl flex items-center justify-between shadow-sm">
|
||||||
|
<div class="font-medium">
|
||||||
|
Jetzt die Android App herunterladen
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="${playStoreUrl}" target="_blank"
|
||||||
|
class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-indigo-700">
|
||||||
|
Öffnen
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
promo.classList.remove("hidden");
|
||||||
|
}
|
||||||
+4
-1
@@ -5,5 +5,8 @@ const CONFIG = {
|
|||||||
RENNPLAN_URL: "https://api.demo.regattatech.de/api/v1/rennplan/current",
|
RENNPLAN_URL: "https://api.demo.regattatech.de/api/v1/rennplan/current",
|
||||||
MESSAGE_URL: "https://api.demo.regattatech.de/api/v1/message",
|
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"
|
||||||
};
|
};
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="apple-itunes-app" content="app-id=6742361009">
|
||||||
<title></title>
|
<title></title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
|
||||||
@@ -18,6 +19,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<div class="max-w-7xl mx-auto px-4">
|
||||||
|
<div id="app-promo" class="hidden mb-4"></div>
|
||||||
|
</div>
|
||||||
<div class="max-w-7xl mx-auto p-4">
|
<div class="max-w-7xl mx-auto p-4">
|
||||||
|
|
||||||
<div id="message-box" class="hidden mb-4"></div>
|
<div id="message-box" class="hidden mb-4"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user