diff --git a/static/js/chat_socket_functions/inital_old_tab.js b/static/js/chat_socket_functions/inital_old_tab.js index eb6cf8a..5fd7c4e 100644 --- a/static/js/chat_socket_functions/inital_old_tab.js +++ b/static/js/chat_socket_functions/inital_old_tab.js @@ -5,7 +5,7 @@ function inital_old_tab (){ if (el_tab !== null){ let dataset = el_tab.dataset; old_item_tab_user = dataset['curReceiverItem']; - let old_item_tab_user_list = [el_tab,old_item_tab_user] - return old_item_tab_user_list } + let old_item_tab_user_list = [el_tab,old_item_tab_user] + return old_item_tab_user_list } \ No newline at end of file diff --git a/static/js/chat_sockets.js b/static/js/chat_sockets.js index 659d783..71dfa3a 100644 --- a/static/js/chat_sockets.js +++ b/static/js/chat_sockets.js @@ -116,6 +116,7 @@ function wsReceiveData (e) { } } } + setCokie(365,'twb_new_messages',true) update_count_unread_messages(data) } if (data.required_beep === true) { diff --git a/static/js/global_js.js b/static/js/global_js.js index 6504c8b..51fcab7 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -217,6 +217,15 @@ function checkStateCookie () { if (!window.document.cookie.includes("allow_cookie=true")){ document.querySelector(".cookie_block").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"); + if (marker_new_messages.classList.contains('hide')) { + marker_new_messages.classList.remove('hide') + marker_new_messages.classList.add('show') + } + } + } } function getCsrfCookie () { @@ -231,11 +240,15 @@ function getCsrfCookie () { return csrf } -function setCokie () { +function setCokie (days,name,val) { let date = new Date(); - let days = 182; + // let days = 182; date.setTime(+ date + (days * 86400000)); - window.document.cookie = "allow_cookie=true" + "; expires=" + date.toGMTString() + "; path=/"; + window.document.cookie = `${name}=${val}` + "; expires=" + date.toGMTString() + "; path=/"; document.querySelector(".cookie_block").classList.remove("show") return value; +} + +function getInCookieTime (time) { + return time * 24 * 60 * 60 } \ No newline at end of file diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index 3a6d4f8..60900bf 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -83,16 +83,19 @@ function select_tab_profile (el,url,owner_type=null) { if (window.location.href.includes("profile")){ selectTabProfileIfHisNotSelected(url) } - 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.remove('show') - marker_new_messages.classList.add('hide') - } - } deleteMarkerMessages(el) checkStatesAfterTransitionToAnotherTabProfile() goToChatIfChat() + if (window.location.href.includes("chat") || window.location.href.includes("chat")) { + 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.remove('show') + marker_new_messages.classList.add('hide') + } + } + } + setCokie(365,'twb_new_messages','false') }, error: function (data){ console.log(data) diff --git a/templates/blocks/b_header.html b/templates/blocks/b_header.html index 9d06ecd..4a7c857 100644 --- a/templates/blocks/b_header.html +++ b/templates/blocks/b_header.html @@ -76,6 +76,7 @@
+
{#
#} {#
#} diff --git a/templates/tb_base.html b/templates/tb_base.html index 9e1dc61..b6d2be0 100644 --- a/templates/tb_base.html +++ b/templates/tb_base.html @@ -72,7 +72,7 @@ - +