Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -20,7 +20,8 @@ function check_new_messages_timeout(){
|
||||
|
||||
}
|
||||
check_msg = setInterval(function () {
|
||||
|
||||
// let new_message = getNewMessageSession()
|
||||
let user_online = userOnline('set')
|
||||
window = document.querySelector(".container-messages")
|
||||
if (window === null){
|
||||
//
|
||||
@@ -29,7 +30,7 @@ function check_new_messages_timeout(){
|
||||
check_new_messages(window,it)
|
||||
}
|
||||
},
|
||||
1000)
|
||||
10000)
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +59,7 @@ function check_new_messages (window,it){
|
||||
data_new_messages.last_message_modifiedDT = last_message_time.dataset['modifieddt']
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/messages/update_chat/',
|
||||
@@ -69,6 +71,7 @@ function check_new_messages (window,it){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(data_new_messages),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
success_check_new_messages(data)
|
||||
|
||||
},
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ function createTicketShow () {
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
||||
|
||||
@@ -80,6 +81,7 @@ function attachFileCreateTicket () {
|
||||
// enctype: 'json',
|
||||
data: data,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
||||
|
||||
@@ -107,6 +109,7 @@ function attachFilemeassge () {
|
||||
// enctype: 'json',
|
||||
data: data,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
||||
|
||||
@@ -130,6 +133,7 @@ function createTicket (el) {
|
||||
// enctype: 'json',
|
||||
data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".insert-tech-place").innerHTML = data.html;
|
||||
|
||||
@@ -169,6 +173,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
@@ -219,6 +224,7 @@ function sendMessage(id_ticket=null,sender,receiver){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".container-messages").innerHTML = data.html;
|
||||
document.querySelector(".enter-message-inp").value = null
|
||||
@@ -251,6 +257,7 @@ function openTicket (ticket_id){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ function writeMessage(){
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
@@ -35,6 +36,7 @@ function technicalSupport(){
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
@@ -59,6 +61,7 @@ function mySubscription(){
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
@@ -83,6 +86,7 @@ function myProfile(){
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
@@ -161,6 +165,7 @@ function searchTown(el){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(get_address_point),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
return insertSearchList(data, el.name + '_list')
|
||||
},
|
||||
error: function (data){
|
||||
@@ -313,6 +318,7 @@ function sendRoute(el, routeID = null){
|
||||
// enctype: 'json',
|
||||
data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
@@ -383,6 +389,7 @@ function createRoute(){
|
||||
// enctype: 'json',
|
||||
// data: {},
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
// console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
@@ -418,6 +425,7 @@ function getRoute(){
|
||||
// enctype: 'json',
|
||||
// data: formData,
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html;
|
||||
|
||||
Reference in New Issue
Block a user