Darksoul__

Untitled

Mar 23rd, 2022
888
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadChats(chats){
  2.     console.log(chats);
  3.     var print_chats = "";    
  4.     for(let chat in chats){                                
  5.         chatID = chat.chatID;
  6.         chat_type = chat.chat_type;
  7.         chatName = chat.chatName;  
  8.         chatImage = "../src/profile_pictures/"+chat.chatImage; 
  9.         mess_text=chat.mess_text;  
  10.         date = new Date(chat.date_time)
  11.         date_time= date.getHours() + ":" + date.getMinutes();  
  12.  
  13.         print_chats += "<li class='select_chat'>";
  14.         print_chats += "<button class='select_chat'";
  15.         print_chats += "onClick='loadConversation("+chat_type+","+chatID+")'>";
  16.         print_chats += "<div class='select_chat'>";
  17.         print_chats += "<div class='propic_from_list'";
  18.         if(chat_type=='userID')
  19.             print_chats += "id='propic_from_list$chatID'";
  20.         print_chats += "style='background-image:url(\""+chatImage+"\");'>";
  21.         print_chats += "</div> ";
  22.         print_chats += "<p class='chat_name'>"+chatName+"</p>";
  23.         print_chats += "<span class='mess_preview'>"+mess_text+"</span>";
  24.         print_chats += "<span class='time_preview'>"+date_time+"</span>";
  25.         print_chats += "</div></a></li>";
  26.         console.log("helo");
  27.     }
  28.     console.log(print_chats);
  29.     document.getElementById("chats").innerHTML = print_chats;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment