fix(core): resolve syntax errors in v1.1.0 preventing load (v1.1.1)

This commit is contained in:
2026-02-16 19:00:43 +01:00
parent d6a2236a5b
commit d82dd31bed
7 changed files with 1585 additions and 1580 deletions

View File

@@ -1,3 +1,6 @@
## v1.1.1 (2026-02-16)
- **Fix**: Kritischer Fehler behoben, der das Laden des Wrappers verhinderte. 🐛
## v1.1.0 (2026-02-16)
- **Feature: Bestell-Countdown**: Zeigt 1 Stunde vor Bestellschluss einen roten Countdown an. ⏳
- **Feature: Smart Highlights**: Markiere deine Lieblingsspeisen (z.B. "Schnitzel", "Vegetarisch"), damit sie leuchten. 🌟

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

16
dist/install.html vendored

File diff suppressed because one or more lines are too long

View File

@@ -1417,7 +1417,7 @@ body {
<div class="brand">
<span class="material-icons-round logo-icon">restaurant_menu</span>
<div class="header-left">
<h1>Kantinen Übersicht <small style="font-size: 0.6em; opacity: 0.7; font-weight: 400;">v1.1.0</small></h1>
<h1>Kantinen Übersicht <small style="font-size: 0.6em; opacity: 0.7; font-weight: 400;">v1.1.1</small></h1>
<div id="last-updated-subtitle" class="subtitle"></div>
</div>
</div>
@@ -2002,7 +2002,6 @@ body {
}
// Refresh menu data to update UI
loadMenuDataFromAPI();
break; // One refresh is enough
}
}
} catch (err) {
@@ -2011,17 +2010,18 @@ body {
await new Promise(r => setTimeout(r, 200));
}
}
}
// === Highlight Management ===
let highlightTags = JSON.parse(localStorage.getItem('kantine_highlightTags') || '[]');
function saveHighlightTags() {
function saveHighlightTags() {
localStorage.setItem('kantine_highlightTags', JSON.stringify(highlightTags));
renderVisibleWeeks(); // Refresh UI to apply changes
updateNextWeekBadge();
}
}
function addHighlightTag(tag) {
function addHighlightTag(tag) {
tag = tag.trim().toLowerCase();
if (tag && !highlightTags.includes(tag)) {
highlightTags.push(tag);
@@ -2029,14 +2029,14 @@ body {
return true;
}
return false;
}
}
function removeHighlightTag(tag) {
function removeHighlightTag(tag) {
highlightTags = highlightTags.filter(t => t !== tag);
saveHighlightTags();
}
}
function renderTagsList() {
function renderTagsList() {
const list = document.getElementById('tags-list');
list.innerHTML = '';
highlightTags.forEach(tag => {
@@ -2053,28 +2053,28 @@ body {
renderTagsList();
});
});
}
}
function checkHighlight(text) {
function checkHighlight(text) {
if (!text) return false;
text = text.toLowerCase();
return highlightTags.some(tag => text.includes(tag));
}
}
// === Local Menu Cache (localStorage) ===
const CACHE_KEY = 'kantine_menuCache';
const CACHE_TS_KEY = 'kantine_menuCacheTs';
// === Local Menu Cache (localStorage) ===
const CACHE_KEY = 'kantine_menuCache';
const CACHE_TS_KEY = 'kantine_menuCacheTs';
function saveMenuCache() {
function saveMenuCache() {
try {
localStorage.setItem(CACHE_KEY, JSON.stringify(allWeeks));
localStorage.setItem(CACHE_TS_KEY, new Date().toISOString());
} catch (e) {
console.warn('Failed to cache menu data:', e);
}
}
}
function loadMenuCache() {
function loadMenuCache() {
try {
const cached = localStorage.getItem(CACHE_KEY);
const cachedTs = localStorage.getItem(CACHE_TS_KEY);
@@ -2092,10 +2092,10 @@ body {
console.warn('Failed to load cached menu:', e);
}
return false;
}
}
// === Menu Data Fetching (Direct from Bessa API) ===
async function loadMenuDataFromAPI() {
// === Menu Data Fetching (Direct from Bessa API) ===
async function loadMenuDataFromAPI() {
const loading = document.getElementById('loading');
const progressModal = document.getElementById('progress-modal');
const progressFill = document.getElementById('progress-fill');
@@ -2288,10 +2288,10 @@ body {
} finally {
loading.classList.add('hidden');
}
}
}
// === Last Updated Display ===
function updateLastUpdatedTime(isoTimestamp) {
// === Last Updated Display ===
function updateLastUpdatedTime(isoTimestamp) {
const subtitle = document.getElementById('last-updated-subtitle');
if (!isoTimestamp) return;
try {
@@ -2302,10 +2302,10 @@ body {
} catch (e) {
subtitle.textContent = '';
}
}
}
// === Toast Notification ===
function showToast(message, type = 'info') {
// === Toast Notification ===
function showToast(message, type = 'info') {
let container = document.getElementById('toast-container');
if (!container) {
container = document.createElement('div');
@@ -2322,10 +2322,10 @@ body {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
}
// === Next Week Badge ===
function updateNextWeekBadge() {
// === Next Week Badge ===
function updateNextWeekBadge() {
const btnNextWeek = document.getElementById('btn-next-week');
let nextWeek = currentWeekNumber + 1;
let nextYear = currentYear;
@@ -2407,10 +2407,10 @@ body {
} else if (badge) {
badge.remove();
}
}
}
// === Weekly Cost ===
function updateWeeklyCost(days) {
// === Weekly Cost ===
function updateWeeklyCost(days) {
let totalCost = 0;
if (days && days.length > 0) {
days.forEach(day => {
@@ -2432,10 +2432,10 @@ body {
} else {
costDisplay.classList.add('hidden');
}
}
}
// === Render Weeks ===
function renderVisibleWeeks() {
// === Render Weeks ===
function renderVisibleWeeks() {
const menuContainer = document.getElementById('menu-container');
if (!menuContainer) return;
menuContainer.innerHTML = '';
@@ -2493,10 +2493,10 @@ body {
menuContainer.appendChild(grid);
setTimeout(() => syncMenuItemHeights(grid), 0);
}
}
// === Sync Item Heights ===
function syncMenuItemHeights(grid) {
// === Sync Item Heights ===
function syncMenuItemHeights(grid) {
const cards = grid.querySelectorAll('.menu-card');
if (cards.length === 0) return;
let maxItems = 0;
@@ -2516,10 +2516,10 @@ body {
});
itemsAtPos.forEach(item => { item.style.height = `${maxHeight}px`; });
}
}
}
// === Create Day Card ===
function createDayCard(day) {
// === Create Day Card ===
function createDayCard(day) {
if (!day.items || day.items.length === 0) return null;
const card = document.createElement('div');
@@ -2746,10 +2746,10 @@ body {
card.appendChild(body);
return card;
}
}
// === Version Check ===
async function checkForUpdates() {
// === Version Check ===
async function checkForUpdates() {
icon.className = 'update-icon';
icon.href = url;
icon.target = '_blank';
@@ -2758,10 +2758,10 @@ body {
headerTitle.appendChild(icon);
showToast(`Update verfügbar: ${newVersion}`, 'info');
}
}
// === Order Countdown ===
function updateCountdown() {
// === Order Countdown ===
function updateCountdown() {
const now = new Date();
const currentDay = now.getDay();
// Skip weekends (0=Sun, 6=Sat)
@@ -2840,70 +2840,69 @@ body {
} else {
countdownEl.classList.remove('urgent');
}
}
}
function removeCountdown() {
function removeCountdown() {
const el = document.getElementById('order-countdown');
if (el) el.remove();
}
}
// Update countdown every minute
setInterval(updateCountdown, 60000);
// Also update on load
setTimeout(updateCountdown, 1000);
// Update countdown every minute
setInterval(updateCountdown, 60000);
// Also update on load
setTimeout(updateCountdown, 1000);
// === Helpers ===
function getISOWeek(date) {
// === Helpers ===
function getISOWeek(date) {
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
const dayNum = d.getUTCDay() || 7;
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
return Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
}
}
function getWeekYear(d) {
function getWeekYear(d) {
const date = new Date(d.getTime());
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
return date.getFullYear();
}
}
}
function translateDay(englishDay) {
function translateDay(englishDay) {
const map = { Monday: 'Montag', Tuesday: 'Dienstag', Wednesday: 'Mittwoch', Thursday: 'Donnerstag', Friday: 'Freitag', Saturday: 'Samstag', Sunday: 'Sonntag' };
return map[englishDay] || englishDay;
}
}
function escapeHtml(text) {
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text || '';
return div.innerHTML;
}
}
// === Bootstrap ===
injectUI();
bindEvents();
updateAuthUI();
cleanupExpiredFlags();
// === Bootstrap ===
injectUI();
bindEvents();
updateAuthUI();
cleanupExpiredFlags();
// Load cached data first for instant UI, then refresh from API
const hadCache = loadMenuCache();
if (hadCache) {
// Load cached data first for instant UI, then refresh from API
const hadCache = loadMenuCache();
if (hadCache) {
// Hide loading spinner since cache is shown
document.getElementById('loading').classList.add('hidden');
}
loadMenuDataFromAPI();
}
loadMenuDataFromAPI();
// Auto-start polling if already logged in
if (authToken) {
// Auto-start polling if already logged in
if (authToken) {
startPolling();
}
}
// Check for updates
checkForUpdates();
// Check for updates
checkForUpdates();
console.log('Kantine Wrapper loaded ✅');
})();
console.log('Kantine Wrapper loaded ✅');
}) ();
// === Error Modal ===
function showErrorModal(title, htmlContent, btnText, url) {

View File

@@ -651,7 +651,6 @@
}
// Refresh menu data to update UI
loadMenuDataFromAPI();
break; // One refresh is enough
}
}
} catch (err) {
@@ -660,17 +659,18 @@
await new Promise(r => setTimeout(r, 200));
}
}
}
// === Highlight Management ===
let highlightTags = JSON.parse(localStorage.getItem('kantine_highlightTags') || '[]');
function saveHighlightTags() {
function saveHighlightTags() {
localStorage.setItem('kantine_highlightTags', JSON.stringify(highlightTags));
renderVisibleWeeks(); // Refresh UI to apply changes
updateNextWeekBadge();
}
}
function addHighlightTag(tag) {
function addHighlightTag(tag) {
tag = tag.trim().toLowerCase();
if (tag && !highlightTags.includes(tag)) {
highlightTags.push(tag);
@@ -678,14 +678,14 @@
return true;
}
return false;
}
}
function removeHighlightTag(tag) {
function removeHighlightTag(tag) {
highlightTags = highlightTags.filter(t => t !== tag);
saveHighlightTags();
}
}
function renderTagsList() {
function renderTagsList() {
const list = document.getElementById('tags-list');
list.innerHTML = '';
highlightTags.forEach(tag => {
@@ -702,28 +702,28 @@
renderTagsList();
});
});
}
}
function checkHighlight(text) {
function checkHighlight(text) {
if (!text) return false;
text = text.toLowerCase();
return highlightTags.some(tag => text.includes(tag));
}
}
// === Local Menu Cache (localStorage) ===
const CACHE_KEY = 'kantine_menuCache';
const CACHE_TS_KEY = 'kantine_menuCacheTs';
// === Local Menu Cache (localStorage) ===
const CACHE_KEY = 'kantine_menuCache';
const CACHE_TS_KEY = 'kantine_menuCacheTs';
function saveMenuCache() {
function saveMenuCache() {
try {
localStorage.setItem(CACHE_KEY, JSON.stringify(allWeeks));
localStorage.setItem(CACHE_TS_KEY, new Date().toISOString());
} catch (e) {
console.warn('Failed to cache menu data:', e);
}
}
}
function loadMenuCache() {
function loadMenuCache() {
try {
const cached = localStorage.getItem(CACHE_KEY);
const cachedTs = localStorage.getItem(CACHE_TS_KEY);
@@ -741,10 +741,10 @@
console.warn('Failed to load cached menu:', e);
}
return false;
}
}
// === Menu Data Fetching (Direct from Bessa API) ===
async function loadMenuDataFromAPI() {
// === Menu Data Fetching (Direct from Bessa API) ===
async function loadMenuDataFromAPI() {
const loading = document.getElementById('loading');
const progressModal = document.getElementById('progress-modal');
const progressFill = document.getElementById('progress-fill');
@@ -937,10 +937,10 @@
} finally {
loading.classList.add('hidden');
}
}
}
// === Last Updated Display ===
function updateLastUpdatedTime(isoTimestamp) {
// === Last Updated Display ===
function updateLastUpdatedTime(isoTimestamp) {
const subtitle = document.getElementById('last-updated-subtitle');
if (!isoTimestamp) return;
try {
@@ -951,10 +951,10 @@
} catch (e) {
subtitle.textContent = '';
}
}
}
// === Toast Notification ===
function showToast(message, type = 'info') {
// === Toast Notification ===
function showToast(message, type = 'info') {
let container = document.getElementById('toast-container');
if (!container) {
container = document.createElement('div');
@@ -971,10 +971,10 @@
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
}
// === Next Week Badge ===
function updateNextWeekBadge() {
// === Next Week Badge ===
function updateNextWeekBadge() {
const btnNextWeek = document.getElementById('btn-next-week');
let nextWeek = currentWeekNumber + 1;
let nextYear = currentYear;
@@ -1056,10 +1056,10 @@
} else if (badge) {
badge.remove();
}
}
}
// === Weekly Cost ===
function updateWeeklyCost(days) {
// === Weekly Cost ===
function updateWeeklyCost(days) {
let totalCost = 0;
if (days && days.length > 0) {
days.forEach(day => {
@@ -1081,10 +1081,10 @@
} else {
costDisplay.classList.add('hidden');
}
}
}
// === Render Weeks ===
function renderVisibleWeeks() {
// === Render Weeks ===
function renderVisibleWeeks() {
const menuContainer = document.getElementById('menu-container');
if (!menuContainer) return;
menuContainer.innerHTML = '';
@@ -1142,10 +1142,10 @@
menuContainer.appendChild(grid);
setTimeout(() => syncMenuItemHeights(grid), 0);
}
}
// === Sync Item Heights ===
function syncMenuItemHeights(grid) {
// === Sync Item Heights ===
function syncMenuItemHeights(grid) {
const cards = grid.querySelectorAll('.menu-card');
if (cards.length === 0) return;
let maxItems = 0;
@@ -1165,10 +1165,10 @@
});
itemsAtPos.forEach(item => { item.style.height = `${maxHeight}px`; });
}
}
}
// === Create Day Card ===
function createDayCard(day) {
// === Create Day Card ===
function createDayCard(day) {
if (!day.items || day.items.length === 0) return null;
const card = document.createElement('div');
@@ -1395,10 +1395,10 @@
card.appendChild(body);
return card;
}
}
// === Version Check ===
async function checkForUpdates() {
// === Version Check ===
async function checkForUpdates() {
icon.className = 'update-icon';
icon.href = url;
icon.target = '_blank';
@@ -1407,10 +1407,10 @@
headerTitle.appendChild(icon);
showToast(`Update verfügbar: ${newVersion}`, 'info');
}
}
// === Order Countdown ===
function updateCountdown() {
// === Order Countdown ===
function updateCountdown() {
const now = new Date();
const currentDay = now.getDay();
// Skip weekends (0=Sun, 6=Sat)
@@ -1489,70 +1489,69 @@
} else {
countdownEl.classList.remove('urgent');
}
}
}
function removeCountdown() {
function removeCountdown() {
const el = document.getElementById('order-countdown');
if (el) el.remove();
}
}
// Update countdown every minute
setInterval(updateCountdown, 60000);
// Also update on load
setTimeout(updateCountdown, 1000);
// Update countdown every minute
setInterval(updateCountdown, 60000);
// Also update on load
setTimeout(updateCountdown, 1000);
// === Helpers ===
function getISOWeek(date) {
// === Helpers ===
function getISOWeek(date) {
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
const dayNum = d.getUTCDay() || 7;
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
return Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
}
}
function getWeekYear(d) {
function getWeekYear(d) {
const date = new Date(d.getTime());
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
return date.getFullYear();
}
}
}
function translateDay(englishDay) {
function translateDay(englishDay) {
const map = { Monday: 'Montag', Tuesday: 'Dienstag', Wednesday: 'Mittwoch', Thursday: 'Donnerstag', Friday: 'Freitag', Saturday: 'Samstag', Sunday: 'Sonntag' };
return map[englishDay] || englishDay;
}
}
function escapeHtml(text) {
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text || '';
return div.innerHTML;
}
}
// === Bootstrap ===
injectUI();
bindEvents();
updateAuthUI();
cleanupExpiredFlags();
// === Bootstrap ===
injectUI();
bindEvents();
updateAuthUI();
cleanupExpiredFlags();
// Load cached data first for instant UI, then refresh from API
const hadCache = loadMenuCache();
if (hadCache) {
// Load cached data first for instant UI, then refresh from API
const hadCache = loadMenuCache();
if (hadCache) {
// Hide loading spinner since cache is shown
document.getElementById('loading').classList.add('hidden');
}
loadMenuDataFromAPI();
}
loadMenuDataFromAPI();
// Auto-start polling if already logged in
if (authToken) {
// Auto-start polling if already logged in
if (authToken) {
startPolling();
}
}
// Check for updates
checkForUpdates();
// Check for updates
checkForUpdates();
console.log('Kantine Wrapper loaded ✅');
})();
console.log('Kantine Wrapper loaded ✅');
}) ();
// === Error Modal ===
function showErrorModal(title, htmlContent, btnText, url) {

View File

@@ -1 +1 @@
v1.1.0
v1.1.1