From 111a7eaff760d3de1b563c786db56fa406215bf1 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 25 Jul 2024 16:55:13 +0300 Subject: [PATCH] 1.1.43 add popup display functionality with cookie-based visibility control --- static/css/mobile_styles.css | 13 ++++++++ static/css/styles(boris).css | 61 ++++++++++++++++++++++++++++++++++++ static/js/authorization.js | 3 ++ static/js/global_js.js | 20 ++++++++++-- templates/tb_base.html | 32 +++++++++++++++++++ 5 files changed, 127 insertions(+), 2 deletions(-) diff --git a/static/css/mobile_styles.css b/static/css/mobile_styles.css index 1dde9e8..4b4b6f8 100644 --- a/static/css/mobile_styles.css +++ b/static/css/mobile_styles.css @@ -1510,6 +1510,10 @@ width: 153px; } + .popup_content{ + width: 41%; + } + } @media (max-width: 950px){ @@ -1554,6 +1558,9 @@ .pag_news_item_text{ width: unset; } + .popup_content{ + width: 52%; + } } @media (max-width: 850px){ @@ -1687,6 +1694,9 @@ .marker_messages_mobile.show{ display: block; } + .popup_content>.confirm_profile_btn{ + width: 90%; + } } @media (max-width: 828px){ @@ -1844,6 +1854,9 @@ .inf_carrier_icon{ /*width: 3%;*/ } + .popup_content{ + width: 70%; + } } @media (max-width: 687px){ /*.to_address_point_txt.find_route {*/ diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index ee1ba62..4385f25 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -3008,6 +3008,8 @@ a.open_inf_carrier{ display: none; } + + .cookie_block.show{ display: block; } @@ -3034,4 +3036,63 @@ a.open_inf_carrier{ height: 25px; width: 95px; cursor: pointer; +} + +/*popup*/ +.popup_wrapper{ + display: none; + position: fixed; /* Используйте fixed, чтобы попап оставался на месте при прокрутке */ + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); /* Полупрозрачный фон */ + justify-content: center; + align-items: center; + z-index: 9999; +} + +.popup_wrapper.show{ + display: flex; +} +.popup_content{ + position: relative; + width: 38%; + height: fit-content; + background: #FFFFFF; + border-radius: 15px; + text-align: center; + padding: 28px; + font-family: Inter; + +} +.popup_cross{ + position: absolute; + right: 5%; +} +.popup_img>img{ + background: #E1E1E1; + border-radius: 39px; + padding: 5px; +} +.popup_title{ + font-weight: 700; + font-size: 34px; + margin-top: 20px; +} +.popup_text{ + line-height: 30px; + font-size: 20px; + margin-top: 10px; + color: #6F6C90; +} +.popup_content>.confirm_profile_btn{ + width: 62%; +} +#poup_text_bold{ + font-weight: 700; + color: #1d1e20; +} +#authenticated_img{ + display: none; } \ No newline at end of file diff --git a/static/js/authorization.js b/static/js/authorization.js index 723adb1..e6cca7a 100644 --- a/static/js/authorization.js +++ b/static/js/authorization.js @@ -20,6 +20,7 @@ function SendLoginForm(el){ data: formData, success: function(data){ + location.href = data.redirect_url//`/profile/page/dashboard/` window.sessionStorage.removeItem('mailingSubscribeRequired') window.sessionStorage.removeItem('email') @@ -29,6 +30,8 @@ function SendLoginForm(el){ + + }, error: function (data, exception){ document.querySelector(".login").innerHTML = data.responseJSON.html diff --git a/static/js/global_js.js b/static/js/global_js.js index c0f251e..ca6b9c1 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -227,6 +227,12 @@ function checkStateCookie () { if (!window.document.cookie.includes("allow_cookie=true")){ document.querySelector(".cookie_block").classList.add("show") } + if (!window.document.cookie.includes("popup_show=false")){ + document.querySelector(".popup_wrapper").classList.add("show") + } + if(!window.document.cookie.includes("first_authorization=true") && window.document.getElementById('authenticated_img')){ + document.querySelector(".popup_wrapper").classList.add("show") + } if (window.document.cookie.includes("twb_new_messages=true")){ if (getInfoAboutUser('screen_width') < 800) { let marker_new_messages = document.querySelector(".marker_messages_mobile"); @@ -258,12 +264,22 @@ function getCsrfCookie () { return csrf } -function setCokie (days,name,val) { +function setCokie (days,name,val, url = null) { let date = new Date(); // let days = 182; date.setTime(+ date + (days * 86400000)); window.document.cookie = `${name}=${val}` + "; expires=" + date.toGMTString() + "; path=/"; - document.querySelector(".cookie_block").classList.remove("show") + + if(name === 'allow_cookie' ){ + document.querySelector(".cookie_block").classList.remove("show") + } else if(name === 'popup_show'){ + document.querySelector(".popup_wrapper").classList.remove("show") + if(url){ + window.location.href = url} + } else if (name === 'first_authorization'){ + document.querySelector(".popup_wrapper").classList.remove("show") + } + // return value; } diff --git a/templates/tb_base.html b/templates/tb_base.html index 92a56bd..e7916ad 100644 --- a/templates/tb_base.html +++ b/templates/tb_base.html @@ -119,6 +119,38 @@ + + +