1
0
isundil 8 жил өмнө
parent
commit
de5c4406a3
2 өөрчлөгдсөн 108 нэмэгдсэн , 97 устгасан
  1. 12 2
      cli/ui.js
  2. 96 95
      srv/public/mimouchat.min.js

+ 12 - 2
cli/ui.js

@@ -329,6 +329,7 @@ function onRoomUpdated() {
             if (MSG_GROUPS[currentGroup]) {
                 if (currentMsgInGroup >= MSG_GROUPS[currentGroup].messages.length) {
                     if (!msg.removed) {
+                        var sameDayThanPrevious = isSameDay(msg.ts, prevTs);
                         if (msg instanceof MeMessage || (prevMsg && prevMsg.userId !== msg.userId) || !msg.userId) {
                             while (MSG_GROUPS[currentGroup].content.children[currentMsgInGroup])
                                 MSG_GROUPS[currentGroup].content.children[currentMsgInGroup].remove();
@@ -355,8 +356,7 @@ function onRoomUpdated() {
                             prevMsg = msg;
                             return;
                         }
-                    }
-                    // else message got removed
+                    } // else message got removed
                 }
                 if (MSG_GROUPS[currentGroup]) {
                     if (MSG_GROUPS[currentGroup].messages[currentMsgInGroup] === msg.id) {
@@ -398,6 +398,7 @@ function onRoomUpdated() {
             if (!MSG_GROUPS[currentGroup]) {
                 // next group
                 MSG_GROUPS[currentGroup] = createMessageGroupDom(DATA.context.getUser(msg.userId), msg.username);
+                /** @type {Element} */
                 var dom = msg.getDom();
                 firstTsCombo = msg.ts;
                 if ((!prevMsg || prevMsg.ts <= SELECTED_ROOM.lastRead) && msg.ts > SELECTED_ROOM.lastRead) {
@@ -420,6 +421,15 @@ function onRoomUpdated() {
                     currentMsgInGroup = 0;
                     firstTsCombo = msg.ts;
                 }
+                if (!currentMsgGroupDom || currentMsgGroupDom.content.firstChild === dom) {
+                    if (sameDayThanPrevious) {
+                        (currentMsgGroupDom || dom).classList.remove(R.klass.msg.firstOfDay);
+                    } else {
+                        (currentMsgGroupDom || dom).classList.add(R.klass.msg.firstOfDay);
+                        (currentMsgGroupDom || dom).dataset["date"] = locale.formatDay(msg.ts);
+                    }
+                }
+                prevTs = msg.ts;
                 return;
             }
         });

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 96 - 95
srv/public/mimouchat.min.js


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно