push
This commit is contained in:
90
templates/results.html
Normal file
90
templates/results.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!doctype html>
|
||||
<html lang="cs">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Výsledky pro "{{ query }}" - vontor.cz</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script>
|
||||
function download(fmt) {
|
||||
const payload = { format: fmt, results: JSON.parse(document.getElementById('json-data').textContent) };
|
||||
fetch('/export', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(payload)
|
||||
}).then(r => {
|
||||
if (r.ok) return r.blob();
|
||||
return r.json().then(j=>{throw j});
|
||||
}).then(blob=>{
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'results.' + fmt;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch(e=>{ alert('Export failed: ' + JSON.stringify(e));});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="bg-light min-vh-100 d-flex">
|
||||
<main class="container my-auto py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1 class="h3 mb-0">Výsledky pro "{{ query }}"</h1>
|
||||
<a class="btn btn-outline-secondary" href="/">Nové hledání</a>
|
||||
</div>
|
||||
|
||||
{% if notice %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{{ notice }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card shadow-sm mb-3">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap gap-2 justify-content-between align-items-center">
|
||||
<div class="text-muted">Počet výsledků: <strong>{{ results|length }}</strong></div>
|
||||
<div class="d-flex gap-2">
|
||||
<button class="btn btn-sm btn-outline-primary" onclick="download('json')">Stáhnout JSON</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if results and results|length > 0 %}
|
||||
<ol class="list-group list-group-numbered">
|
||||
|
||||
{% for item in results %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex gap-3 align-items-start">
|
||||
{% if item.icon %}
|
||||
<img src="{{ item.icon }}" alt="" width="20" height="20" class="rounded mt-1" onerror="this.style.display='none'">
|
||||
{% endif %}
|
||||
|
||||
<div class="flex-grow-1">
|
||||
<a class="fw-semibold" href="{{ item.link }}" target="_blank" rel="noopener noreferrer">{{ item.title }}</a>
|
||||
|
||||
{% if r.snippet %}
|
||||
<small class="text-muted d-block">{{ r.snippet }}</small>
|
||||
{% endif %}
|
||||
|
||||
<small class="text-break text-secondary">{{ r.link }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</ol>
|
||||
{% else %}
|
||||
<div class="alert alert-info" role="alert">
|
||||
Žádné položky k zobrazení.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script id="json-data" type="application/json">{{ results|tojson }}</script>
|
||||
</main>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user