Review script backup
<script>(function(){
const PROXY = 'https://odd-feather-0fb3.bara-hlavkova.workers.dev/';
const wrap = document.getElementById('heureka-reviews');
fetch(PROXY)
.then(r => r.text())
.then(str => new DOMParser().parseFromString(str, "text/xml"))
.then(xml => {
const reviews = Array.from(xml.querySelectorAll("review")).slice(0, 10);
wrap.innerHTML = reviews.map(r => {
// najdi text recenze – Heureka to může mít v různých tagách
const text =
(r.querySelector("text")?.textContent ||
r.querySelector("comment")?.textContent ||
r.querySelector("summary")?.textContent ||
"").trim();
const author = (r.querySelector("author")?.textContent || "Zákazník Heureka").trim();
const rating = +r.querySelector("rating")?.textContent || 5;
const stars = "★★★★★☆☆☆☆☆".slice(5-rating,10-rating);
return `
<div style="min-width:300px;scroll-snap-align:start;border:1px solid #ddd;border-radius:8px;padding:12px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.05)">
<div style="font-size:14px;color:#f4b400;margin-bottom:4px;">${stars}</div>
<p style="font-size:14px;line-height:1.4;margin:0 0 6px;">„${text || 'Recenze bez textu'}“</p>
<div style="font-size:12px;color:#555;">– ${author}</div>
</div>`;
}).join('');
})
.catch(e => {
wrap.innerHTML = '<p style="text-align:center;">Recenze se nepodařilo načíst.</p>';
console.error(e);
});
})();</script>
