From 64b3e40ed080675e5ae35cd09a80a7b0053ab8d0 Mon Sep 17 00:00:00 2001 From: SBD Date: Thu, 1 Feb 2024 14:14:35 +0300 Subject: [PATCH] 6 --- static/js/global_js.js | 9 ++++++++- static/js/user_profile_2.js | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/static/js/global_js.js b/static/js/global_js.js index 28e5efa..f133cba 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -11,6 +11,7 @@ window.onload = function (){ middleWareJS() openOrCloseCurtainSupportChat() openOverlayOrClose() + goToChatIfChat() // let body = document.querySelector("body") // const viewPortH = body.getBoundingClientRect().height; // const windowH = window.innerHeight; @@ -43,7 +44,13 @@ window.onload = function (){ } } // - +function goToChatIfChat () { + if (document.querySelector('.block-chat')){ + let chat = document.querySelector('.block-chat') + let top = chat.offsetTop + window.scrollTo({top:top}) + } +} function middleWareJS(){ let footer = document.querySelector("footer") diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index e8517db..0fa427f 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -85,6 +85,7 @@ function select_tab_profile (el,url,owner_type=null) { } deleteMarkerMessages(el) checkStatesAfterTransitionToAnotherTabProfile() + goToChatIfChat() }, error: function (data){ console.log(data) @@ -555,7 +556,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){ // let left_curtain = document.querySelector('.curtain.left') document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".enter-message-inp").focus() - + goToChatIfChat() // document.querySelector(".tab_user_messanger.select").scrollIntoView({behavior: "smooth",block:'center',inline: 'start'}); if (document.querySelector(".menu_buttons.curtain.left.open")){ @@ -598,6 +599,9 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){ }); } + + + function checkStateAfterChooseContact () { if (document.querySelector('.menu_buttons.curtain.left.open')){ open_curtain_w_contacts()