2025-07-10 14:40:26 +02:00

89 lines
3.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ .PageTitle }}</title>
<link rel="stylesheet" type="text/css" href="assets/style.css">
</head>
<body>
<form class="search-grid" action="{{ .SearchFormAction }}">
<div class="search-logo">
<img als="girl_juice" src="assets/girl_juice.png" />
<h2 class="phrases"></h2>
<img als="girl_juice" src="assets/girl_juice.png" />
</div>
<input name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" />
<div class="cards" id="stores">
{{range $Store := .Stores }}
<a target="_blank" href="{{ $Store.Url }}" class="card">
<h3>{{ $Store.Name }}</h3>
</a>
{{- end }}
</div>
<div class="cards" id="listings">
{{range $Listing := .Listings }}
<a target="_blank" href="{{ $Listing.Url }}" class="card">
<h3>{{ $Listing.ProductName }}</h3>
<p>{{ $Listing.StoreName }} - {{ $Listing.Price }}</p>
</a>
{{- end }}
</div>
</form>
<script>
const phrases = [
{{range $Phrase := .HeaderPhrases }}
"{{ $Phrase }}",
{{- end }}
]
function setTitle(element, s, i) {
i++
element.textContent = s.substring(0, i)
if (i >=s.length) return;
setTimeout(() => setTitle(element, s, i), 100);
}
function titleChanger(element) {
setTitle(element, phrases[Math.floor(Math.random()*phrases.length)], 0);
setTimeout(() => titleChanger(element), 10000);
}
Array.from(document.querySelectorAll(".phrases")).forEach(element => {
titleChanger(element);
})
document.addEventListener('DOMContentLoaded', function() {
const marqueeElement = document.body;
let xPosition = 0;
let yPosition = 0;
const xSpeed = {{ .BackgroundScrollX }}; // Adjust speed here (lower is slower)
const ySpeed = {{ .BackgroundScrollY }};
function animateMarquee() {
xPosition -= xSpeed;
yPosition -= ySpeed;
// Reset position when the image has scrolled completely
if (Math.abs(xPosition) >= marqueeElement.offsetWidth) {
xPosition = 0;
}
if (Math.abs(yPosition) >= marqueeElement.offsetHeight) {
yPosition = 0;
}
marqueeElement.style.backgroundPosition = `${xPosition}px ${yPosition}px`;
requestAnimationFrame(animateMarquee);
}
// Start the animation
animateMarquee();
});
</script>
</body>
</html>