This commit is contained in:
mmrbnjd
2025-07-11 20:37:28 +03:30
parent 1924c88e7a
commit ff342a53c0
156 changed files with 13746 additions and 35 deletions

View File

@@ -0,0 +1,16 @@
window.observeVisibility = (dotNetRef) => {
const elements = document.querySelectorAll(".chat-bubble[data-id]");
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const id = entry.target.getAttribute("data-id");
dotNetRef.invokeMethodAsync("MarkAsRead", parseInt(id));
observer.unobserve(entry.target); // دیگه دوباره نخونه
}
});
}, {
threshold: 0.6 // 60٪ از پیام دیده بشه
});
elements.forEach(el => observer.observe(el));
};