@@ -51,7 +51,7 @@ function layoutNodes() {
5151 cy_layout . run ( ) ;
5252}
5353
54- const BUTTON_ICONS = {
54+ const BUTTON_ICON_FNAMES = {
5555 "source" : "github.svg" ,
5656 "documentation" : "book.svg" ,
5757 "homepage" : "home.svg" ,
@@ -64,6 +64,7 @@ const BUTTON_ICONS = {
6464 "installation" : "package.svg" ,
6565 "email" : "mail.svg"
6666}
67+ var BUTTON_ICONS = { } ;
6768
6869const BUTTON_ROWS = [
6970 [ "homepage" , "download" , "source" ] ,
@@ -73,10 +74,9 @@ const BUTTON_ROWS = [
7374
7475function urlButton ( type , url , btnClass ) {
7576 const button = document . createElement ( "button" ) ;
76- let iconFile = BUTTON_ICONS [ type ] ;
7777 button . type = "button"
7878 button . classList . add ( 'btn' , 'm-1' ) ;
79- let icon = `<img aria-hidden='true' focusable='false' class='icon' src='assets/ ${ iconFile } '></img>` ;
79+ let icon = BUTTON_ICONS [ type ] ;
8080 button . innerHTML = icon + " " + type ;
8181 if ( url !== undefined ) {
8282 button . classList . add ( btnClass ) ;
@@ -333,7 +333,24 @@ function newEdge(name, relation) {
333333 }
334334}
335335
336+ function load_button_icons ( ) {
337+ // Load SVG content for inline inclusion
338+ for ( const [ type , fname ] of Object . entries ( BUTTON_ICON_FNAMES ) ) {
339+ fetch ( `assets/${ fname } ` )
340+ . then ( response => response . text ( ) )
341+ . then ( svg => {
342+ BUTTON_ICONS [ type ] = svg ;
343+ } )
344+ . catch ( err => {
345+ console . error ( `Failed to load icon for ${ type } (${ fname } ):` , err ) ;
346+ BUTTON_ICONS [ type ] = "" ;
347+ } ) ;
348+ }
349+ }
350+
336351function create_cy_elements ( data , style ) {
352+ // Not quite the right place, but convenient to do htis here
353+ load_button_icons ( ) ;
337354 // Create a "meta-node" for all simulators
338355 elements . push ( newNode ( "simulators" , { full_name : "Simulators" , features : "meta" } ) ) ;
339356 for ( const [ name , description ] of Object . entries ( data ) ) {
0 commit comments