From ed6de752caee2ce557581cd30b0d354519eadbe2 Mon Sep 17 00:00:00 2001 From: "Anton.AE" Date: Sat, 4 Jul 2026 20:00:21 +0300 Subject: [PATCH] test --- wp-config.php | 2 + .../assets/css/layout.css | 73 ++++++++++++ .../assets/css/style-core.css | 4 + .../sevastopol-tort-child/assets/js/site.js | 104 ++++++++++++++++++ .../themes/sevastopol-tort-child/footer.php | 38 +++++++ .../sevastopol-tort-child/front-page.php | 2 +- .../themes/sevastopol-tort-child/header.php | 3 +- .../sevastopol-tort-child/inc/forms.php | 16 ++- .../page-templates/page-service.php | 2 +- 9 files changed, 239 insertions(+), 5 deletions(-) diff --git a/wp-config.php b/wp-config.php index 779acfb..df844e0 100644 --- a/wp-config.php +++ b/wp-config.php @@ -89,6 +89,8 @@ define( 'WP_DEBUG', false ); /* Add any custom values between this line and the "stop editing" line. */ +define( 'SEV_TORT_TELEGRAM_BOT_TOKEN', '8607238298:AAH_dZ-EgzFOpT0LtmYuiy4ifcsvLZxXwPk' ); +define( 'SEV_TORT_TELEGRAM_CHAT_ID', '-1003995055932' ); /* That's all, stop editing! Happy publishing. */ diff --git a/wp-content/themes/sevastopol-tort-child/assets/css/layout.css b/wp-content/themes/sevastopol-tort-child/assets/css/layout.css index 5fa10c4..d487ac3 100644 --- a/wp-content/themes/sevastopol-tort-child/assets/css/layout.css +++ b/wp-content/themes/sevastopol-tort-child/assets/css/layout.css @@ -241,7 +241,10 @@ align-items: center; min-height: 46px; border-bottom: 1px solid var(--color-line); + color: var(--color-text); + font: inherit; font-weight: 700; + text-align: left; } .site-footer { @@ -315,6 +318,15 @@ box-shadow: var(--shadow-soft); } +.lead-form__trap { + position: absolute; + left: -10000px; + width: 1px; + height: 1px; + opacity: 0; + pointer-events: none; +} + .lead-form__head { display: grid; gap: 8px; @@ -381,6 +393,67 @@ color: var(--color-success); } +.lead-modal { + position: fixed; + inset: 0; + z-index: 120; + display: grid; + place-items: center; + padding: 20px; +} + +.lead-modal[hidden] { + display: none; +} + +.lead-modal__overlay { + position: absolute; + inset: 0; + background: rgba(44, 33, 29, 0.58); +} + +.lead-modal__dialog { + position: relative; + width: min(100%, 520px); + max-height: calc(100vh - 40px); + overflow: auto; +} + +.lead-modal__close { + position: absolute; + top: 14px; + right: 14px; + z-index: 2; + width: 36px; + height: 36px; + border-radius: 50%; + background: var(--color-surface-soft); +} + +.lead-modal__close::before, +.lead-modal__close::after { + position: absolute; + top: 17px; + left: 10px; + width: 16px; + height: 2px; + border-radius: 2px; + background: var(--color-text); + content: ""; +} + +.lead-modal__close::before { + transform: rotate(45deg); +} + +.lead-modal__close::after { + transform: rotate(-45deg); +} + +.lead-modal .lead-form { + padding-top: 54px; +} + .cookie-note { position: fixed; right: 24px; diff --git a/wp-content/themes/sevastopol-tort-child/assets/css/style-core.css b/wp-content/themes/sevastopol-tort-child/assets/css/style-core.css index c8d974f..2c3ddf2 100644 --- a/wp-content/themes/sevastopol-tort-child/assets/css/style-core.css +++ b/wp-content/themes/sevastopol-tort-child/assets/css/style-core.css @@ -48,6 +48,10 @@ body.menu-is-open { overflow: hidden; } +body.lead-modal-is-open { + overflow: hidden; +} + .button-main, .lead-form__button { display: inline-flex; diff --git a/wp-content/themes/sevastopol-tort-child/assets/js/site.js b/wp-content/themes/sevastopol-tort-child/assets/js/site.js index ae37dc5..9e52d81 100644 --- a/wp-content/themes/sevastopol-tort-child/assets/js/site.js +++ b/wp-content/themes/sevastopol-tort-child/assets/js/site.js @@ -7,6 +7,11 @@ var catalogButton = document.querySelector('.site-header__menu-button'); var cookieNote = document.querySelector('[data-cookie-note]'); var cookieButton = document.querySelector('[data-cookie-accept]'); + var leadModal = document.querySelector('[data-lead-modal]'); + var leadOpenNodes = document.querySelectorAll('[data-lead-open]'); + var leadCloseNodes = document.querySelectorAll('[data-lead-close]'); + var phoneInputs = document.querySelectorAll('[data-phone-mask]'); + var emailInputs = document.querySelectorAll('[data-email-mask]'); function setMenuState(isOpen) { if (!menu || !toggle) { @@ -19,6 +24,67 @@ toggle.setAttribute('aria-expanded', isOpen ? 'true' : 'false'); } + function setLeadModalState(isOpen, source) { + if (!leadModal) { + return; + } + + leadModal.hidden = !isOpen; + body.classList.toggle('lead-modal-is-open', isOpen); + + if (!isOpen) { + return; + } + + var pageInput = leadModal.querySelector('input[name="lead_page"]'); + var sourceInput = leadModal.querySelector('input[name="lead_source"]'); + var firstInput = leadModal.querySelector('input[name="lead_name"]'); + + if (pageInput) { + pageInput.value = document.title + ' | ' + window.location.pathname; + } + + if (sourceInput) { + sourceInput.value = source || 'Попап заявки'; + } + + if (firstInput) { + window.setTimeout(function () { + firstInput.focus(); + }, 80); + } + } + + function applyPhoneMask(input) { + var digits = input.value.replace(/\D/g, ''); + + if (digits.charAt(0) === '8') { + digits = '7' + digits.slice(1); + } + + if (digits.charAt(0) === '7') { + digits = digits.slice(1); + } + + digits = digits.slice(0, 10); + + var value = '+7'; + if (digits.length > 0) { + value += ' (' + digits.slice(0, 3); + } + if (digits.length >= 3) { + value += ') ' + digits.slice(3, 6); + } + if (digits.length >= 6) { + value += '-' + digits.slice(6, 8); + } + if (digits.length >= 8) { + value += '-' + digits.slice(8, 10); + } + + input.value = value; + } + if (menu && toggle) { toggle.addEventListener('click', function () { setMenuState(!menu.classList.contains('is-open')); @@ -46,6 +112,44 @@ }); } + leadOpenNodes.forEach(function (node) { + node.addEventListener('click', function (event) { + event.preventDefault(); + setMenuState(false); + setLeadModalState(true, node.getAttribute('data-lead-source') || node.textContent.trim()); + }); + }); + + leadCloseNodes.forEach(function (node) { + node.addEventListener('click', function () { + setLeadModalState(false); + }); + }); + + document.addEventListener('keydown', function (event) { + if (event.key === 'Escape') { + setLeadModalState(false); + } + }); + + phoneInputs.forEach(function (input) { + input.addEventListener('focus', function () { + if (!input.value) { + input.value = '+7'; + } + }); + + input.addEventListener('input', function () { + applyPhoneMask(input); + }); + }); + + emailInputs.forEach(function (input) { + input.addEventListener('input', function () { + input.value = input.value.replace(/\s/g, '').toLowerCase(); + }); + }); + if (cookieNote && cookieButton && window.localStorage) { if (localStorage.getItem('sevTortCookieAccepted') !== 'yes') { cookieNote.hidden = false; diff --git a/wp-content/themes/sevastopol-tort-child/footer.php b/wp-content/themes/sevastopol-tort-child/footer.php index 241deeb..ddcea08 100644 --- a/wp-content/themes/sevastopol-tort-child/footer.php +++ b/wp-content/themes/sevastopol-tort-child/footer.php @@ -48,6 +48,44 @@ if ( ! defined( 'ABSPATH' ) ) { +