File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 505505 structure [ parts [ 1 ] ] . children . push ( parts [ 2 ] )
506506 }
507507 }
508- const buildRow = async ( fileName ) => {
508+ const buildRow = async ( fileName , insertAfterRow = null ) => {
509509 response = await fetch ( `examples/${ fileName } ` )
510510 let turtle = await response . text ( )
511511 let details = await getDetailsFromGraphTurtle ( turtle )
520520 td = document . createElement ( "td" )
521521 td . appendChild ( buildActionSpan ( "Load" , ( ) => loadTurtle ( turtle ) ) )
522522 tr . appendChild ( td )
523- table . appendChild ( tr )
523+ if ( insertAfterRow && insertAfterRow . parentNode === table ) {
524+ table . insertBefore ( tr , insertAfterRow . nextSibling )
525+ } else {
526+ table . appendChild ( tr )
527+ }
528+ return tr
524529 }
525530 for ( let key of Object . keys ( structure ) ) {
526531 if ( key === "ROOT" ) {
537542 td . addEventListener ( "click" , async ( ) => {
538543 if ( structure [ key ] . expanded ) return
539544 structure [ key ] . expanded = true
545+ let lastRow = tr
540546 for ( let child of structure [ key ] . children ) {
541- await buildRow ( `${ key } /${ child } ` )
547+ lastRow = await buildRow ( `${ key } /${ child } ` , lastRow )
542548 }
543549 } )
544550 tr . appendChild ( td )
You can’t perform that action at this time.
0 commit comments