File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 174174
175175 let nn = 'chat-room-' + key ;
176176 let ntab = tab . cloneNode ( true ) ;
177+ ntab . id = key ;
177178 ntab . textContent = key ;
178179 ntab . onclick = e => show ( nn ) ;
179180 tabs . append ( ntab ) ;
199200 } //initdom
200201
201202
202- function show ( nn ) {
203+ function show ( id , nn ) {
203204
205+ tabs . childNodes . forEach ( node => {
206+
207+ if ( node . nodeType !== Node . ELEMENT_NODE ) return ;
208+
209+ if ( node . id === id ) {
210+ node . classList . add ( 'active' ) ;
211+ node . classList . remove ( 'inactive' ) ;
212+ } else {
213+ node . classList . remove ( 'active' ) ;
214+ node . classList . add ( 'inactive' ) ;
215+ }
216+
217+ } ) ;
218+
204219 view . childNodes . forEach ( node => {
205220
206- if ( node . nodeType !== Node . ELEMENT_NODE ) return ;
207-
208- var d = 'none' ;
209- if ( node . nodeName . toLowerCase ( ) === nn ) {
210- d = '' ;
211- }
212- node . style . display = d ;
213-
221+ if ( node . nodeType !== Node . ELEMENT_NODE ) return ;
222+
223+ var d = 'none' ;
224+ if ( node . nodeName . toLowerCase ( ) === nn ) {
225+ d = '' ;
226+ }
227+ node . style . display = d ;
228+
214229 } ) ;
215230
216231 } //show
You can’t perform that action at this time.
0 commit comments