1
0
This commit is contained in:
matt
2025-05-29 17:25:43 +02:00
parent c8efa989e3
commit 3fd41ac1f2

View File

@ -1,188 +1,234 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Tauche ein in die wunderbare Welt der Kulinarik und entdecke köstliche Rezepte."> <title>Suche auf der Website</title>
<title>so.mach.ich.das | Recipes</title> <style>
<style> .search {
/* Grundlegendes Styling */ display: flex;
body { align-items: center;
font-family: system-ui, sans-serif; gap: 10px;
margin: 0; margin-bottom: 20px;
padding: 0; }
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
background-color: white;
}
/* Header */ .search__input {
header { font-family: inherit;
display: flex; font-size: inherit;
justify-content: space-between; background-color: #f4f2f2;
align-items: center; border: none;
width: 100%; color: #646464;
padding: 20px; padding: 0.7rem 1rem;
max-width: 1200px; border-radius: 30px;
flex-wrap: wrap; width: 12em;
} transition: all ease-in-out .5s;
}
nav { .search__input:hover,
display: flex; .search__input:focus {
gap: 20px; box-shadow: 0 0 1em #00000013;
} outline: none;
}
h1 { .search__button {
margin: 0; border: none;
font-size: 1.8em; background-color: #f4f2f2;
} padding: 0.6rem;
border-radius: 50%;
cursor: pointer;
}
a { .search__icon {
text-decoration: none; height: 1.3em;
color: black; width: 1.3em;
} fill: #b4b4b4;
}
/* Social Links (links positioniert) */ .highlight {
.social-links { background-color: yellow;
display: flex; border-radius: 3px;
gap: 10px; }
align-items: center;
}
.social-links a { .highlight.active {
font-size: 1.5em; background-color: orange;
} }
/* Grundlegendes Styling */
/* Ladebildschirm */ body {
.loading-overlay { font-family: system-ui, sans-serif;
position: fixed; margin: 0;
top: 0; padding: 0;
left: 0; display: flex;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.spinner {
width: 50px;
height: 50px;
border: 5px solid rgba(0, 0, 0, 0.1);
border-top: 5px solid black;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Inhalt */
.content {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
text-align: center;
width: 100%;
max-width: 1200px;
padding: 20px;
box-sizing: border-box;
}
.text, .image {
flex: 1;
width: 100%;
text-align: center;
}
.image img {
max-width: 100%;
height: auto;
border-radius: 8px;
}
.divider {
width: 100%;
height: 2px;
background-color: black;
margin: 20px 0;
}
/* Karte */
.card {
max-width: 300px;
background: white;
color: black;
border: 1px solid #dbdce0;
padding: 25px;
box-shadow: 8px 8px 0 rgba(32,33,37,.1);
transition: box-shadow .5s, transform .5s;
border-radius: 8px;
display: inline-block;
margin: 10px;
}
.card:hover {
transform: translate(-2px, -4px);
box-shadow: 16px 16px 0 rgba(32,33,37,.06);
}
.card img {
max-width: 100%;
height: auto;
}
.card .title {
font-weight: bold;
margin-top: 1.5em;
}
.card .description {
line-height: 1.5em;
}
.card a {
color: #1967d2;
font-size: .8em;
font-weight: 600;
}
/* Responsives Design */
@media (max-width: 768px) {
header {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
background-color: white;
} }
.social-links { /* Header */
header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%; width: 100%;
justify-content: center; padding: 20px;
margin-top: 10px; max-width: 1200px;
flex-wrap: wrap;
} }
.content { nav {
flex-direction: column; display: flex;
gap: 20px;
}
h1 {
margin: 0;
font-size: 1.8em;
}
a {
text-decoration: none;
color: black;
}
/* Social Links (links positioniert) */
.social-links {
display: flex;
gap: 10px;
align-items: center; align-items: center;
} }
.text, .image { .social-links a {
width: 100%; font-size: 1.5em;
} }
.card { /* Ladebildschirm */
max-width: 90%; .loading-overlay {
margin: 10px 0; position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
} }
}
</style> .spinner {
width: 50px;
height: 50px;
border: 5px solid rgba(0, 0, 0, 0.1);
border-top: 5px solid black;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Inhalt */
.content {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
text-align: center;
width: 100%;
max-width: 1200px;
padding: 20px;
box-sizing: border-box;
}
.text, .image {
flex: 1;
width: 100%;
text-align: center;
}
.image img {
max-width: 100%;
height: auto;
border-radius: 8px;
}
.divider {
width: 100%;
height: 2px;
background-color: black;
margin: 20px 0;
}
/* Karte */
.card {
max-width: 300px;
background: white;
color: black;
border: 1px solid #dbdce0;
padding: 25px;
box-shadow: 8px 8px 0 rgba(32,33,37,.1);
transition: box-shadow .5s, transform .5s;
border-radius: 8px;
display: inline-block;
margin: 10px;
}
.card:hover {
transform: translate(-2px, -4px);
box-shadow: 16px 16px 0 rgba(32,33,37,.06);
}
.card img {
max-width: 100%;
height: auto;
}
.card .title {
font-weight: bold;
margin-top: 1.5em;
}
.card .description {
line-height: 1.5em;
}
.card a {
color: #1967d2;
font-size: .8em;
font-weight: 600;
}
/* Responsives Design */
@media (max-width: 768px) {
header {
flex-direction: column;
align-items: center;
text-align: center;
}
.social-links {
width: 100%;
justify-content: center;
margin-top: 10px;
}
.content {
flex-direction: column;
align-items: center;
}
.text, .image {
width: 100%;
}
.card {
max-width: 90%;
margin: 10px 0;
}
}
</style>
</head> </head>
<body> <body>
<header> <header>
@ -207,19 +253,100 @@
<br> <br>
<br> <br>
<article class="card"> <div class="search">
<img src="johannesbeeressig.png" width="100%" alt="Johannesbeeressig"> <input type="text" id="searchInput" class="search__input" placeholder="Suchbegriff eingeben">
<h3 class="title">Johannesbeeressig</h3> <button class="search__button" onclick="highlightSearch()">
<p class="description">Verleihe deinem Salat eine außergewöhnliche Note mit selbstgemachtem Johannisbeeressig.</p> <svg class="search__icon" viewBox="0 0 24 24">
<a href="/Johannesbeeressig/" class="link">See the recipe</a> <path d="M21.53 20.47l-3.66-3.66C19.195 15.24 20 13.214 20 11c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.215 0 4.24-.804 5.808-2.13l3.66 3.66c.147.146.34.22.53.22s.385-.073.53-.22c.295-.293.295-.767.002-1.06zM3.5 11c0-4.135 3.365-7.5 7.5-7.5s7.5 3.365 7.5 7.5-3.365 7.5-7.5 7.5-7.5-3.365-7.5-7.5z"/>
</article> </svg>
</main> </button>
<button onclick="navigateMatches(-1)">⬆️</button>
<button onclick="navigateMatches(1)">⬇️</button>
</div>
<script> <br>
// Funktion, die die Ladeanimation nach dem Laden der Seite ausblendet <br>
window.onload = function() { <div id="content">
document.querySelector('.loading-overlay').style.display = 'none'; <article class="card">
}; <img src="johannesbeeressig.png" width="100%" alt="Johannesbeeressig">
</script> <h3 class="title">Johannesbeeressig</h3>
<p class="description">Verleihe deinem Salat eine außergewöhnliche Note mit selbstgemachtem Johannisbeeressig.</p>
<a href="/Johannesbeeressig/" class="link">See the recipe</a>
</article>
</div>
<script>
let currentMatch = -1;
let matches = [];
function clearHighlights() {
matches.forEach(span => {
const parent = span.parentNode;
parent.replaceChild(document.createTextNode(span.textContent), span);
parent.normalize();
});
matches = [];
currentMatch = -1;
}
function highlightSearch() {
clearHighlights();
const searchInput = document.getElementById("searchInput");
const searchTerm = searchInput.value.trim().toLowerCase();
if (!searchTerm) return;
const content = document.getElementById("content");
const regex = new RegExp(searchTerm, "gi");
content.innerHTML = content.innerHTML.replace(/(<mark class="highlight.*?">|<\/mark>)/g, '');
const walker = document.createTreeWalker(content, NodeFilter.SHOW_TEXT);
const nodes = [];
while (walker.nextNode()) {
const node = walker.currentNode;
if (node.parentNode && node.nodeValue.toLowerCase().includes(searchTerm)) {
nodes.push(node);
}
}
nodes.forEach(node => {
const spanWrapper = document.createElement('span');
spanWrapper.innerHTML = node.nodeValue.replace(regex, match => `<mark class="highlight">${match}</mark>`);
node.parentNode.replaceChild(spanWrapper, node);
});
matches = Array.from(document.querySelectorAll(".highlight"));
if (matches.length > 0) {
currentMatch = 0;
scrollToCurrent();
}
}
function scrollToCurrent() {
matches.forEach((el, i) => {
el.classList.toggle("active", i === currentMatch);
});
matches[currentMatch].scrollIntoView({ behavior: "smooth", block: "center" });
}
function navigateMatches(direction) {
if (matches.length === 0) return;
currentMatch = (currentMatch + direction + matches.length) % matches.length;
scrollToCurrent();
}
// Optional: Suche mit Enter starten
document.getElementById("searchInput").addEventListener("keydown", e => {
if (e.key === "Enter") highlightSearch();
});
</script>
<script>
// Funktion, die die Ladeanimation nach dem Laden der Seite ausblendet
window.onload = function() {
document.querySelector('.loading-overlay').style.display = 'none';
};
</script>
</body> </body>
</html> </html>