v1.3.47: fix InvokeStrategy in archive handler, modal error display, draggable modals

This commit is contained in:
“Naeel”
2026-05-04 06:54:18 +04:00
parent 1cceb42f83
commit 4f6b4b87be
8 changed files with 97 additions and 12 deletions
+12
View File
@@ -318,3 +318,15 @@ textarea {
white-space: pre-wrap;
word-break: break-word;
}
.modal-error {
display: none;
margin-top: 10px;
padding: 8px 12px;
border-radius: 6px;
background: #3a1a1a;
color: #f88;
font-size: 13px;
white-space: pre-wrap;
word-break: break-word;
}
+4 -2
View File
@@ -102,7 +102,7 @@
<div class="nubes">NUBES</div>
<div class="product">FISSION CONSOLE</div>
</div>
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.46</div>
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.47</div>
</div>
<div class="row" style="margin:0;">
<button class="btn ghost" onclick="reloadAll()">Refresh</button>
@@ -234,6 +234,7 @@
style="display:none;margin-top:8px;padding:10px 12px;border-radius:6px;font-size:13px;line-height:1.5;white-space:pre-wrap;font-family:monospace;">
</div>
</div>
<div id="cc-error" class="modal-error"></div>
<div class="actions">
<button class="btn ghost" onclick="closeCreateCode()">Отмена</button>
<button id="cc-submit" class="btn" onclick="submitCreateCode()">Создать</button>
@@ -303,6 +304,7 @@
style="display:none;margin-top:8px;padding:10px 12px;border-radius:6px;font-size:13px;line-height:1.5;white-space:pre-wrap;font-family:monospace;">
</div>
</div>
<div id="ca-error" class="modal-error"></div>
<div class="actions">
<button class="btn ghost" onclick="closeCreateArchive()">Отмена</button>
<button id="ca-submit" class="btn" onclick="submitCreateArchive()">Создать</button>
@@ -460,7 +462,7 @@
</div>
<div class="actions" style="justify-content:space-between; align-items:center;">
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.46</span>
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.47</span>
<button class="btn ghost" onclick="closeHelp()">Закрыть</button>
</div>
</div>
+2
View File
@@ -22,6 +22,7 @@ function openCreateArchive() {
if (fileInput) fileInput.value = '';
var aiRes = document.getElementById('ca-ai-result');
if (aiRes) { aiRes.style.display = 'none'; aiRes.textContent = ''; }
hideModalError('ca-error');
document.getElementById('create-archive-modal').classList.add('open');
document.getElementById('ca-name').focus();
}
@@ -77,6 +78,7 @@ async function submitCreateArchive() {
await reloadAll();
} catch (e) {
progress.stop('Ошибка создания: ' + e.message, 'err');
showModalError('ca-error', 'Ошибка: ' + e.message);
} finally {
btn.disabled = false;
}
+2
View File
@@ -21,6 +21,7 @@ function openCreateCode() {
toggleScheduleFields('cc');
var aiRes = document.getElementById('cc-ai-result');
if (aiRes) { aiRes.style.display = 'none'; aiRes.textContent = ''; }
hideModalError('cc-error');
document.getElementById('create-code-modal').classList.add('open');
document.getElementById('cc-name').focus();
}
@@ -65,6 +66,7 @@ async function submitCreateCode() {
await reloadAll();
} catch (e) {
progress.stop('Ошибка создания: ' + e.message, 'err');
showModalError('cc-error', 'Ошибка: ' + e.message);
} finally {
btn.disabled = false;
}
+63
View File
@@ -1,5 +1,68 @@
/* modals.js — управление модальными окнами Help и Invoke */
// makeDraggable — делает .panel внутри modalId перетаскиваемым за заголовок (h3).
function makeDraggable(modalId) {
var modal = document.getElementById(modalId);
if (!modal) return;
var panel = modal.querySelector('.panel');
if (!panel) return;
var handle = panel.querySelector('h3');
if (!handle) return;
handle.style.cursor = 'move';
handle.style.userSelect = 'none';
var startX, startY, startLeft, startTop;
handle.addEventListener('mousedown', function(e) {
e.preventDefault();
var rect = panel.getBoundingClientRect();
// Переводим в position:fixed если ещё не
if (!panel.style.left) {
panel.style.position = 'fixed';
panel.style.left = rect.left + 'px';
panel.style.top = rect.top + 'px';
panel.style.margin = '0';
}
startX = e.clientX;
startY = e.clientY;
startLeft = parseInt(panel.style.left, 10) || rect.left;
startTop = parseInt(panel.style.top, 10) || rect.top;
function onMove(e) {
var dx = e.clientX - startX;
var dy = e.clientY - startY;
panel.style.left = (startLeft + dx) + 'px';
panel.style.top = (startTop + dy) + 'px';
}
function onUp() {
document.removeEventListener('mousemove', onMove);
document.removeEventListener('mouseup', onUp);
}
document.addEventListener('mousemove', onMove);
document.addEventListener('mouseup', onUp);
});
}
// Инициализация после загрузки DOM
document.addEventListener('DOMContentLoaded', function() {
['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal'].forEach(makeDraggable);
});
// showModalError — показывает ошибку внутри модалки.
// errorDivId — id элемента с классом modal-error.
function showModalError(errorDivId, message) {
var el = document.getElementById(errorDivId);
if (!el) return;
el.textContent = message;
el.style.display = 'block';
}
function hideModalError(errorDivId) {
var el = document.getElementById(errorDivId);
if (el) { el.style.display = 'none'; el.textContent = ''; }
}
function openHelp() {
document.getElementById('help-modal').classList.add('open');
}