9696 function updateDataUSAIframe ( forceUpdate ) {
9797 const hash = getHash ( ) ;
9898 const priorHashValue = window . priorHash ?. state ;
99+ const stateString = hash . state || '' ;
100+ const stateCodes = stateString . split ( ',' ) . map ( s => s . trim ( ) ) . filter ( Boolean ) ;
101+ const container = $ ( '#iframe-container' ) ;
102+
103+ if ( ! stateCodes . length ) {
104+ container . find ( '.state-iframe-wrapper' ) . remove ( ) ;
105+ container . hide ( ) ;
106+ return ;
107+ }
99108
100- // Default to Georgia if no state in hash
101- const stateString = hash . state || 'GA' ;
102- const stateCodes = stateString . split ( ',' ) . filter ( s => s . trim ( ) ) ;
109+ container . show ( ) ;
103110
104111 const conditionPassed = forceUpdate || ( stateString && stateString !== priorHashValue ) ;
105112 // alert('updateDataUSAIframe - forceUpdate: ' + forceUpdate + ' - stateString: ' + stateString + ' - priorHashValue: ' + (priorHashValue || 'undefined') + ' - Condition passed: ' + conditionPassed);
106113
107114 // Process if state changed or initial load
108115 if ( conditionPassed ) {
109- const container = $ ( '#iframe-container' ) ;
110-
111116 // Update/create iframes for each state
112117 stateCodes . forEach ( ( stateCode , index ) => {
113118 stateCode = stateCode . trim ( ) ;
260265
261266 if ( newStateCode ) {
262267 const hash = getHash ( ) ;
263- const currentStates = hash . state ? hash . state . split ( ',' ) : [ 'GA' ] ;
268+ const currentStates = hash . state ? hash . state . split ( ',' ) . map ( state => state . trim ( ) ) . filter ( Boolean ) : [ ] ;
264269
265270 // Update the state at this index
266271 currentStates [ iframeIndex ] = newStateCode ;
@@ -509,7 +514,7 @@ <h2>Product Lifecycle Tools</h2>
509514 < div id ="iframe-loading " style ="display:none; position:absolute; top:10px; right:10px; padding:8px 12px; background:rgba(255,255,255,0.95); border:1px solid #ddd; border-radius:4px; z-index:10; font-size:14px; color:#666; box-shadow:0 2px 4px rgba(0,0,0,0.1); ">
510515 Loading...
511516 </ div >
512- < div id ="iframe-container "> </ div >
517+ < div id ="iframe-container " style =" display:none; " > </ div >
513518 </ div >
514519
515520 < div style ="padding:20px 0; ">
@@ -883,4 +888,4 @@ <h3>Project Areas</h3>
883888
884889
885890</ body >
886- </ html >
891+ </ html >
0 commit comments