fix: methods=[GET,POST], красная корзина, детект дубликатов
- / принимает GET и POST (было только GET → 405 Method Not Allowed) - Кнопка удаления: красная иконка trash-2 - Дубликаты: предупреждение + пометка в очереди
This commit is contained in:
@@ -52,9 +52,10 @@
|
||||
}
|
||||
.queue-item .name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.queue-item .size { color: var(--muted); font-size: 12px; }
|
||||
.queue-item .remove { cursor: pointer; color: var(--muted); padding: 4px; }
|
||||
.queue-item .remove:hover { color: var(--destructive); }
|
||||
.queue-item .remove { cursor: pointer; color: var(--destructive); padding: 4px; opacity: .7; }
|
||||
.queue-item .remove:hover { opacity: 1; }
|
||||
.queue-empty { color: var(--muted); padding: 12px; text-align: center; font-size: 14px; }
|
||||
.duplicate-warn { color: #f59e0b; font-size: 12px; margin-left: 8px; }
|
||||
.table-wrap { border-radius: 6px; border: 1px solid var(--brand-gray); overflow: hidden; margin-top: 12px; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
th { background: var(--brand-grey-light); text-transform: uppercase; padding: 4px 8px; border-right: 1px solid var(--brand-gray); text-align: left; font-weight: 600; }
|
||||
@@ -159,12 +160,25 @@
|
||||
|
||||
// Добавление файлов в очередь при выборе
|
||||
visibleInput.addEventListener('change', () => {
|
||||
let added = 0, skipped = 0;
|
||||
for (const f of visibleInput.files) {
|
||||
if (!fileQueue.find(q => q.name === f.name && q.size === f.size)) {
|
||||
const dup = fileQueue.find(q => q.name === f.name && q.size === f.size);
|
||||
if (dup) {
|
||||
dup._duplicate = true;
|
||||
skipped++;
|
||||
} else {
|
||||
f._duplicate = false;
|
||||
fileQueue.push(f);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
visibleInput.value = '';
|
||||
if (skipped > 0) {
|
||||
queueEmpty.innerHTML = '⚠️ ' + skipped + ' файл(ов) уже в очереди — пропущены';
|
||||
queueEmpty.style.display = 'block';
|
||||
queueEmpty.style.color = '#f59e0b';
|
||||
setTimeout(() => { queueEmpty.style.color = 'var(--muted)'; if (fileQueue.length === 0) queueEmpty.innerHTML = 'Нет файлов — выберите file.docx / file.pdf / file.zip'; }, 3000);
|
||||
}
|
||||
renderQueue();
|
||||
});
|
||||
|
||||
@@ -183,6 +197,8 @@
|
||||
if (fileQueue.length === 0) {
|
||||
queueDiv.innerHTML = '';
|
||||
queueEmpty.style.display = 'block';
|
||||
queueEmpty.textContent = 'Нет файлов — выберите file.docx / file.pdf / file.zip';
|
||||
queueEmpty.style.color = 'var(--muted)';
|
||||
processBtn.disabled = true;
|
||||
} else {
|
||||
queueEmpty.style.display = 'none';
|
||||
@@ -190,9 +206,9 @@
|
||||
queueDiv.innerHTML = fileQueue.map((f, i) =>
|
||||
'<div class="queue-item">' +
|
||||
'<i data-lucide="file-text" style="width:16px;height:16px;color:var(--muted);"></i>' +
|
||||
'<span class="name">' + f.name + '</span>' +
|
||||
'<span class="name">' + f.name + (f._duplicate ? '<span class="duplicate-warn">⚠ дубликат</span>' : '') + '</span>' +
|
||||
'<span class="size">' + formatSize(f.size) + '</span>' +
|
||||
'<span class="remove" onclick="removeFile(' + i + ')"><i data-lucide="x" style="width:14px;height:14px;"></i></span>' +
|
||||
'<span class="remove" onclick="removeFile(' + i + ')" title="Удалить"><i data-lucide="trash-2" style="width:14px;height:14px;"></i></span>' +
|
||||
'</div>'
|
||||
).join('');
|
||||
lucide.createIcons();
|
||||
|
||||
Reference in New Issue
Block a user