@@ -436,41 +436,43 @@ const api = new Frisbee({
436
436
$ ( '[data-toggle="popover"]' ) . popover ( ) ;
437
437
438
438
// Handle custom file inputs
439
- $ (
440
- 'body'
441
- ) . on ( 'change' , 'input[type="file"][data-toggle="custom-file"]' , function ( ) {
442
- const $input = $ ( this ) ;
443
- const target = $input . data ( 'target' ) ;
444
- const $target = $ ( target ) ;
445
-
446
- if ( $target . length === 0 )
447
- return console . error ( 'Invalid target for custom file' , $input ) ;
448
-
449
- if ( ! $target . attr ( 'data-content' ) )
450
- return console . error (
451
- 'Invalid `data-content` for custom file target' ,
452
- $input
453
- ) ;
454
-
455
- // Set original content so we can revert if user deselects file
456
- if ( ! $target . attr ( 'data-original-content' ) )
457
- $target . attr ( 'data-original-content' , $target . attr ( 'data-content' ) ) ;
458
-
459
- const input = $input . get ( 0 ) ;
460
-
461
- let name =
462
- _ . isObject ( input ) &&
463
- _ . isObject ( input . files ) &&
464
- _ . isObject ( input . files [ 0 ] ) &&
465
- _ . isString ( input . files [ 0 ] . name )
466
- ? input . files [ 0 ] . name
467
- : $input . val ( ) ;
468
-
469
- if ( _ . isNull ( name ) || name === '' )
470
- name = $target . attr ( 'data-original-content' ) ;
471
-
472
- $target . attr ( 'data-content' , name ) ;
473
- } ) ;
439
+ $ ( 'body' ) . on (
440
+ 'change' ,
441
+ 'input[type="file"][data-toggle="custom-file"]' ,
442
+ function ( ) {
443
+ const $input = $ ( this ) ;
444
+ const target = $input . data ( 'target' ) ;
445
+ const $target = $ ( target ) ;
446
+
447
+ if ( $target . length === 0 )
448
+ return console . error ( 'Invalid target for custom file' , $input ) ;
449
+
450
+ if ( ! $target . attr ( 'data-content' ) )
451
+ return console . error (
452
+ 'Invalid `data-content` for custom file target' ,
453
+ $input
454
+ ) ;
455
+
456
+ // Set original content so we can revert if user deselects file
457
+ if ( ! $target . attr ( 'data-original-content' ) )
458
+ $target . attr ( 'data-original-content' , $target . attr ( 'data-content' ) ) ;
459
+
460
+ const input = $input . get ( 0 ) ;
461
+
462
+ let name =
463
+ _ . isObject ( input ) &&
464
+ _ . isObject ( input . files ) &&
465
+ _ . isObject ( input . files [ 0 ] ) &&
466
+ _ . isString ( input . files [ 0 ] . name )
467
+ ? input . files [ 0 ] . name
468
+ : $input . val ( ) ;
469
+
470
+ if ( _ . isNull ( name ) || name === '' )
471
+ name = $target . attr ( 'data-original-content' ) ;
472
+
473
+ $target . attr ( 'data-content' , name ) ;
474
+ }
475
+ ) ;
474
476
475
477
// Handle clipboard copy helper buttons
476
478
if ( Clipboard . isSupported ( ) ) {
0 commit comments