You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmftools/bookscraper/templates/result.html

143 lines
3.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8" />
<title>BookScraper Resultaat</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 30px;
max-width: 900px;
margin: auto;
}
h1 {
margin-bottom: 10px;
}
.box {
padding: 15px;
border: 1px solid #ddd;
background: #f8f8f8;
border-radius: 6px;
margin-bottom: 20px;
}
.logbox {
background: #000;
color: #0f0;
padding: 12px;
height: 70vh;
overflow-y: auto;
font-family: monospace;
border-radius: 6px;
font-size: 13px;
}
#clearLogBtn {
margin-bottom: 10px;
padding: 8px 16px;
background: #777;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
}
#clearLogBtn:hover {
background: #555;
}
#abortBtn {
padding: 12px 20px;
background: #d9534f;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
margin-top: 10px;
}
#abortBtn:hover {
background: #c9302c;
}
#statusLine {
font-size: 18px;
font-weight: bold;
}
.hidden {
display: none;
}
</style>
</head>
<body>
<a href="/">&larr; Terug</a>
<h1>Scrape Resultaat</h1>
{% if error %}
<div
class="box"
style="background: #ffdddd; border-left: 5px solid #ff4444"
>
<strong>Fout:</strong> {{ error }}
</div>
{% endif %}
{% if message %}
<div class="box">{{ message }}</div>
{% endif %}
<!-- COVER -->
{% if book_title %}
<div class="box">
<strong>Cover:</strong><br />
<img
src="/output/{{ book_title }}/cover.jpg"
alt="Cover"
style="
margin-top: 10px;
max-width: 250px;
border: 1px solid #ccc;
border-radius: 4px;
"
onerror="this.style.display='none'"
/>
</div>
{% endif %}
<div id="statusBox" class="box hidden">
<div id="statusLine">Status: bezig…</div>
<div id="progressText"></div>
<button id="abortBtn" class="hidden">ABORT</button>
</div>
<!-- FAILED LIST -->
<div
id="failedBox"
class="box hidden"
style="background: #ffefef; border-left: 5px solid #cc0000"
>
<strong>Mislukte hoofdstukken:</strong>
<ul id="failedList" style="margin-top: 10px"></ul>
</div>
<div class="box">
<strong>Live log:</strong><br />
<button id="clearLogBtn" onclick="clearLogs()">Clear logs</button>
<div id="logbox" class="logbox"></div>
</div>
<script>
// komt terug van Celery-scraping task
const scrapingTaskId = "{{ scraping_task_id or '' }}";
let bookIdx = null;
let polling = true;
if (scrapingTaskId) pollForBookIdx();
// -----------------------------------------------------
// Vraag Celery-result op, wacht tot de scraper een book_idx teruggeeft
// -----------------------------------------------------
function pollForBookIdx() {
fetch(`/celery-result/${scrapingTask