@@ -49,7 +49,7 @@ class DOM {
4949 async createHeaderContent ( h ) {
5050 // this.log.debug(`createHeaderContent (${h.self.id.join()})`, e, elem, h)
5151 let empty = true
52- let elem = this . indexElems . get ( h . self . id )
52+ let elem = this . indexElems . get ( h . self )
5353
5454 if ( h . classes && h . classes . length ) {
5555 empty = false
@@ -92,19 +92,19 @@ class DOM {
9292 if ( empty ) {
9393 elem . addClass ( 'empty' )
9494 }
95- this . lazyLoaders . set ( h . self . id , async ( ) => await this . getHeader ( h ) )
95+ this . lazyLoaders . set ( h . self , async ( ) => await this . getHeader ( h ) )
9696 }
9797
9898 async getHeader ( h ) {
9999 // this.log.debug(`getHeader (${h.self.id.join()})`, h)
100- return true // this.lazyLoaders.get(h.self.id )
100+ return true // this.lazyLoaders.get(h.self)
101101 }
102102
103- async doExpand ( id ) {
103+ async doExpand ( idx ) {
104104 // this.log.debug(`doExpand '${id.join()}'`, id)
105105
106- await this . lazyLoaders . get ( id ) ( )
107- let elem = this . indexElems . get ( id )
106+ await this . lazyLoaders . get ( idx ) ( )
107+ let elem = this . indexElems . get ( idx )
108108 // let content_wrapper = elem.closest('.content-wrapper')
109109 // let content = content_wrapper.children('.content')
110110
@@ -141,10 +141,10 @@ class DOM {
141141 }
142142 }
143143
144- async scrollAt ( id ) {
145- this . log . info ( `scrollAt '${ id . join ( ) } '` , id )
144+ async scrollAt ( idx ) {
145+ this . log . info ( `scrollAt '${ idx . id . join ( ) } '` , idx . id )
146146
147- const e = this . indexElems . get ( id )
147+ const e = this . indexElems . get ( idx )
148148 const broot = e . closest ( '.kunai-branch' )
149149 const croot = broot . closest ( '.content' )
150150 let wrapper = croot . closest ( '.content-wrapper' )
@@ -190,7 +190,7 @@ class DOM {
190190 let li = $ ( '<li>' , { class : 'article' } ) . append (
191191 $ ( '<a>' , { href : idx . url ( ) } ) . text ( idx . id . join ( ) )
192192 )
193- this . indexElems . set ( idx . id , li )
193+ this . indexElems . set ( idx , li )
194194 return li
195195 }
196196
@@ -200,7 +200,7 @@ class DOM {
200200 $ ( '<a>' , { href : m . url ( ) } )
201201 . html ( await m . join_html ( DOM . crOptions ) )
202202 )
203- this . indexElems . set ( m . id , li )
203+ this . indexElems . set ( m , li )
204204
205205 if ( this . kc . getPriorityForIndex ( m ) . index !== this . kc . prioSpecials . get ( '__functions__' ) . index ) {
206206 li . addClass ( 'special' )
@@ -210,7 +210,7 @@ class DOM {
210210
211211 async makeClass ( c ) {
212212 let li = $ ( '<li>' , { class : 'class classy' } )
213- this . indexElems . set ( c . self . id , li )
213+ this . indexElems . set ( c . self , li )
214214
215215 $ ( '<a>' , { class : 'self' } ) . attr ( 'href' , c . self . url ( ) ) . html (
216216 await c . self . join_html ( DOM . crClassOptions )
@@ -233,7 +233,7 @@ class DOM {
233233
234234 async makeOther ( o ) {
235235 let li = $ ( '<li>' , { class : `other ${ o . id . type } ` } )
236- this . indexElems . set ( o . id , li )
236+ this . indexElems . set ( o , li )
237237
238238 if ( IndexID . isClassy ( o . id . type ) ) {
239239 li . addClass ( 'classy' )
@@ -261,17 +261,17 @@ class DOM {
261261
262262 async makeExpandable ( elem , obj ) {
263263 // this.log.debug(`makeExpandable '${obj.self.id.join()}'`, elem, obj)
264- this . indexElems . set ( obj . self . id , elem )
264+ this . indexElems . set ( obj . self , elem )
265265 this . lazyLoaders . set (
266- obj . self . id ,
266+ obj . self ,
267267 async ( ) => { await this . createContent ( obj ) }
268268 )
269269
270270 let bar = $ ( '<div>' , { class : 'expandbar' } ) . appendTo ( elem )
271271
272272 bar . append (
273273 $ ( '<div>' , { class : 'expander' } ) . on ( 'click' , async ( ) => {
274- await this . doExpand ( obj . self . id )
274+ await this . doExpand ( obj . self )
275275 } )
276276 )
277277
@@ -329,27 +329,21 @@ class Treeview {
329329 const h = this . page_idx . in_header
330330 this . log . info ( `expanding current page header '${ h . id . join ( ) } '` , h , this . page_idx )
331331
332- await this . dom . doExpand ( h . id )
332+ await this . dom . doExpand ( h )
333333 } else {
334334 if ( IType . isHeader ( this . page_idx . id . type ) ) {
335- await this . dom . doExpand ( this . page_idx . id )
335+ await this . dom . doExpand ( this . page_idx )
336336 } else {
337337 this . log . info ( `current page '${ this . page_idx . id . join ( ) } ' is not classy. nothing left to expand` )
338338 }
339339 }
340340
341341 if ( ids . length > 1 ) {
342- if ( this . page_idx . id . type === 'article' && this . page_idx . id . indexes . length > 1 ) {
343- const selector = `[data-lang-id="C++${ this . page_idx . cpp_version } "] li.article`
344- const article = [ ...$ ( selector ) ] . find ( li => li . innerText === this . page_idx . name )
345- this . dom . indexElems . set ( this . page_idx . id , $ ( article ) )
346- }
347-
348342 // highlight self
349- this . dom . indexElems . get ( this . page_idx . id ) . addClass ( 'current-page' )
343+ this . dom . indexElems . get ( this . page_idx ) . addClass ( 'current-page' )
350344
351345 // finally, always scroll to self
352- await this . dom . scrollAt ( this . page_idx . id )
346+ await this . dom . scrollAt ( this . page_idx )
353347 }
354348 } catch ( e ) {
355349 this . log . error ( `Failed to determine current page for id '${ ids . join ( '/' ) } '. Sidebar will NOT work properly! (${ e } )` , ids )
0 commit comments