Heera/public/assets/js/pages/chat.init.js

1 line
26 KiB
JavaScript
Raw Normal View History

2024-05-16 03:46:08 +00:00
function searchMessages(){var t,s=document.getElementById("searchMessage").value.toUpperCase(),e=document.getElementById("users-conversation").getElementsByTagName("li");Array.from(e).forEach(function(e){t=e.getElementsByTagName("p")[0]?e.getElementsByTagName("p")[0]:"",-1<(t.textContent||t.innerText?t.textContent||t.innerText:"").toUpperCase().indexOf(s)?e.style.display="":e.style.display="none"})}!function(){var r="assets/images/users/user-dummy-img.jpg",n="assets/images/users/multi-user.jpg",o=!1;function s(){var s=document.querySelectorAll(".user-chat");Array.from(document.querySelectorAll(".chat-user-list li a")).forEach(function(e){e.addEventListener("click",function(e){s.forEach(function(e){e.classList.add("user-chat-show")});var t=document.querySelector(".chat-user-list li.active");t&&t.classList.remove("active"),this.parentNode.classList.add("active")})}),document.querySelectorAll(".user-chat-remove").forEach(function(e){e.addEventListener("click",function(e){s.forEach(function(e){e.classList.remove("user-chat-show")})})})}document.querySelectorAll(".favourite-btn").forEach(function(e){e.addEventListener("click",function(e){this.classList.toggle("active")})});function e(e,t){var s=new XMLHttpRequest;s.open("GET",l+e,!0),s.responseType="json",s.onload=function(){var e=s.status;t(200===e?null:e,s.response)},s.send()}var a="users-chat",c="users",l="assets/json/",d="",m=1;v(a);function u(e,t,s,n,a){var r='<div class="ctext-wrap">';if(null!=t)r+='<div class="ctext-wrap-content" id='+e+'><p class="mb-0 ctext-content">'+t+"</p></div>";else if(s&&0<s.length){for(r+='<div class="message-img mb-0">',i=0;i<s.length;i++)r+='<div class="message-img-list"> <div> <a class="popup-img d-inline-block" href="'+s[i]+'"> <img src="'+s[i]+'" alt="" class="rounded border"> </a> </div> <div class="message-img-link"> <ul class="list-inline mb-0"> <li class="list-inline-item dropdown"> <a class="dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="ri-more-fill"></i> </a> <div class="dropdown-menu"> <a class="dropdown-item" href="'+s[i]+'" download=""><i class="ri-download-2-line me-2 text-muted align-bottom"></i>Download</a> <a class="dropdown-item" href="#"><i class="ri-reply-line me-2 text-muted align-bottom"></i>Reply</a> <a class="dropdown-item" href="#"><i class="ri-share-line me-2 text-muted align-bottom"></i>Forward</a> <a class="dropdown-item" href="#"><i class="ri-bookmark-line me-2 text-muted align-bottom"></i>Bookmark</a> <a class="dropdown-item delete-image" href="#"><i class="ri-delete-bin-5-line me-2 text-muted align-bottom"></i>Delete</a> </div> </li> </ul> </div> </div>';r+="</div>"}else 0<n.length&&(r+='<div class="ctext-wrap-content"> <div class="p-3 border-primary border rounded-3"> <div class="d-flex align-items-center attached-file"> <div class="flex-shrink-0 avatar-sm me-3 ms-0 attached-file-avatar"> <div class="avatar-title bg-primary-subtle text-primary rounded-circle font-size-20"> <i class="ri-attachment-2"></i> </div> </div> <div class="flex-grow-1 overflow-hidden"> <div class="text-start"> <h5 class="font-size-14 mb-1">design-phase-1-approved.pdf</h5> <p class="text-muted text-truncate font-size-13 mb-0">12.5 MB</p> </div> </div> <div class="flex-shrink-0 ms-4"> <div class="d-flex gap-2 font-size-20 d-flex align-items-start">