From 957b8c9041f1d76eda88d735101ade54ccc89947 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Tue, 15 Aug 2023 17:56:38 +0300 Subject: [PATCH] 0.0.97 preloader for addres_point --- static/js/user_profile.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/static/js/user_profile.js b/static/js/user_profile.js index a8ab470..e5bd403 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -167,8 +167,17 @@ function confirmRemove(el) { function searchTown(el){ - document.getElementById('id_from_address_point_txt').style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; - document.getElementById('id_to_address_point_txt').style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; + let from_ap = document.getElementById('id_from_address_point_txt'); + let to_ap = document.getElementById('id_to_address_point_txt'); + + if(el.value.length>0){ + from_ap.style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; + to_ap.style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; + } else{ + from_ap.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + to_ap.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + } + if(el.value.length>=3){ let timer = null @@ -195,8 +204,11 @@ function searchTown(el){ // enctype: 'json', data: JSON.stringify(get_address_point), success: function(data){ - document.getElementById('id_from_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'; + + from_ap.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + to_ap.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + + getNewMessageSession()