From d14e2dcbbe45552efb90d9ecd57b03c14015b941 Mon Sep 17 00:00:00 2001 From: borissedw Date: Sun, 10 Sep 2023 14:43:14 +0300 Subject: [PATCH] 0.0.235 --- static/js/check_new_messages.js | 2 +- static/js/global_js.js | 20 ++++++++--- static/js/serch_town.js | 2 +- static/js/user_profile(boris).js | 32 ++++++----------- static/js/user_profile.js | 52 ++++++++++----------------- templates/blocks/b_finded_routes.html | 7 ++-- 6 files changed, 50 insertions(+), 65 deletions(-) diff --git a/static/js/check_new_messages.js b/static/js/check_new_messages.js index 19da4fd..22fbc4e 100644 --- a/static/js/check_new_messages.js +++ b/static/js/check_new_messages.js @@ -58,7 +58,7 @@ function check_new_messages_timeout(timeout_time=1000){ // // } // check_msg = setInterval(function () { // -// // let new_message = getNewMessageSession() +// // let new_message = middleWareJS() // // let user_online = userOnline('set') // window = document.querySelector(".container-messages") // if (window === null){ diff --git a/static/js/global_js.js b/static/js/global_js.js index 372b5a6..874f98c 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -1,13 +1,25 @@ // $(document).ready(function (){ -// getNewMessageSession() +// middleWareJS() // }) // window.onfocus = function () { // 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 new_timeout_time; // if (window_messages !== null){ @@ -104,7 +116,7 @@ function socket_close(e){ } // var window_messages = document.querySelector(".container-messages") -// function getNewMessageSession (){ +// function middleWareJS (){ // let prs_ = null // // if (r !== 'undefined' && r !== null && r !== ""){ // // diff --git a/static/js/serch_town.js b/static/js/serch_town.js index 38e5c55..90c3b33 100644 --- a/static/js/serch_town.js +++ b/static/js/serch_town.js @@ -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'; // // -// getNewMessageSession() +// middleWareJS() // let insert_place_1 = element.nextSibling // let insert_place_2 = insert_place_1.nextSibling // let insert_place = insert_place_2.nextSibling diff --git a/static/js/user_profile(boris).js b/static/js/user_profile(boris).js index 2a85de2..eed1028 100644 --- a/static/js/user_profile(boris).js +++ b/static/js/user_profile(boris).js @@ -12,11 +12,9 @@ function createTicketShow () { // enctype: 'json', // data: formData, 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', data: data, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + document.querySelector(".insert-tech-place").innerHTML = data.html; - + middleWareJS() }, }); @@ -114,12 +110,10 @@ function attachFilemeassge () { // enctype: 'json', data: data, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + document.querySelector(".insert-tech-place").innerHTML = data.html; - + middleWareJS() }, }); input.remove() @@ -140,9 +134,7 @@ function createTicket (el) { // enctype: 'json', data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + middleWareJS() document.querySelector(".insert-tech-place").innerHTML = data.html; @@ -182,9 +174,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null){ // enctype: 'json', data: JSON.stringify(data), success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + middleWareJS() document.querySelector(".info_profile").innerHTML = data.html; @@ -247,7 +237,7 @@ function sendMessage(id_ticket=null,sender,receiver){ // // enctype: 'json', // data: JSON.stringify(data), // success: function(data){ - // getNewMessageSession() + // middleWareJS() // // document.querySelector(".container-messages").innerHTML = data.html; // document.querySelector(".enter-message-inp").focus() @@ -280,9 +270,7 @@ function openTicket (ticket_id){ // enctype: 'json', data: JSON.stringify(data), success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + middleWareJS() document.querySelector(".info_profile").innerHTML = data.html; diff --git a/static/js/user_profile.js b/static/js/user_profile.js index 6049bcc..2f8ecb4 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -10,9 +10,7 @@ function writeMessage(el){ // enctype: 'json', // data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html; @@ -22,6 +20,7 @@ function writeMessage(el){ //updating the url without reloading window.history.pushState(null, null, '/ru/profile/page/chat/') + middleWareJS() }, error: function (data, exception){ @@ -44,10 +43,7 @@ function technicalSupport(el){ // enctype: 'json', // data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } - getNewMessageSession() + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html; @@ -58,7 +54,7 @@ function technicalSupport(el){ //updating the url without reloading window.history.pushState(null, null, '/ru/profile/page/support/') - + middleWareJS() }, error: function (data, exception){ @@ -80,9 +76,7 @@ function mySubscription(el){ // enctype: 'json', // data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + document.querySelector(".info_profile").innerHTML = data.html; // location.href = '/profile' @@ -94,7 +88,7 @@ function mySubscription(el){ //updating the url without reloading window.history.pushState(null, null, '/ru/profile/page/my_subscribe/') - + middleWareJS() }, error: function (data, exception){ @@ -115,9 +109,7 @@ function myProfile(el){ // enctype: 'json', // data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html; @@ -128,7 +120,7 @@ function myProfile(el){ //updating the url without reloading window.history.pushState(null, null, '/ru/profile/page/change_profile/') - + middleWareJS() }, error: function (data, exception){ @@ -173,9 +165,7 @@ function removeRoute(el) { // enctype: 'json', data: JSON.stringify(remove_data) , success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html; @@ -187,7 +177,7 @@ function removeRoute(el) { //updating the url without reloading window.history.pushState(null, null, '/ru/profile/page/change_profile/') - + middleWareJS() }, error: function (data, exception){ console.log(400) @@ -280,10 +270,10 @@ function searchTown(el){ success: function(data){ el.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; - getNewMessageSession() + return insertSearchList(data, el.name + '_list'); - + middleWareJS() }, error: function (data){ @@ -494,9 +484,7 @@ function sendRoute(el, routeID = null){ // enctype: 'json', data: JSON.stringify(obj_w_el_form), success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html @@ -505,7 +493,7 @@ function sendRoute(el, routeID = null){ let my_routes = document.getElementById("my_routes_id") list_div.forEach(el=>{ el.classList.remove('selected'); }); my_routes.classList.add('selected') - + middleWareJS() }, error: function (data, exception){ @@ -589,9 +577,7 @@ function createRoute(el, owner_type){ // enctype: 'json', data: JSON.stringify(obj), success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html @@ -606,7 +592,7 @@ function createRoute(el, owner_type){ } else { window.history.pushState(null, null, '/ru/profile/page/create_route_for_mover/') } - + middleWareJS() @@ -643,9 +629,7 @@ function getRoute(el){ // enctype: 'json', // data: formData, success: function(data){ - if (data.user_alerts) { - getNewMessageSession() - } + // location.href = '/profile' document.querySelector(".info_profile").innerHTML = data.html; @@ -656,7 +640,7 @@ function getRoute(el){ window.history.pushState(null, null, '/ru/profile/page/my_routes/') - + middleWareJS() }, error: function (data, exception){ diff --git a/templates/blocks/b_finded_routes.html b/templates/blocks/b_finded_routes.html index d34e246..f237c2f 100644 --- a/templates/blocks/b_finded_routes.html +++ b/templates/blocks/b_finded_routes.html @@ -1,6 +1,9 @@ {% load static %}
+
+ +
{% if not routes %} {# Нечего не найдено!#}
@@ -13,9 +16,7 @@
{% endif %} -
- -
+
{% include "blocks/b_search_routes.html" %}