Skip to content

Commit 38f41b2

Browse files
save file
1 parent d267b88 commit 38f41b2

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

html/chat-room-tmp/chat-room-tmp.html

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@
176176
//:
177177

178178

179+
var shadow;
180+
181+
179182
//var server = 'https://localhost:3009/chat/';
180183
var server = '';
181184
console.log('server',server);
@@ -199,23 +202,26 @@
199202

200203
obj.initdom = async function(){
201204

202-
view = $('#view');
205+
shadow = host.shadowRoot;
206+
207+
208+
view = $(shadow,'#view');
203209

204210
msg = $(view,'.msg');
205211
msg.remove();
206212

207213
view.style.display = '';
208214

209215

210-
var info = $('#info');
216+
var info = $(shadow,'#info');
211217

212218
$.chkbox(info,'#show-password',btn.password);
213219

214-
$('#txt').onkeydown = kd.user;
215-
$('#txt').focus();
220+
$(shadow,'#txt').onkeydown = kd.user;
221+
$(shadow,'#txt').focus();
216222

217-
$('[value=send]').onclick = btn.send;
218-
$('[value=abort]').onclick = ()=>poll.abort=true;
223+
$(shadow,'[value=send]').onclick = btn.send;
224+
$(shadow,'[value=abort]').onclick = ()=>poll.abort=true;
219225

220226

221227
post.start();
@@ -226,9 +232,9 @@
226232

227233
btn.password = function(){
228234

229-
$('#txt').focus();
235+
$(shadow,'#txt').focus();
230236

231-
var node = $('#password');
237+
var node = $(shadow,'#password');
232238
if(node.getAttribute('type')=='password'){
233239
node.removeAttribute('type');
234240
}else{
@@ -251,10 +257,10 @@
251257

252258
$('#txt').focus();
253259

254-
var txt = $('#txt').value;
260+
var txt = $(shadow,'#txt').value;
255261
$('#txt').value = '';
256-
var user = $('#user').value;
257-
var password = $('#password').value;
262+
var user = $(shadow,'#user').value;
263+
var password = $(shadow,'#password').value;
258264

259265
post.msg({user,password,txt});
260266

@@ -354,7 +360,7 @@
354360

355361
async function del(){
356362

357-
var password = $('#password').value;
363+
var password = $(shadow,'#password').value;
358364
var result = await post.del({password,id})
359365
if(!result)return;
360366

0 commit comments

Comments
 (0)