UI improvments and backend prefetch
This commit is contained in:
342
web/index.html
342
web/index.html
@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Kleinanzeigen Map Search</title>
|
||||
<title>Kleinanzeigen Karten-Suche</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.css" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.js"></script>
|
||||
<style>
|
||||
@ -17,93 +17,153 @@
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: #1a1a1a;
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: grid;
|
||||
grid-template-columns: 350px 1fr;
|
||||
grid-template-columns: 380px 1fr;
|
||||
grid-template-rows: auto 1fr;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
grid-column: 1 / -1;
|
||||
background: #fff;
|
||||
padding: 15px 20px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
background: #242424;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto auto auto;
|
||||
gap: 12px;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #b0b0b0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.search-bar input, .search-bar select {
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
border: 1px solid #3a3a3a;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
background: #2a2a2a;
|
||||
color: #e0e0e0;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.search-bar input[type="text"] {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
.search-bar input:focus, .search-bar select:focus {
|
||||
outline: none;
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
|
||||
}
|
||||
|
||||
.search-bar input[type="number"] {
|
||||
width: 100px;
|
||||
.price-inputs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.price-inputs input {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.price-separator {
|
||||
color: #666;
|
||||
font-weight: 600;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.search-bar button {
|
||||
padding: 8px 20px;
|
||||
background: #0066cc;
|
||||
padding: 12px 24px;
|
||||
background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
|
||||
}
|
||||
|
||||
.search-bar button:hover:not(:disabled) {
|
||||
background: #0052a3;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
|
||||
}
|
||||
|
||||
.search-bar button:disabled {
|
||||
background: #ccc;
|
||||
background: #3a3a3a;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.search-bar button.cancel {
|
||||
background: #dc3545;
|
||||
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
||||
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.search-bar button.cancel:hover {
|
||||
background: #c82333;
|
||||
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
|
||||
}
|
||||
|
||||
.results-panel {
|
||||
background: #f8f9fa;
|
||||
background: #1e1e1e;
|
||||
overflow-y: auto;
|
||||
border-right: 1px solid #ddd;
|
||||
border-right: 1px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.results-panel::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.results-panel::-webkit-scrollbar-track {
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
.results-panel::-webkit-scrollbar-thumb {
|
||||
background: #3a3a3a;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.results-panel::-webkit-scrollbar-thumb:hover {
|
||||
background: #4a4a4a;
|
||||
}
|
||||
|
||||
.results-header {
|
||||
background: white;
|
||||
padding: 15px 20px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background: #242424;
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #2a2a2a;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.results-count {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 700;
|
||||
color: #e0e0e0;
|
||||
margin-bottom: 12px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.progress-info {
|
||||
background: #e3f2fd;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 10px;
|
||||
background: rgba(14, 165, 233, 0.1);
|
||||
padding: 14px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 12px;
|
||||
display: none;
|
||||
border: 1px solid rgba(14, 165, 233, 0.2);
|
||||
}
|
||||
|
||||
.progress-info.active {
|
||||
@ -112,99 +172,107 @@
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: #e0e0e0;
|
||||
border-radius: 4px;
|
||||
height: 6px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-top: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: #0066cc;
|
||||
background: linear-gradient(90deg, #0ea5e9 0%, #06b6d4 100%);
|
||||
width: 0%;
|
||||
transition: width 0.3s;
|
||||
box-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 12px;
|
||||
color: #1565c0;
|
||||
margin-bottom: 4px;
|
||||
font-size: 13px;
|
||||
color: #0ea5e9;
|
||||
margin-bottom: 6px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.eta-text {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
color: #888;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.sort-control {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sort-control label {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sort-control select {
|
||||
padding: 5px 8px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #3a3a3a;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
background: #2a2a2a;
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.result-item {
|
||||
background: white;
|
||||
margin: 10px;
|
||||
background: #242424;
|
||||
margin: 12px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
border: 1px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.result-item:hover {
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 4px 16px rgba(14, 165, 233, 0.2);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.result-item.selected {
|
||||
border: 2px solid #0066cc;
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
|
||||
}
|
||||
|
||||
.result-image {
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
object-fit: cover;
|
||||
background: #e9ecef;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
.result-content {
|
||||
padding: 12px;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
color: #e0e0e0;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.result-price {
|
||||
color: #0066cc;
|
||||
color: #0ea5e9;
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
margin-bottom: 8px;
|
||||
font-size: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.result-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.result-location {
|
||||
@ -220,24 +288,27 @@
|
||||
.map-container {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
#map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
filter: brightness(0.9) contrast(1.1);
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
top: 20px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: white;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
|
||||
background: #242424;
|
||||
padding: 14px 24px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.4);
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
border: 1px solid #3a3a3a;
|
||||
}
|
||||
|
||||
.status-bar.visible {
|
||||
@ -245,35 +316,39 @@
|
||||
}
|
||||
|
||||
.status-bar.loading {
|
||||
background: #e3f2fd;
|
||||
color: #1565c0;
|
||||
background: rgba(14, 165, 233, 0.2);
|
||||
color: #0ea5e9;
|
||||
border-color: rgba(14, 165, 233, 0.3);
|
||||
}
|
||||
|
||||
.status-bar.success {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
background: rgba(34, 197, 94, 0.2);
|
||||
color: #22c55e;
|
||||
border-color: rgba(34, 197, 94, 0.3);
|
||||
}
|
||||
|
||||
.status-bar.error {
|
||||
background: #ffebee;
|
||||
color: #c62828;
|
||||
background: rgba(239, 68, 68, 0.2);
|
||||
color: #ef4444;
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.no-results {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
padding: 60px 20px;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid #1565c0;
|
||||
border: 2px solid #0ea5e9;
|
||||
border-radius: 50%;
|
||||
border-top-color: transparent;
|
||||
animation: spin 0.8s linear infinite;
|
||||
margin-right: 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
@ -282,7 +357,15 @@
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.container {
|
||||
grid-template-columns: 300px 1fr;
|
||||
grid-template-columns: 320px 1fr;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.price-inputs input {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,20 +384,40 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="search-bar">
|
||||
<input type="text" id="searchTerm" placeholder="Search term (e.g., Cube Nuroad)" value="Fahrrad">
|
||||
<input type="number" id="minPrice" placeholder="Min €" value="300" min="0">
|
||||
<input type="number" id="maxPrice" placeholder="Max €" value="900" min="0">
|
||||
<input type="number" id="maxPages" placeholder="Pages" value="1" min="1" max="20">
|
||||
<button id="searchBtn">Search</button>
|
||||
<button id="cancelBtn" class="cancel" style="display: none;">Cancel</button>
|
||||
<div class="form-group">
|
||||
<label>Suchbegriff</label>
|
||||
<input type="text" id="searchTerm" placeholder="z.B. Fahrrad" value="Fahrrad">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Preisspanne</label>
|
||||
<div class="price-inputs">
|
||||
<input type="number" id="minPrice" placeholder="0 €" value="0" min="0" max="1000000000">
|
||||
<span class="price-separator">–</span>
|
||||
<input type="number" id="maxPrice" placeholder="∞ €" value="" min="0" max="1000000000">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Anzahl Inserate</label>
|
||||
<select id="numListings">
|
||||
<option value="25" selected>25 Inserate</option>
|
||||
<option value="50">50 Inserate</option>
|
||||
<option value="100">100 Inserate</option>
|
||||
<option value="250">250 Inserate</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button id="searchBtn">Suchen</button>
|
||||
<button id="cancelBtn" class="cancel" style="display: none;">Abbrechen</button>
|
||||
</div>
|
||||
|
||||
<div class="results-panel">
|
||||
<div class="results-header">
|
||||
<div class="results-count">No results</div>
|
||||
<div class="results-count">Keine Ergebnisse</div>
|
||||
|
||||
<div id="progressInfo" class="progress-info">
|
||||
<div class="progress-text">Scraping listings...</div>
|
||||
<div class="progress-text">Inserate werden geladen...</div>
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill"></div>
|
||||
</div>
|
||||
@ -322,12 +425,12 @@
|
||||
</div>
|
||||
|
||||
<div class="sort-control">
|
||||
<label>Sort:</label>
|
||||
<label>Sortierung:</label>
|
||||
<select id="sortSelect">
|
||||
<option value="date-desc">Date (newest)</option>
|
||||
<option value="date-asc">Date (oldest)</option>
|
||||
<option value="price-asc">Price (low to high)</option>
|
||||
<option value="price-desc">Price (high to low)</option>
|
||||
<option value="date-desc">Datum (neueste)</option>
|
||||
<option value="date-asc">Datum (älteste)</option>
|
||||
<option value="price-asc">Preis (niedrig → hoch)</option>
|
||||
<option value="price-desc">Preis (hoch → niedrig)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -392,7 +495,7 @@
|
||||
progressInfo.classList.add('active');
|
||||
const percentage = (current / total) * 100;
|
||||
progressFill.style.width = percentage + '%';
|
||||
progressText.textContent = `Scraping listings: ${current}/${total}`;
|
||||
progressText.textContent = `Inserate werden geladen: ${current}/${total}`;
|
||||
|
||||
// Calculate ETA
|
||||
if (scrapeStartTime && current > 0) {
|
||||
@ -405,9 +508,9 @@
|
||||
const seconds = etaSeconds % 60;
|
||||
|
||||
if (minutes > 0) {
|
||||
etaText.textContent = `ETA: ~${minutes}m ${seconds}s`;
|
||||
etaText.textContent = `Noch ca. ${minutes}m ${seconds}s`;
|
||||
} else {
|
||||
etaText.textContent = `ETA: ~${seconds}s`;
|
||||
etaText.textContent = `Noch ca. ${seconds}s`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -424,17 +527,17 @@
|
||||
|
||||
const marker = L.marker([listing.lat, listing.lon]).addTo(map);
|
||||
|
||||
const imageHtml = listing.image
|
||||
const imageHtml = listing.image
|
||||
? `<img src="${listing.image}" style="width: 100%; max-height: 150px; object-fit: cover; margin: 8px 0;" alt="${listing.title}">`
|
||||
: '';
|
||||
|
||||
const popupContent = `
|
||||
<div style="min-width: 200px;">
|
||||
|
||||
const popupContent = `
|
||||
<div style="min-width: 200px; 8px;">
|
||||
<strong style="font-size: 14px;">${listing.title}</strong><br>
|
||||
${imageHtml}
|
||||
<span style="color: #0066cc; font-weight: bold; font-size: 16px;">€${listing.price}</span><br>
|
||||
<span style="color: #0066cc; font-weight: bold; font-size: 16px;">${listing.price} €</span><br>
|
||||
<span style="color: #666; font-size: 12px;">${listing.address}</span><br>
|
||||
<a href="${listing.url}" target="_blank" style="color: #0066cc; text-decoration: none; font-weight: 600;">Open in new tab →</a>
|
||||
<a href="${listing.url}" target="_blank" style="color: #0066cc; text-decoration: none; font-weight: 600;">Link öffnen →</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -463,7 +566,7 @@
|
||||
|
||||
// Format date
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return 'Unknown date';
|
||||
if (!dateString) return 'Unbekanntes Datum';
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('de-DE');
|
||||
}
|
||||
@ -474,19 +577,19 @@
|
||||
const resultsCount = document.querySelector('.results-count');
|
||||
|
||||
if (listings.length === 0) {
|
||||
resultsList.innerHTML = '<div class="no-results">No listings found</div>';
|
||||
resultsCount.textContent = 'No results';
|
||||
resultsList.innerHTML = '<div class="no-results">Keine Inserate gefunden</div>';
|
||||
resultsCount.textContent = 'Keine Ergebnisse';
|
||||
return;
|
||||
}
|
||||
|
||||
resultsCount.textContent = `${listings.length} result${listings.length !== 1 ? 's' : ''}`;
|
||||
resultsCount.textContent = `${listings.length} Inserat${listings.length !== 1 ? 'e' : ''}`;
|
||||
|
||||
resultsList.innerHTML = listings.map(listing => `
|
||||
<div class="result-item" data-id="${listing.id}">
|
||||
${listing.image ? `<img src="${listing.image}" class="result-image" alt="${listing.title}">` : '<div class="result-image"></div>'}
|
||||
<div class="result-content">
|
||||
<div class="result-title">${listing.title}</div>
|
||||
<div class="result-price">€${listing.price}</div>
|
||||
<div class="result-price">${listing.price} €</div>
|
||||
<div class="result-meta">
|
||||
<div class="result-location">
|
||||
<span>📍</span>
|
||||
@ -518,7 +621,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Open listing in new tab
|
||||
window.open(listing.url, '_blank');
|
||||
}
|
||||
});
|
||||
@ -587,10 +689,7 @@
|
||||
document.getElementById('searchBtn').disabled = false;
|
||||
document.getElementById('cancelBtn').style.display = 'none';
|
||||
updateProgress(0, 0);
|
||||
showStatus(`Completed! Scraped ${allListings.length} listings`, 'success');
|
||||
|
||||
// DO NOT clear session ID - keep it for potential future use
|
||||
// DO NOT reset listings or markers
|
||||
showStatus(`Fertig! ${allListings.length} Inserate geladen`, 'success');
|
||||
console.log('Final listings count:', allListings.length);
|
||||
return false;
|
||||
}
|
||||
@ -602,7 +701,7 @@
|
||||
isScrapingActive = false;
|
||||
document.getElementById('searchBtn').disabled = false;
|
||||
document.getElementById('cancelBtn').style.display = 'none';
|
||||
showStatus('Error occurred during scraping', 'error');
|
||||
showStatus('Fehler beim Laden der Inserate', 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -622,11 +721,12 @@
|
||||
async function searchListings() {
|
||||
const searchTerm = document.getElementById('searchTerm').value.trim();
|
||||
const minPrice = parseInt(document.getElementById('minPrice').value) || 0;
|
||||
const maxPrice = parseInt(document.getElementById('maxPrice').value) || 10000;
|
||||
const maxPages = parseInt(document.getElementById('maxPages').value) || 5;
|
||||
const maxPriceInput = document.getElementById('maxPrice').value;
|
||||
const maxPrice = maxPriceInput ? parseInt(maxPriceInput) : 1000000000;
|
||||
const numListings = parseInt(document.getElementById('numListings').value) || 25;
|
||||
|
||||
if (!searchTerm) {
|
||||
showStatus('Please enter a search term', 'error');
|
||||
showStatus('Bitte Suchbegriff eingeben', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -636,7 +736,7 @@
|
||||
selectedListingId = null;
|
||||
document.getElementById('resultsList').innerHTML = '';
|
||||
|
||||
showStatus('Searching for listings...', 'loading');
|
||||
showStatus('Suche nach Inseraten...', 'loading');
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/search`, {
|
||||
@ -648,7 +748,7 @@
|
||||
search_term: searchTerm,
|
||||
min_price: minPrice,
|
||||
max_price: maxPrice,
|
||||
max_pages: maxPages
|
||||
num_listings: numListings
|
||||
})
|
||||
});
|
||||
|
||||
@ -660,12 +760,12 @@
|
||||
currentSessionId = data.session_id;
|
||||
|
||||
if (data.total === 0) {
|
||||
showStatus('No listings found', 'error');
|
||||
showStatus('Keine Inserate gefunden', 'error');
|
||||
document.getElementById('searchBtn').disabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
showStatus(`Found ${data.total} listings. Starting scrape...`, 'success');
|
||||
showStatus(`${data.total} Inserate gefunden. Lade Details...`, 'success');
|
||||
|
||||
// Show cancel button
|
||||
document.getElementById('cancelBtn').style.display = 'inline-block';
|
||||
@ -678,7 +778,7 @@
|
||||
|
||||
} catch (error) {
|
||||
console.error('Search error:', error);
|
||||
showStatus('Error: Could not connect to API server', 'error');
|
||||
showStatus('Fehler: Verbindung zum Server fehlgeschlagen', 'error');
|
||||
document.getElementById('searchBtn').disabled = false;
|
||||
}
|
||||
}
|
||||
@ -696,7 +796,7 @@
|
||||
document.getElementById('searchBtn').disabled = false;
|
||||
document.getElementById('cancelBtn').style.display = 'none';
|
||||
updateProgress(0, 0);
|
||||
showStatus(`Cancelled. Showing ${allListings.length} scraped listings`, 'error');
|
||||
showStatus(`Abgebrochen. ${allListings.length} Inserate geladen`, 'error');
|
||||
|
||||
} catch (error) {
|
||||
console.error('Cancel error:', error);
|
||||
|
||||
Reference in New Issue
Block a user