@@ -380,6 +380,8 @@ function addOpenInCodePenForm(
380
380
381
381
var button = document . createElement ( 'button' ) ;
382
382
button . innerText = 'Open In CodePen' ;
383
+ button . id = buttonId ;
384
+ button . style . display = 'none' ;
383
385
384
386
form . appendChild ( input ) ;
385
387
form . appendChild ( button ) ;
@@ -425,32 +427,36 @@ function addOpenInCodePenForm(
425
427
}
426
428
totalFetchedFiles ++ ;
427
429
} else {
428
- hideButton ( buttonId , 'Could not load resource: ' + href ) ;
430
+ console . warn (
431
+ "Not showing 'Open in Codepen' button. Could not load resource: " +
432
+ href
433
+ ) ;
429
434
}
430
435
} ;
431
436
request . onerror = function ( ) {
432
- hideButton ( buttonId , 'Could not load resource: ' + fileLink . href ) ;
437
+ console . warn (
438
+ "Not showing 'Open in Codepen' button. Could not load resource: " +
439
+ fileLink . href
440
+ ) ;
433
441
} ;
434
442
request . send ( ) ;
435
443
}
436
444
437
445
var timerId = setInterval ( ( ) => {
438
- console . log ( totalFetchedFiles ) ;
439
446
if ( totalFetchedFiles === fileLinks . length ) {
440
- document . getElementById ( jsonInputId ) . value = JSON . stringify ( postJson ) ;
441
447
clearInterval ( timerId ) ;
448
+ document . getElementById ( jsonInputId ) . value = JSON . stringify ( postJson ) ;
449
+ var button = document . getElementById ( buttonId ) ;
450
+ button . style . display = '' ;
442
451
}
443
452
} , 500 ) ;
444
453
445
454
setTimeout ( ( ) => {
446
455
clearInterval ( timerId ) ;
456
+ console . warn (
457
+ "Not showing 'Open in Codepen' button. Timeout when loading resource."
458
+ ) ;
447
459
} , 10000 ) ;
448
460
}
449
461
450
- function hideButton ( buttonId , errorMsg ) {
451
- let button = document . querySelector ( buttonId ) ;
452
- button . style . display = 'none' ;
453
- console . log ( "Removing 'Open in Codepen button'. " + errorMsg ) ;
454
- }
455
-
456
462
var sourceCode = new aria . widget . SourceCode ( ) ;
0 commit comments