app promo
This commit is contained in:
@@ -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 = `
|
||||
<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");
|
||||
}
|
||||
Reference in New Issue
Block a user