diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index 2fdd88c..1bc5a32 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -759,62 +759,75 @@ function open_curtain (left=null,right=null,overlay=null,close=null){ let overlay_clear = document.querySelector(".block_overlay") overlay_clear.classList.toggle('show') overlay_clear.classList.toggle('hidden') + } - } else { - let user_type = getInfoAboutUser() - if (user_type === 'mobile' || !window.location.host.includes('profile') || user_type === 'laptop' ) { - curtain.classList.toggle("open") - curtain.classList.toggle("close") - - newCurtainZIndex() - let curtain_check = getOpenCurtain() - if (curtain_check.length > 1){ - let curtain_old = getCurtainWIncreaceZindex(curtain_check,'decreace')['increace'] - curtain_old.classList.toggle("close") - curtain_old.classList.toggle("open") - - } - if (curtain_check.length > 0){ - let overlay = document.querySelector('.block_overlay.show') - if (!overlay){ - let overlay_clear = document.querySelector(".block_overlay") - overlay_clear.classList.toggle('show') - overlay_clear.classList.toggle('hidden') - } - } else { - - closeOverlay() - - } - } else { - if (!window.location.href.includes('profile')){ - // - } - } - - - let handler_text = curtain.querySelector('.text_f_curtain') - if (curtain.classList.contains('open')){ - handler_text.innerHTML = 'Закрыть' - handler_text.style.fontSize = '13px' - } else { - handler_text.innerHTML = curtain_name - handler_text.style.fontSize = '13px' - } - - if (!curtain.classList.contains('open')){ - body.style.overflowY = '' - } else { - body.style.overflowY = 'hidden' - } - container_curtain.classList.toggle("close") - container_curtain.classList.toggle("open") + curtainMove(curtain,container_curtain,curtain_name,body) + curtain.classList.add("open") + curtain.classList.remove("close") + } else { + curtainMove(curtain,container_curtain,curtain_name,body) } } } +function curtainMove (curtain,container_curtain,curtain_name,body){ + let user_type = getInfoAboutUser() + if (user_type === 'mobile' || !window.location.host.includes('profile') || user_type === 'laptop' ) { + curtain.classList.toggle("open") + curtain.classList.toggle("close") + + // newCurtainZIndex() + let curtain_check = getOpenCurtain() + if (curtain_check.length > 1){ + let curtain_old = getCurtainWIncreaceZindex(curtain_check,'decreace') + if (curtain_old){ + if (curtain_old['increace']){ + curtain_old = curtain_old['increace'] + } + } + curtain_old.classList.toggle("close") + curtain_old.classList.toggle("open") + + } + if (curtain_check.length > 0){ + let overlay = document.querySelector('.block_overlay.show') + if (!overlay){ + let overlay_clear = document.querySelector(".block_overlay") + overlay_clear.classList.toggle('show') + overlay_clear.classList.toggle('hidden') + } + } else { + + closeOverlay() + + } + } else { + if (!window.location.href.includes('profile')){ + // + } + } + + + let handler_text = curtain.querySelector('.text_f_curtain') + // if (curtain.classList.contains('open')){ + // handler_text.innerHTML = 'Закрыть' + // handler_text.style.fontSize = '13px' + // } else { + handler_text.innerHTML = curtain_name + handler_text.style.fontSize = '13px' + // } + + if (!curtain.classList.contains('open')){ + body.style.overflowY = '' + } else { + body.style.overflowY = 'hidden' + } + container_curtain.classList.toggle("close") + container_curtain.classList.toggle("open") +} + function turnOffFirst (el) { if (el.classList.contains('first')){ el.classList.remove('first') @@ -841,10 +854,28 @@ function newCurtainZIndex (curtain) { } if (cur_curtain){ cur_curtain.style.zIndex = '101' + let curtain_f_delete = forloopForCurtains(cur_curtain) + if (curtain_f_delete){ + curtain_f_delete.style.zIndex = '99' + } } } +function forloopForCurtains (cur_curtain) { + let curtains = document.querySelectorAll('.curtain') + let curtain_f_delete = null + let i = 0 + curtains.forEach(function (){ + let el = curtains[i] + if (!el === cur_curtain){ + curtain_f_delete = el + } + i++ + }) + return curtain_f_delete +} + function getInfoCurtain (curtain,zIndex,name) { let data = {} let curtain_f_w = null