This commit is contained in:
SBD
2024-02-20 19:31:10 +03:00
parent c146bd6155
commit 2048ed6baf
4 changed files with 32 additions and 5 deletions

View File

@@ -39,7 +39,16 @@ function wsReceiveData (e) {
console.log(data)
} else if (data.type === "update_chat") {
let msg_cont = document.querySelector(".container-messages")
if (getInfoAboutUser('screen_width') < 800){
if (!window.location.href.includes("chat") && !window.location.href.includes("support")){
let marker_new_messages = document.querySelector(".marker_messages_mobile");
if (marker_new_messages.classList.contains('hide')){
marker_new_messages.classList.add('show')
marker_new_messages.classList.remove('hide')
}
}
}
setCokie(365,'twb_new_messages',true)
update_chat_html(data,msg_cont)
// document.querySelector(".tab_user_messanger.select").scrollIntoView({behavior: "smooth",block:'end',inline:'end'});
@@ -108,7 +117,7 @@ function wsReceiveData (e) {
}
if (data.unread_msgs_count > 0){
if (getInfoAboutUser('screen_width') < 800){
if (!window.location.href.includes("chat") || !window.location.href.includes("chat")){
if (!window.location.href.includes("chat") && !window.location.href.includes("support")){
let marker_new_messages = document.querySelector(".marker_messages_mobile");
if (marker_new_messages.classList.contains('hide')){
marker_new_messages.classList.add('show')

View File

@@ -1,4 +1,5 @@
$(document).ready(function (){
hide_or_show_new_messages_marker()
checkStateCookie()
})
@@ -12,6 +13,7 @@ window.onload = function (){
openOrCloseCurtainSupportChat()
openOverlayOrClose()
goToChatIfChat()
// let body = document.querySelector("body")
// const viewPortH = body.getBoundingClientRect().height;
// const windowH = window.innerHeight;
@@ -43,6 +45,14 @@ window.onload = function (){
}
}
}
function hide_or_show_new_messages_marker () {
if (getInfoAboutUser('screen_width') < 800){
if (window.location.href.includes("chat") || window.location.href.includes("support")){
setCokie(365,'twb_new_messages','false')
}
}
}
//
function goToChatIfChat () {
if (document.querySelector('.block-chat')){
@@ -225,6 +235,14 @@ function checkStateCookie () {
marker_new_messages.classList.add('show')
}
}
} else if (window.document.cookie.includes("twb_new_messages=false")){
if (getInfoAboutUser('screen_width') < 800) {
let marker_new_messages = document.querySelector(".marker_messages_mobile");
if (marker_new_messages.classList.contains('show')) {
marker_new_messages.classList.add('hide')
marker_new_messages.classList.remove('show')
}
}
}
}
@@ -246,7 +264,7 @@ function setCokie (days,name,val) {
date.setTime(+ date + (days * 86400000));
window.document.cookie = `${name}=${val}` + "; expires=" + date.toGMTString() + "; path=/";
document.querySelector(".cookie_block").classList.remove("show")
return value;
// return value;
}
function getInCookieTime (time) {

View File

@@ -86,7 +86,7 @@ function select_tab_profile (el,url,owner_type=null) {
deleteMarkerMessages(el)
checkStatesAfterTransitionToAnotherTabProfile()
goToChatIfChat()
if (window.location.href.includes("chat") || window.location.href.includes("chat")) {
if (window.location.href.includes("chat") || window.location.href.includes("support")) {
if (getInfoAboutUser('screen_width') < 800) {
let marker_new_messages = document.querySelector(".marker_messages_mobile");
if (marker_new_messages.classList.contains('show')) {