Skip to content

Commit 8e2445a

Browse files
save file
1 parent ca5645f commit 8e2445a

1 file changed

Lines changed: 4 additions & 25 deletions

File tree

html/chat-room/html/chat-room-simple/chat-room-simple.html

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,6 @@
5050
</style>
5151

5252

53-
<div class=msg style='display:none'>
54-
<div class=username>
55-
</div>
56-
<div class=txt>
57-
</div>
58-
<div class=ts>
59-
</div>
60-
<img class=del>
61-
</div>
62-
63-
6453
<section id=user-root>
6554

6655
<div id=info>
@@ -123,11 +112,7 @@
123112
var shadow;
124113

125114
var ui = {};
126-
var msg;
127-
128115

129-
//Object.defineProperty(obj,'username',{get:()=>$(shadow,'#username').value});
130-
//Object.defineProperty(obj,'password',{get:()=>$(shadow,'#password').value});
131116

132117

133118
var btn = {};
@@ -153,11 +138,6 @@
153138
shadow = host.shadowRoot;
154139

155140

156-
msg = $(shadow,'.msg');
157-
msg.remove();
158-
msg.style.display = '';
159-
160-
161141
var info = $(shadow,'#info');
162142
$(info,'#show').onclick = btn.password;
163143

@@ -243,16 +223,16 @@
243223

244224

245225

246-
obj.display = function(data){
226+
obj.display = function(data,nmsg){
247227

248228
var type = data.type;
249-
var result = disp[type](data);
229+
var result = disp[type](data,nmsg);
250230
return result;
251231

252232
}//display
253233

254234

255-
disp.message = function(data){
235+
disp.message = function(data,nmsg){
256236

257237
var {msg_id,username,txt,ts} = data;
258238

@@ -280,7 +260,6 @@
280260
}
281261

282262

283-
var nmsg = msg.cloneNode(true);
284263
nmsg.msg_id = msg_id;
285264
$(nmsg,'.username').textContent = username;
286265
$(nmsg,'.txt').textContent = txt;
@@ -308,7 +287,7 @@
308287
}//display
309288

310289

311-
disp.delete = function({del_id}){
290+
disp.delete = function({del_id},nmsg){
312291
console.log('delete',del_id);
313292
var item = msgs.find(data=>data.msg_id===del_id);
314293
if(!item)return;

0 commit comments

Comments
 (0)