Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loadChats(chats){
- console.log(chats);
- var print_chats = "";
- for(let chat in chats){
- chatID = chat.chatID;
- chat_type = chat.chat_type;
- chatName = chat.chatName;
- chatImage = "../src/profile_pictures/"+chat.chatImage;
- mess_text=chat.mess_text;
- date = new Date(chat.date_time)
- date_time= date.getHours() + ":" + date.getMinutes();
- print_chats += "<li class='select_chat'>";
- print_chats += "<button class='select_chat'";
- print_chats += "onClick='loadConversation("+chat_type+","+chatID+")'>";
- print_chats += "<div class='select_chat'>";
- print_chats += "<div class='propic_from_list'";
- if(chat_type=='userID')
- print_chats += "id='propic_from_list$chatID'";
- print_chats += "style='background-image:url(\""+chatImage+"\");'>";
- print_chats += "</div> ";
- print_chats += "<p class='chat_name'>"+chatName+"</p>";
- print_chats += "<span class='mess_preview'>"+mess_text+"</span>";
- print_chats += "<span class='time_preview'>"+date_time+"</span>";
- print_chats += "</div></a></li>";
- console.log("helo");
- }
- console.log(print_chats);
- document.getElementById("chats").innerHTML = print_chats;
- }
Advertisement
Add Comment
Please, Sign In to add comment