From 6377e367397f1c46f941e2c31c3b700d9fc36863 Mon Sep 17 00:00:00 2001 From: NikDizell Date: Tue, 14 Jul 2026 00:12:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D0=BB=D0=B5=D0=BA=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/programmer/js/floating-button.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/static/programmer/js/floating-button.js b/static/programmer/js/floating-button.js index b2b3268..728132d 100644 --- a/static/programmer/js/floating-button.js +++ b/static/programmer/js/floating-button.js @@ -5,6 +5,17 @@ const CallbackModal = { floatingBtnId: 'floatingButton', init() { + const body = document.body; + const showButton = body.dataset.showFloatingButton !== 'false' && body.dataset.showFloatingButton !== '0'; + const delay = parseInt(body.dataset.floatingDelay, 10) || 5000; + + if (!showButton) { + // Кнопка отключена – скрываем навсегда + const btn = document.getElementById(this.floatingBtnId); + if (btn) btn.style.display = 'none'; + return; + } + setTimeout(() => { const btn = document.getElementById(this.floatingBtnId); if (btn) { @@ -13,7 +24,7 @@ const CallbackModal = { const button = btn.querySelector('.btn'); if (button) button.classList.add('pulse'); } - }, 5000); + }, delay); }, open(productTitle) { @@ -21,9 +32,9 @@ const CallbackModal = { if (modal) { if (productTitle) { - const questionField = modal.querySelector('#id_question'); - if (questionField) { - questionField.value = `Запрос цены по ПП "${productTitle}"`; + const questionField = modal.querySelector('#id_question'); + if (questionField) { + questionField.value = `Запрос цены по ПП "${productTitle}"`; } }