Wycofanie pytania o lokalizacjąna apple.
This commit is contained in:
@@ -195,6 +195,22 @@
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!-- ITEM MODAL -->
|
||||
<div class="modal-overlay" id="itemModal">
|
||||
<div class="modal-content" style="padding: 0; overflow: hidden; max-width: 380px;">
|
||||
<div style="position: relative;">
|
||||
<img id="itemModalImage" src="" style="width: 100%; height: 240px; object-fit: cover; display: block;" alt="">
|
||||
<button class="close-btn" onclick="closeItemModal()" style="position: absolute; top: 10px; right: 15px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.8); font-size: 32px; z-index: 10; background: rgba(0,0,0,0.3); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; line-height: 1;">×</button>
|
||||
</div>
|
||||
<div style="padding: 24px; text-align: left;">
|
||||
<h3 id="itemModalTitle" style="margin-top: 0; color: var(--text-main); font-family: 'Playfair Display', serif; font-size: 24px; margin-bottom: 8px;"></h3>
|
||||
<div id="itemModalPrice" style="color: var(--primary); font-weight: 700; font-size: 20px; margin-bottom: 16px;"></div>
|
||||
<p id="itemModalDesc" style="color: var(--text-muted); font-size: 15px; line-height: 1.6; margin-bottom: 24px;"></p>
|
||||
<button class="btn btn-secondary" onclick="closeItemModal()" style="width: 100%;">Zamknij</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- BILL DIALOG -->
|
||||
<div class="modal-overlay" id="billModal">
|
||||
<div class="modal-content">
|
||||
|
||||
@@ -822,6 +822,7 @@ async function loadMenu() {
|
||||
const response = await fetch('menu.json');
|
||||
if (!response.ok) throw new Error('Nie udało się załadować menu');
|
||||
const menuData = await response.json();
|
||||
window.menuDataRaw = menuData;
|
||||
const container = document.getElementById('menuContainer');
|
||||
if (!container) return;
|
||||
|
||||
@@ -839,7 +840,7 @@ async function loadMenu() {
|
||||
|
||||
category.items.forEach(item => {
|
||||
html += `
|
||||
<div class="rmc-position" data-position="${item.position}" data-category-id="${item.categoryId}">
|
||||
<div class="rmc-position" data-position="${item.position}" data-category-id="${item.categoryId}" onclick="openItemModal('${item.categoryId}', '${item.position}')" style="cursor: pointer;">
|
||||
<img class="rmc-image" src="${item.image}" alt="" loading="lazy">
|
||||
<div class="rmc-title">
|
||||
<h4>${item.title}<span>${item.description}</span></h4>
|
||||
@@ -865,6 +866,41 @@ async function loadMenu() {
|
||||
// Inicjalizacja ładowania menu
|
||||
loadMenu();
|
||||
|
||||
window.openItemModal = function(categoryId, position) {
|
||||
if (!window.menuDataRaw) return;
|
||||
let foundItem = null;
|
||||
for (const cat of window.menuDataRaw) {
|
||||
for (const item of cat.items) {
|
||||
if (item.categoryId == categoryId && item.position == position) {
|
||||
foundItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundItem) break;
|
||||
}
|
||||
|
||||
if (foundItem) {
|
||||
document.getElementById('itemModalImage').src = foundItem.image;
|
||||
document.getElementById('itemModalTitle').textContent = foundItem.title;
|
||||
document.getElementById('itemModalDesc').textContent = foundItem.description;
|
||||
document.getElementById('itemModalPrice').textContent = foundItem.price;
|
||||
|
||||
const modal = document.getElementById('itemModal');
|
||||
if (modal) {
|
||||
modal.classList.add('active');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.closeItemModal = function() {
|
||||
const modal = document.getElementById('itemModal');
|
||||
if (modal) {
|
||||
modal.classList.remove('active');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
};
|
||||
|
||||
window.editCompanyData = function () {
|
||||
const n = document.getElementById("cmpName");
|
||||
const s = document.getElementById("cmpStreet");
|
||||
@@ -944,6 +980,15 @@ function startApp() {
|
||||
}
|
||||
|
||||
window.initGeolocation = function () {
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
||||
if (isIOS) {
|
||||
// Tymczasowo pomijamy weryfikację GPS tylko na urządzeniach Apple
|
||||
// (wymagają bezwzględnie poprawnego certyfikatu HTTPS, inaczej blokują bez pytania)
|
||||
console.warn("Bypassing geolocation on iOS.");
|
||||
startApp();
|
||||
return;
|
||||
}
|
||||
|
||||
const geoScreen = document.getElementById("geoScreen");
|
||||
const loadingScreen = document.getElementById("loadingScreen");
|
||||
const geoMsg = document.getElementById("geoMsg");
|
||||
@@ -986,11 +1031,26 @@ window.initGeolocation = function () {
|
||||
},
|
||||
(error) => {
|
||||
if (error.code === error.PERMISSION_DENIED) {
|
||||
geoMsg.innerHTML = `<b style="color: #ff6b6b;">Nie mamy Twojej zgody na lokalizację.</b><br><br>
|
||||
Przeglądarka zapamiętała Twoją odmowę i nie możemy ponownie wyświetlić okienka z zapytaniem. Aby odblokować dostęp:<br><br>
|
||||
1. Kliknij ikonkę <b>kłódki / ustawień</b> 🔒 🎚️ obok adresu strony na samej górze przeglądarki.<br>
|
||||
2. Znajdź <b>Uprawnienia</b> (Lokalizacja) i zmień z "Zablokuj" na "Zezwalaj".<br>
|
||||
3. Odśwież stronę.`;
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
||||
|
||||
let instructions = '';
|
||||
if (isIOS) {
|
||||
instructions = `<b>Instrukcja dla iPhone (Safari):</b><br>
|
||||
1. Kliknij ikonę <b>"aA"</b> po lewej stronie paska adresu.<br>
|
||||
2. Wybierz <b>"Ustawienia witryny"</b> (Website Settings).<br>
|
||||
3. Zmień opcję <b>"Położenie"</b> (Location) na "Zapytaj" lub "Pozwalaj".<br>
|
||||
4. Odśwież stronę.<br><br>
|
||||
<i>Uwaga: Na urządzeniach Apple lokalizacja działa WYŁĄCZNIE, gdy adres strony zaczyna się od bezpiecznego <b>https://</b>. Jeżeli jesteś na http://, system zablokuje to automatycznie.</i>`;
|
||||
} else {
|
||||
instructions = `<b>Instrukcja dla Android / Chrome:</b><br>
|
||||
1. Kliknij ikonkę <b>kłódki / ustawień</b> 🔒 obok adresu strony na górze przeglądarki.<br>
|
||||
2. Znajdź <b>Uprawnienia</b> (Lokalizacja) i zmień z "Zablokuj" na "Zezwalaj".<br>
|
||||
3. Odśwież stronę.`;
|
||||
}
|
||||
|
||||
geoMsg.innerHTML = `<b style="color: #ff6b6b;">Przeglądarka zablokowała dostęp do lokalizacji.</b><br><br>
|
||||
Bez tego nie możemy zweryfikować, czy jesteś w restauracji.<br><br>
|
||||
${instructions}`;
|
||||
} else {
|
||||
geoMsg.innerHTML = "Nie udało się pobrać lokalizacji. Sprawdź zasięg lub włącz GPS i spróbuj ponownie.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user