This commit is contained in:
2023-09-10 14:43:14 +03:00
parent b0f138489d
commit d14e2dcbbe
6 changed files with 50 additions and 65 deletions

View File

@@ -58,7 +58,7 @@ function check_new_messages_timeout(timeout_time=1000){
// // } // // }
// check_msg = setInterval(function () { // check_msg = setInterval(function () {
// //
// // let new_message = getNewMessageSession() // // let new_message = middleWareJS()
// // let user_online = userOnline('set') // // let user_online = userOnline('set')
// window = document.querySelector(".container-messages") // window = document.querySelector(".container-messages")
// if (window === null){ // if (window === null){

View File

@@ -1,13 +1,25 @@
// $(document).ready(function (){ // $(document).ready(function (){
// getNewMessageSession() // middleWareJS()
// }) // })
// window.onfocus = function () { // window.onfocus = function () {
// getSocketState() // getSocketState()
// } // }
window.onload = function (){
middleWareJS()
}
function getNewMessageSession(){ function middleWareJS(){
let footer = document.querySelector("footer")
if (document.querySelector("h1")){
if (document.querySelector("h1").innerHTML === "Написать сообщение" || document.querySelector("h1").innerHTML === "Write message") {
footer.style.display = "none"
} else {
footer.style.display = ""
}
} else {
footer.style.display = ""
}
// let window_messages = document.querySelector(".container-messages") // let window_messages = document.querySelector(".container-messages")
// let new_timeout_time; // let new_timeout_time;
// if (window_messages !== null){ // if (window_messages !== null){
@@ -104,7 +116,7 @@ function socket_close(e){
} }
// var window_messages = document.querySelector(".container-messages") // var window_messages = document.querySelector(".container-messages")
// function getNewMessageSession (){ // function middleWareJS (){
// let prs_ = null // let prs_ = null
// // if (r !== 'undefined' && r !== null && r !== ""){ // // if (r !== 'undefined' && r !== null && r !== ""){
// // // //

View File

@@ -44,7 +44,7 @@
// // document.getElementById('id_to_address_point_txt').style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; // // document.getElementById('id_to_address_point_txt').style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center';
// //
// //
// getNewMessageSession() // middleWareJS()
// let insert_place_1 = element.nextSibling // let insert_place_1 = element.nextSibling
// let insert_place_2 = insert_place_1.nextSibling // let insert_place_2 = insert_place_1.nextSibling
// let insert_place = insert_place_2.nextSibling // let insert_place = insert_place_2.nextSibling

View File

@@ -12,11 +12,9 @@ function createTicketShow () {
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
document.querySelector(".insert-tech-place").innerHTML = data.html;
document.querySelector(".insert-tech-place").innerHTML = data.html;
middleWareJS()
}, },
}); });
} }
@@ -84,12 +82,10 @@ function attachFileCreateTicket () {
// enctype: 'json', // enctype: 'json',
data: data, data: data,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
document.querySelector(".insert-tech-place").innerHTML = data.html; document.querySelector(".insert-tech-place").innerHTML = data.html;
middleWareJS()
}, },
}); });
@@ -114,12 +110,10 @@ function attachFilemeassge () {
// enctype: 'json', // enctype: 'json',
data: data, data: data,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
document.querySelector(".insert-tech-place").innerHTML = data.html; document.querySelector(".insert-tech-place").innerHTML = data.html;
middleWareJS()
}, },
}); });
input.remove() input.remove()
@@ -140,9 +134,7 @@ function createTicket (el) {
// enctype: 'json', // enctype: 'json',
data: formData, data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) { middleWareJS()
getNewMessageSession()
}
document.querySelector(".insert-tech-place").innerHTML = data.html; document.querySelector(".insert-tech-place").innerHTML = data.html;
@@ -182,9 +174,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null){
// enctype: 'json', // enctype: 'json',
data: JSON.stringify(data), data: JSON.stringify(data),
success: function(data){ success: function(data){
if (data.user_alerts) { middleWareJS()
getNewMessageSession()
}
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -247,7 +237,7 @@ function sendMessage(id_ticket=null,sender,receiver){
// // enctype: 'json', // // enctype: 'json',
// data: JSON.stringify(data), // data: JSON.stringify(data),
// success: function(data){ // success: function(data){
// getNewMessageSession() // middleWareJS()
// //
// document.querySelector(".container-messages").innerHTML = data.html; // document.querySelector(".container-messages").innerHTML = data.html;
// document.querySelector(".enter-message-inp").focus() // document.querySelector(".enter-message-inp").focus()
@@ -280,9 +270,7 @@ function openTicket (ticket_id){
// enctype: 'json', // enctype: 'json',
data: JSON.stringify(data), data: JSON.stringify(data),
success: function(data){ success: function(data){
if (data.user_alerts) { middleWareJS()
getNewMessageSession()
}
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;

View File

@@ -10,9 +10,7 @@ function writeMessage(el){
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -22,6 +20,7 @@ function writeMessage(el){
//updating the url without reloading //updating the url without reloading
window.history.pushState(null, null, '/ru/profile/page/chat/') window.history.pushState(null, null, '/ru/profile/page/chat/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
@@ -44,10 +43,7 @@ function technicalSupport(el){
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
getNewMessageSession()
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -58,7 +54,7 @@ function technicalSupport(el){
//updating the url without reloading //updating the url without reloading
window.history.pushState(null, null, '/ru/profile/page/support/') window.history.pushState(null, null, '/ru/profile/page/support/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
@@ -80,9 +76,7 @@ function mySubscription(el){
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
// location.href = '/profile' // location.href = '/profile'
@@ -94,7 +88,7 @@ function mySubscription(el){
//updating the url without reloading //updating the url without reloading
window.history.pushState(null, null, '/ru/profile/page/my_subscribe/') window.history.pushState(null, null, '/ru/profile/page/my_subscribe/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
@@ -115,9 +109,7 @@ function myProfile(el){
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -128,7 +120,7 @@ function myProfile(el){
//updating the url without reloading //updating the url without reloading
window.history.pushState(null, null, '/ru/profile/page/change_profile/') window.history.pushState(null, null, '/ru/profile/page/change_profile/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
@@ -173,9 +165,7 @@ function removeRoute(el) {
// enctype: 'json', // enctype: 'json',
data: JSON.stringify(remove_data) , data: JSON.stringify(remove_data) ,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -187,7 +177,7 @@ function removeRoute(el) {
//updating the url without reloading //updating the url without reloading
window.history.pushState(null, null, '/ru/profile/page/change_profile/') window.history.pushState(null, null, '/ru/profile/page/change_profile/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
console.log(400) console.log(400)
@@ -280,10 +270,10 @@ function searchTown(el){
success: function(data){ success: function(data){
el.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; el.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center';
getNewMessageSession()
return insertSearchList(data, el.name + '_list'); return insertSearchList(data, el.name + '_list');
middleWareJS()
}, },
error: function (data){ error: function (data){
@@ -494,9 +484,7 @@ function sendRoute(el, routeID = null){
// enctype: 'json', // enctype: 'json',
data: JSON.stringify(obj_w_el_form), data: JSON.stringify(obj_w_el_form),
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html document.querySelector(".info_profile").innerHTML = data.html
@@ -505,7 +493,7 @@ function sendRoute(el, routeID = null){
let my_routes = document.getElementById("my_routes_id") let my_routes = document.getElementById("my_routes_id")
list_div.forEach(el=>{ el.classList.remove('selected'); }); list_div.forEach(el=>{ el.classList.remove('selected'); });
my_routes.classList.add('selected') my_routes.classList.add('selected')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){
@@ -589,9 +577,7 @@ function createRoute(el, owner_type){
// enctype: 'json', // enctype: 'json',
data: JSON.stringify(obj), data: JSON.stringify(obj),
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html document.querySelector(".info_profile").innerHTML = data.html
@@ -606,7 +592,7 @@ function createRoute(el, owner_type){
} else { } else {
window.history.pushState(null, null, '/ru/profile/page/create_route_for_mover/') window.history.pushState(null, null, '/ru/profile/page/create_route_for_mover/')
} }
middleWareJS()
@@ -643,9 +629,7 @@ function getRoute(el){
// enctype: 'json', // enctype: 'json',
// data: formData, // data: formData,
success: function(data){ success: function(data){
if (data.user_alerts) {
getNewMessageSession()
}
// location.href = '/profile' // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".info_profile").innerHTML = data.html;
@@ -656,7 +640,7 @@ function getRoute(el){
window.history.pushState(null, null, '/ru/profile/page/my_routes/') window.history.pushState(null, null, '/ru/profile/page/my_routes/')
middleWareJS()
}, },
error: function (data, exception){ error: function (data, exception){

View File

@@ -1,6 +1,9 @@
{% load static %} {% load static %}
<div class="block-finded-routes"> <div class="block-finded-routes">
<div class="width-100 text-align-center {% if routes %}mb-10{% endif %}">
<img class="loader_filters_routes" src="{% static "img/svg/loader.svg" %}">
</div>
{% if not routes %} {% if not routes %}
{# <span style='color: #ff0000;font-weight: 800;font-size: 18px;padding: 10px;'>Нечего не найдено!</span>#} {# <span style='color: #ff0000;font-weight: 800;font-size: 18px;padding: 10px;'>Нечего не найдено!</span>#}
<div class="not_found_routes show"> <div class="not_found_routes show">
@@ -13,9 +16,7 @@
<img class="boxes_not_fond_routes right" src="{% static "/img/boxes_for_not_found_routes/b_2.svg" %}"> <img class="boxes_not_fond_routes right" src="{% static "/img/boxes_for_not_found_routes/b_2.svg" %}">
</div> </div>
{% endif %} {% endif %}
<div class="width-100 text-align-center mb-10">
<img class="loader_filters_routes" src="{% static "img/svg/loader.svg" %}">
</div>
<div class="page_routes_1"> <div class="page_routes_1">
{% include "blocks/b_search_routes.html" %} {% include "blocks/b_search_routes.html" %}
</div> </div>