From d1e06d9ef1231c5c2b6aaae8de26123ca7c73cc09d523571bc557d49b0930945 Mon Sep 17 00:00:00 2001 From: AidarKC Date: Tue, 28 Jul 2026 16:40:22 +0400 Subject: [PATCH] =?UTF-8?q?UI:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BC=D0=BE=D0=B4=D0=B0=D0=BB=D0=BA=D1=83?= =?UTF-8?q?=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=BE=D0=B2=20=D0=B4?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.properties | 2 +- shine-UI/js/pages/access-servers-view.js | 79 ++++++++++++------------ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/VERSION.properties b/VERSION.properties index e8fae79c..2cd52084 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.2.356 +client.version=1.2.357 server.version=1.2.341 diff --git a/shine-UI/js/pages/access-servers-view.js b/shine-UI/js/pages/access-servers-view.js index 653a4a4e..a620fa15 100644 --- a/shine-UI/js/pages/access-servers-view.js +++ b/shine-UI/js/pages/access-servers-view.js @@ -22,51 +22,15 @@ function createConfirmModal() { const root = document.getElementById('modal-root'); if (!(root instanceof HTMLElement)) return null; - const modal = document.createElement('div'); - modal.className = 'modal'; - modal.hidden = true; - modal.innerHTML = ` - - `; - root.append(modal); - - const titleEl = modal.querySelector('#access-servers-dialog-title'); - const textEl = modal.querySelector('#access-servers-dialog-text'); - const noteEl = modal.querySelector('#access-servers-dialog-note'); - const cancelBtn = modal.querySelector('#access-servers-dialog-cancel'); - const confirmBtn = modal.querySelector('#access-servers-dialog-confirm'); - let onConfirm = null; let onCancel = null; const close = () => { - modal.hidden = true; + root.innerHTML = ''; onConfirm = null; onCancel = null; }; - modal.addEventListener('click', (event) => { - if (event.target === modal) close(); - }); - cancelBtn?.addEventListener('click', async () => { - const handler = onCancel; - close(); - if (typeof handler === 'function') await handler(); - }); - confirmBtn?.addEventListener('click', async () => { - const handler = onConfirm; - close(); - if (typeof handler === 'function') await handler(); - }); - return { open({ title, @@ -77,6 +41,30 @@ function createConfirmModal() { onConfirm: confirmHandler, onCancel: cancelHandler, }) { + root.innerHTML = ` + + `; + const modal = root.querySelector('#access-servers-confirm-modal'); + const titleEl = root.querySelector('#access-servers-dialog-title'); + const textEl = root.querySelector('#access-servers-dialog-text'); + const noteEl = root.querySelector('#access-servers-dialog-note'); + const cancelBtn = root.querySelector('#access-servers-dialog-cancel'); + const confirmBtn = root.querySelector('#access-servers-dialog-confirm'); + if (!(modal instanceof HTMLElement) || !(titleEl instanceof HTMLElement) || !(textEl instanceof HTMLElement) || !(noteEl instanceof HTMLElement) || !(cancelBtn instanceof HTMLButtonElement) || !(confirmBtn instanceof HTMLButtonElement)) { + close(); + return; + } + titleEl.textContent = String(title || 'Подтверждение'); textEl.textContent = String(text || ''); if (note) { @@ -90,10 +78,23 @@ function createConfirmModal() { cancelBtn.textContent = String(cancelLabel || 'Нет'); onConfirm = confirmHandler || null; onCancel = cancelHandler || null; - modal.hidden = false; + + modal.addEventListener('click', (event) => { + if (event.target === modal) close(); + }); + cancelBtn.addEventListener('click', async () => { + const handler = onCancel; + close(); + if (typeof handler === 'function') await handler(); + }); + confirmBtn.addEventListener('click', async () => { + const handler = onConfirm; + close(); + if (typeof handler === 'function') await handler(); + }); }, destroy() { - modal.remove(); + close(); }, }; }