Browse Source

[wip] remove all dom content when changing page

isundil 8 years ago
parent
commit
2fdae48d86
2 changed files with 4 additions and 2 deletions
  1. 3 1
      cli/ui.js
  2. 1 1
      srv/public/mimouchat.min.js

+ 3 - 1
cli/ui.js

@@ -167,6 +167,7 @@ function onRoomSelected() {
     }
     var roomLi = document.getElementById("room_" +SELECTED_ROOM.id);
     document.getElementById(R.id.currentRoom.title).textContent = name;
+    document.getElementById(R.id.currentRoom.content).textContent = '';
     MSG_GROUPS = [];
     onRoomUpdated();
     focusInput();
@@ -354,7 +355,8 @@ 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) {

+ 1 - 1
srv/public/mimouchat.min.js

@@ -57,7 +57,7 @@ b.dataset.count=Object.keys(a.j||{}).length):b.className="chat-context-room chat
 f.length&&a.appendChild(ob(H.ob));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);pb.apply(document.getElementById("chanSearch"));qb()?rb(P.a.id,P.j,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"}):Ja()&&(b=__native.getPreviousChannel())&&(document.location.hash=b)}
 function sb(){ua(function(a){var b=a.B,c;for(c in a.self.m)if(!a.self.m[c].ka){var d=document.getElementById("room_"+c);b[c]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing")}for(var e in a.j)(c=a.j[e].S)&&!c.ka&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});tb()}
 function tb(){var a;document.getElementById("whoistyping").textContent="";if(P&&Q&&(a=P.B[Q.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=E(d))?b.appendChild(ub(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function vb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");wb()}
-function xb(){var a=Q.name||(Q.a?Q.a.getName():void 0);if(!a){console.error("No name provided for ",Q);var a=[],b;for(b in Q.j)a.push(Q.j[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;T=[];yb();hb();document.getElementById("fileUploadContainer").classList.add("hidden");zb();S&&(S=null,V());R&&(R=null,V());tb()}
+function xb(){var a=Q.name||(Q.a?Q.a.getName():void 0);if(!a){console.error("No name provided for ",Q);var a=[],b;for(b in Q.j)a.push(Q.j[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;document.getElementById("chatWindow").textContent="";T=[];yb();hb();document.getElementById("fileUploadContainer").classList.add("hidden");zb();S&&(S=null,V());R&&(R=null,V());tb()}
 function V(){if(S){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){S=null;V()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(S.P())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";hb()}
 function Ab(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;Ab()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(R.P());document.getElementById("msgInput").value=R.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";hb()}
 window.toggleReaction=function(a,b,c){var d=C.a[a],e,f;(d=C.a[a])&&(e=oa(d,b))&&(f=D(C.context,a))&&(e.I[c]&&-1!==e.I[c].indexOf(f.self.id)?O("DELETE","api/reaction?room="+encodeURIComponent(a)+"&msg="+b+"&reaction="+encodeURIComponent(c)).a():Bb(a,b,c))};function Cb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}