Standalone index.html: исправлен показ кнопки Сканировать (ранний доступ к закомментированному блоку загрузки); убрана кнопка видео
This commit is contained in:
1 parent
13809d20a5
commit
b80bb11831
1 file changed
+19
-19
+19
-19
@@ -495,6 +495,11 @@
|
||||
|
||||
let selectedFile = null;
|
||||
|
||||
// Блок загрузки может быть закомментирован (осталось только сканирование с камеры),
|
||||
// поэтому не обращаемся к его элементам, если их нет.
|
||||
const hasUpload = !!(uploadArea && fileInput && analyzeBtn);
|
||||
|
||||
if (hasUpload) {
|
||||
uploadArea.addEventListener('click', () => fileInput.click());
|
||||
uploadArea.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
@@ -523,11 +528,12 @@
|
||||
if (!selectedFile) return;
|
||||
sendVideo(selectedFile, selectedFile.name);
|
||||
});
|
||||
}
|
||||
|
||||
async function sendVideo(blob, filename) {
|
||||
analyzeBtn.disabled = true;
|
||||
progressContainer.style.display = 'block';
|
||||
resultCard.style.display = 'none';
|
||||
if (analyzeBtn) analyzeBtn.disabled = true;
|
||||
if (progressContainer) progressContainer.style.display = 'block';
|
||||
if (resultCard) resultCard.style.display = 'none';
|
||||
setProgress(5, 'Загрузка видео...');
|
||||
|
||||
// Безопасный разбор ответа: если сервер вернул не JSON (например,
|
||||
@@ -571,7 +577,7 @@
|
||||
setProgress(100, 'Готово!');
|
||||
document.getElementById('scanLoader').classList.remove('open');
|
||||
setTimeout(() => {
|
||||
progressContainer.style.display = 'none';
|
||||
if (progressContainer) progressContainer.style.display = 'none';
|
||||
renderResult(data);
|
||||
}, 300);
|
||||
return;
|
||||
@@ -593,27 +599,22 @@
|
||||
}
|
||||
|
||||
function setProgress(pct, text) {
|
||||
progressFill.style.width = pct + '%';
|
||||
progressText.textContent = text;
|
||||
if (progressFill) progressFill.style.width = pct + '%';
|
||||
if (progressText) progressText.textContent = text;
|
||||
}
|
||||
|
||||
function showError(msg, videoUrl) {
|
||||
document.getElementById('scanLoader').classList.remove('open');
|
||||
progressContainer.style.display = 'none';
|
||||
resultCard.style.display = 'block';
|
||||
if (progressContainer) progressContainer.style.display = 'none';
|
||||
if (resultCard) resultCard.style.display = 'block';
|
||||
let html = `<div class="error-box"><strong>Ошибка:</strong> ${msg}</div>`;
|
||||
if (videoUrl) {
|
||||
html += `<div style="text-align:center; margin-top:15px">
|
||||
<a class="btn-download" href="${videoUrl}">🎬 Скачать записанное видео</a>
|
||||
</div>`;
|
||||
}
|
||||
resultContent.innerHTML = html;
|
||||
analyzeBtn.disabled = false;
|
||||
if (resultContent) resultContent.innerHTML = html;
|
||||
if (analyzeBtn) analyzeBtn.disabled = false;
|
||||
}
|
||||
|
||||
function renderResult(data) {
|
||||
document.getElementById('scanLoader').classList.remove('open');
|
||||
resultCard.style.display = 'block';
|
||||
if (resultCard) resultCard.style.display = 'block';
|
||||
|
||||
let html = '';
|
||||
|
||||
@@ -623,7 +624,6 @@
|
||||
<div class="download-buttons">
|
||||
<a class="btn-download" href="/download/${data.share_id}/pdf">📄 Скачать PDF</a>
|
||||
<a class="btn-download" href="/download/${data.share_id}/docx">📝 Скачать DOCX</a>
|
||||
${data.video_url ? `<a class="btn-download" href="${data.video_url}">🎬 Скачать видео</a>` : ''}
|
||||
<a class="btn-download" href="https://max.ru/miac_dnr_bot" target="_blank" rel="noopener">🏥 Запись на диспанцеризацию</a>
|
||||
</div>`;
|
||||
}
|
||||
@@ -673,8 +673,8 @@
|
||||
</div>`;
|
||||
}
|
||||
|
||||
resultContent.innerHTML = html;
|
||||
resultCard.scrollIntoView({ behavior: 'smooth' });
|
||||
if (resultContent) resultContent.innerHTML = html;
|
||||
if (resultCard) resultCard.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
|
||||
function shareResult(url, btn) {
|
||||
|
||||
Reference in new issue
Block a user