Commit 7a628aee6fa35bfb4935e55269eb4b431013c417

Authored by Zambom
1 parent ae6c1839

Chat javascript adjusts

Showing 1 changed file with 17 additions and 1 deletions   Show diff stats
amadeus/static/js/chat.js
@@ -53,6 +53,12 @@ function getModalInfo(btn, space, space_type) { @@ -53,6 +53,12 @@ function getModalInfo(btn, space, space_type) {
53 $(this).animate({scrollTop: height}, 0); 53 $(this).animate({scrollTop: height}, 0);
54 }); 54 });
55 55
  56 + $(".messages-container").on('scroll', function () {
  57 + if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
  58 + $('.messages_new').hide();
  59 + }
  60 + });
  61 +
56 setShortChatFormSubmit(); 62 setShortChatFormSubmit();
57 setFiltersSubmitAndPagination(); 63 setFiltersSubmitAndPagination();
58 } else { 64 } else {
@@ -63,6 +69,12 @@ function getModalInfo(btn, space, space_type) { @@ -63,6 +69,12 @@ function getModalInfo(btn, space, space_type) {
63 $(this).animate({scrollTop: height}, 0); 69 $(this).animate({scrollTop: height}, 0);
64 }); 70 });
65 71
  72 + $(".messages-container").on('scroll', function () {
  73 + if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
  74 + $('.messages_new').hide();
  75 + }
  76 + });
  77 +
66 setShortChatFormSubmit(); 78 setShortChatFormSubmit();
67 setFiltersSubmitAndPagination(); 79 setFiltersSubmitAndPagination();
68 }); 80 });
@@ -73,6 +85,10 @@ function getModalInfo(btn, space, space_type) { @@ -73,6 +85,10 @@ function getModalInfo(btn, space, space_type) {
73 }); 85 });
74 86
75 $("#msg_editable").on('focusin', function () { 87 $("#msg_editable").on('focusin', function () {
  88 + $(".msg_placeholder").hide();
  89 + });
  90 +
  91 + $("#msg_editable").on('keydown', function () {
76 $("#send-img").hide(); 92 $("#send-img").hide();
77 $("#send-msg").show(); 93 $("#send-msg").show();
78 94
@@ -227,7 +243,7 @@ function setShortChatFormSubmit() { @@ -227,7 +243,7 @@ function setShortChatFormSubmit() {
227 new_msgs[data.talk_id].push(data.new_id); 243 new_msgs[data.talk_id].push(data.new_id);
228 244
229 editable.html(""); 245 editable.html("");
230 - editable.trigger("focusout"); 246 + editable.blur();
231 247
232 frm.attr('action', data.new_form_url); 248 frm.attr('action', data.new_form_url);
233 $("#send-img").data('url', data.new_form_url); 249 $("#send-img").data('url', data.new_form_url);