117 lines
4.3 KiB
HTML
117 lines
4.3 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 id="search-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 id="search-input" name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" autocomplete="off" />
|
|
|
|
{{ if eq .ActiveCard "stores" }}
|
|
<div class="cards" id="stores">
|
|
{{ $T := .DiyHrtTarget }}
|
|
{{range $Store := .Stores }}
|
|
<a target="{{ $T }}" href="{{ $Store.Url }}" class="card">
|
|
<h3>{{ $Store.Name }}</h3>
|
|
</a>
|
|
{{- end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ if eq .ActiveCard "listings" }}
|
|
<div class="cards" id="listings">
|
|
{{ $T := .DiyHrtTarget }}
|
|
{{range $Listing := .Listings }}
|
|
<a target="{{ $T }}" href="{{ $Listing.Url }}" class="card {{ if $Listing.InStock }}in-stock{{ end }}">
|
|
<h3>{{ $Listing.ProductName }}</h3>
|
|
<p>{{ $Listing.StoreName }} - {{ $Listing.Price }} {{ $Listing.PriceCurrency }}</p>
|
|
</a>
|
|
{{- end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ if eq .ActiveCard "websites" }}
|
|
<div class="cards" id="websites">
|
|
{{ $T := .WebsiteTarget }}
|
|
{{range $Website := .Websites }}
|
|
<a href="{{ $Website.Url }}" class="card" target="{{ $T }}">
|
|
<h3>{{ $Website.Name }}</h3>
|
|
<img class="card-image" src="{{ $Website.ImageUrl }}" alt="{{ $Website.Name }} picture">
|
|
</a>
|
|
{{- end }}
|
|
</div>
|
|
{{ end }}
|
|
</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() {
|
|
Array.from(document.querySelectorAll('input')).forEach(element => {
|
|
element.focus();
|
|
})
|
|
});
|
|
|
|
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>
|
|
|
|
<script src="scripts/search.js"></script>
|
|
</body>
|
|
</html>
|