0.0.88
This commit is contained in:
@@ -20,7 +20,9 @@ function check_new_messages_timeout(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
check_msg = setInterval(function () {
|
check_msg = setInterval(function () {
|
||||||
|
sessionStorage.setItem('online',user_online)
|
||||||
|
let new_message = getNewMessageSession()
|
||||||
|
let user_online = userOnline('set')
|
||||||
window = document.querySelector(".container-messages")
|
window = document.querySelector(".container-messages")
|
||||||
if (window === null){
|
if (window === null){
|
||||||
//
|
//
|
||||||
@@ -29,7 +31,7 @@ function check_new_messages_timeout(){
|
|||||||
check_new_messages(window,it)
|
check_new_messages(window,it)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
1000)
|
60000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -58,6 +60,7 @@ function check_new_messages (window,it){
|
|||||||
data_new_messages.last_message_modifiedDT = last_message_time.dataset['modifieddt']
|
data_new_messages.last_message_modifiedDT = last_message_time.dataset['modifieddt']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/ru/messages/update_chat/',
|
url: '/ru/messages/update_chat/',
|
||||||
@@ -110,3 +113,16 @@ function success_check_new_messages (data) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function userOnline (set=null,check=null) {
|
||||||
|
let user_online = null
|
||||||
|
if (set !== null){
|
||||||
|
user_online = navigator.userActivation.isActive || navigator.userActivation.hasBeenActive === true;
|
||||||
|
sessionStorage.setItem('online',user_online)
|
||||||
|
|
||||||
|
} else if (check !== null){
|
||||||
|
user_online = navigator.userActivation.isActive || navigator.userActivation.hasBeenActive === true;
|
||||||
|
sessionStorage.getItem('online')
|
||||||
|
}
|
||||||
|
return user_online
|
||||||
|
}
|
||||||
11
static/js/global_js.js
Normal file
11
static/js/global_js.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
$(document).ready(function (){
|
||||||
|
getNewMessageSession()
|
||||||
|
})
|
||||||
|
|
||||||
|
function getNewMessageSession (){
|
||||||
|
let new_message = JSON.parse(
|
||||||
|
sessionStorage.getItem('user_alerts')
|
||||||
|
)
|
||||||
|
return new_message
|
||||||
|
}
|
||||||
|
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="{% static 'css/styles(boris).css' %}" >
|
<link rel="stylesheet" href="{% static 'css/styles(boris).css' %}" >
|
||||||
|
|
||||||
|
<script src="{% static "js/global_js.js" %}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% block meta %}
|
{% block meta %}
|
||||||
|
|||||||
Reference in New Issue
Block a user