1.1.43 add popup display functionality with cookie-based visibility control

This commit is contained in:
2024-07-25 16:55:13 +03:00
parent 10814e9e5f
commit 111a7eaff7
5 changed files with 127 additions and 2 deletions

View File

@@ -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 {*/

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}