@@ -1284,13 +1284,27 @@ document.addEventListener("DOMContentLoaded", function () {
12841284 }
12851285 setupModalInfoButton ( name ) ;
12861286
1287- // Inject info button
1287+ // Inject info button - FIXED for Tic Tac Toe and all projects
12881288 var projectContent = modalBody . querySelector ( ".project-content" ) ;
12891289 if ( projectContent ) {
1290+ // First, check if there's already an info button (to avoid duplicates)
1291+ if ( projectContent . querySelector ( ".inline-info-btn" ) ) {
1292+ // Info button already exists, skip injection
1293+ console . log ( 'ℹ️ Info button already exists for' , name ) ;
1294+ } else {
1295+ // Look for any heading element
12901296 var firstHeading = projectContent . querySelector ( "h2, h3, .resume-analyzer-copy h2, .pet-title" ) ;
1297+
1298+ // Special case for Tic Tac Toe - look for the heading inside project-content
1299+ if ( ! firstHeading ) {
1300+ firstHeading = projectContent . querySelector ( '[style*="display: flex"] h2' ) ;
1301+ }
1302+
12911303 if ( ! firstHeading ) {
1304+ // Look for any element that might be a title
12921305 firstHeading = projectContent . querySelector ( '[class*="title"], [class*="header"] h2' ) ;
12931306 }
1307+
12941308 if ( firstHeading && ! projectContent . querySelector ( ".inline-info-btn" ) ) {
12951309 var infoBtn = document . createElement ( "button" ) ;
12961310 infoBtn . className = "inline-info-btn" ;
@@ -1308,7 +1322,9 @@ document.addEventListener("DOMContentLoaded", function () {
13081322 e . stopPropagation ( ) ;
13091323 if ( typeof getProjectInstructions === "function" ) {
13101324 var info = getProjectInstructions ( name ) ;
1311- showInfoModal ( info . title , info . steps ) ;
1325+ if ( info && typeof showInfoModal === "function" ) {
1326+ showInfoModal ( info . title , info . steps ) ;
1327+ }
13121328 }
13131329 } ) ;
13141330
@@ -1318,7 +1334,8 @@ document.addEventListener("DOMContentLoaded", function () {
13181334 firstHeading . appendChild ( infoBtn ) ;
13191335 }
13201336 }
1321- } ) ;
1337+ }
1338+ } ) ;
13221339
13231340 // Setup focus trap
13241341 if ( removeTrap ) removeTrap ( ) ;
0 commit comments