From 9cb8036d3c283f4d5bedf12f14088c25d9142691 Mon Sep 17 00:00:00 2001 From: SBD Date: Wed, 31 Jan 2024 14:12:44 +0300 Subject: [PATCH] 3 --- static/js/user_profile_2.js | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index f65d75e..8ad56f4 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -84,6 +84,7 @@ function select_tab_profile (el,url,owner_type=null) { selectTabProfileIfHisNotSelected(url) } deleteMarkerMessages(el) + checkStatesAfterTransitionToAnotherTabProfile() }, error: function (data){ console.log(data) @@ -92,16 +93,37 @@ function select_tab_profile (el,url,owner_type=null) { }); } -function deleteMarkerMessages (el) { - let marker = document.querySelectorAll(".icon_unread_messages") - if (marker.length > 0){ - marker[0].classList.remove("showed") - if (marker[1]){ - marker[1].classList.remove("showed") +function checkStatesAfterTransitionToAnotherTabProfile () { + // check which page if profile - do + if (window.location.href.includes('profile')){ + // if curtain open we need to close, so we'il see content without curtain + if (document.querySelector(".menu_buttons.curtain.right.open")){ + open_curtain_w_btn_profile() + } + // if overlay open we need to close, so we'il see content without overlay + if (document.querySelector('.block_overlay.show')){ + setStandartSettingsToBlockOverlay() + } + // if page === chat - do or if page === support + if (window.location.href.includes("page/chat/") || window.location.href.includes("page/support/")){ + // if curtain with contacts or curtain with clients close we need to open it, + // but if user === not admin, and user in page support we didn't need to do anything + if (document.querySelector(".menu_buttons.curtain.left.close")){ + open_curtain_w_contacts() + } } } } +function deleteMarkerMessages (el) { + let marker = document.querySelectorAll(".icon_unread_messages") + if (marker.length > 0) { + marker[0].classList.remove("showed") + if (marker[1]) { + marker[1].classList.remove("showed") + } + } +} function selectTabProfileIfHisNotSelected (url) { if (url !== 'new_route_view') { let el_f_select = document.querySelector(`[data-ajax-url=${url}]`) @@ -985,7 +1007,7 @@ function show_header_list () { // } else if (right){ // let right = document.querySelector(".curtain.right") // open_curtain(null,right,null,'close') -// } else { +// } else {` // let curtain = getOpenCurtain() // if (curtain) { // open_curtain(null, null, null, 'close')