diff --git a/static/js/check_new_messages.js b/static/js/check_new_messages.js index b5f00df..ddcbb61 100644 --- a/static/js/check_new_messages.js +++ b/static/js/check_new_messages.js @@ -1,36 +1,70 @@ +window.onload = function () { + funcFocus() +} +// +// document.querySelector(".enter-message-inp").onload( +// funcFocus() +// ) +function funcFocus(){ -$(document).ready( - check_new_messages_timeout() - -) + document.querySelector(".enter-message-inp").focus() +} var check_msg = null var it = 0 -function check_new_messages_timeout(){ + + +// function initial_function (){ +// var it_set_func = 0 +// var it_func = 0 +// check_new_messages_timeout(60000,it_set_func,it_func) +// } + +function check_new_messages_timeout(timeout_time=1000){ let window = document.querySelector(".container-messages") - if (window !== null){ - - - } + // if (window !== null){ + // + // + // } + // if (it_set_func === 0){ + // // clearInterval(check_msg) + // if (window === null){ + // it_set_func++ + // check_new_messages_timeout(60000,it_set_func,it_func) + // } else { + // let new_timeout_time = 1000 + // it_set_func++ + // check_new_messages_timeout(new_timeout_time,it_set_func,it_func) + // } + // + // } check_msg = setInterval(function () { - // let new_message = getNewMessageSession() - // let user_online = userOnline('set') - window = document.querySelector(".container-messages") - if (window === null){ + + // let new_message = getNewMessageSession() + // let user_online = userOnline('set') + window = document.querySelector(".container-messages") + if (window === null){ + // let new_timeout_time = 60000 // - } else { - it = 0 - check_new_messages(window) - } - }, - 60000) + // check_new_messages_timeout(new_timeout_time,it_set_func,it_func) + } else { + // if (it_func === 0){ + // let new_timeout_time = 1000 + // it_func++ + // check_new_messages_timeout(new_timeout_time,it_set_func,it_func) + // } + check_new_messages(window) + } + + }, + timeout_time) } diff --git a/static/js/user_profile(boris).js b/static/js/user_profile(boris).js index 92d7aaf..ea740bf 100644 --- a/static/js/user_profile(boris).js +++ b/static/js/user_profile(boris).js @@ -184,7 +184,9 @@ function selectedUserMessenger (ticket_id=null,user_id=null){ getNewMessageSession() } + document.querySelector(".info_profile").innerHTML = data.html; + document.querySelector(".enter-message-inp").focus() }, error: function (data){ diff --git a/templates/blocks/b_user_profile.html b/templates/blocks/b_user_profile.html index 374ebec..9507e50 100644 --- a/templates/blocks/b_user_profile.html +++ b/templates/blocks/b_user_profile.html @@ -1,4 +1,4 @@ -
+
{% csrf_token %}