equal
deleted
inserted
replaced
14 } |
14 } |
15 // Create a progress bar containing the filename. |
15 // Create a progress bar containing the filename. |
16 jQuery( '<div class="media-item">' ) |
16 jQuery( '<div class="media-item">' ) |
17 .attr( 'id', 'media-item-' + fileObj.id ) |
17 .attr( 'id', 'media-item-' + fileObj.id ) |
18 .addClass( 'child-of-' + postid ) |
18 .addClass( 'child-of-' + postid ) |
19 .append( '<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>', |
19 .append( jQuery( '<div class="filename original">' ).text( ' ' + fileObj.name ), |
20 jQuery( '<div class="filename original">' ).text( ' ' + fileObj.name ) ) |
20 '<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>' ) |
21 .appendTo( jQuery( '#media-items' ) ); |
21 .appendTo( jQuery( '#media-items' ) ); |
22 |
22 |
23 // Disable submit. |
23 // Disable submit. |
24 jQuery( '#insert-gallery' ).prop( 'disabled', true ); |
24 jQuery( '#insert-gallery' ).prop( 'disabled', true ); |
25 } |
25 } |
378 var triggerElement = jQuery( event.trigger ), |
378 var triggerElement = jQuery( event.trigger ), |
379 successElement = jQuery( '.success', triggerElement.closest( '.copy-to-clipboard-container' ) ); |
379 successElement = jQuery( '.success', triggerElement.closest( '.copy-to-clipboard-container' ) ); |
380 |
380 |
381 // Clear the selection and move focus back to the trigger. |
381 // Clear the selection and move focus back to the trigger. |
382 event.clearSelection(); |
382 event.clearSelection(); |
383 // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 |
|
384 triggerElement.trigger( 'focus' ); |
|
385 // Show success visual feedback. |
383 // Show success visual feedback. |
386 clearTimeout( successTimeout ); |
384 clearTimeout( successTimeout ); |
387 successElement.removeClass( 'hidden' ); |
385 successElement.removeClass( 'hidden' ); |
388 // Hide success visual feedback after 3 seconds since last success. |
386 // Hide success visual feedback after 3 seconds since last success. |
389 successTimeout = setTimeout( function() { |
387 successTimeout = setTimeout( function() { |
397 jQuery( document ).ready( function( $ ) { |
395 jQuery( document ).ready( function( $ ) { |
398 copyAttachmentUploadURLClipboard(); |
396 copyAttachmentUploadURLClipboard(); |
399 var tryAgainCount = {}; |
397 var tryAgainCount = {}; |
400 var tryAgain; |
398 var tryAgain; |
401 |
399 |
402 $( '.media-upload-form' ).bind( 'click.uploader', function( e ) { |
400 $( '.media-upload-form' ).on( 'click.uploader', function( e ) { |
403 var target = $( e.target ), tr, c; |
401 var target = $( e.target ), tr, c; |
404 |
402 |
405 if ( target.is( 'input[type="radio"]' ) ) { // Remember the last used image size and alignment. |
403 if ( target.is( 'input[type="radio"]' ) ) { // Remember the last used image size and alignment. |
406 tr = target.closest( 'tr' ); |
404 tr = target.closest( 'tr' ); |
407 |
405 |
555 |
553 |
556 // Init and set the uploader. |
554 // Init and set the uploader. |
557 uploader_init = function() { |
555 uploader_init = function() { |
558 uploader = new plupload.Uploader( wpUploaderInit ); |
556 uploader = new plupload.Uploader( wpUploaderInit ); |
559 |
557 |
560 $( '#image_resize' ).bind( 'change', function() { |
558 $( '#image_resize' ).on( 'change', function() { |
561 var arg = $( this ).prop( 'checked' ); |
559 var arg = $( this ).prop( 'checked' ); |
562 |
560 |
563 setResize( arg ); |
561 setResize( arg ); |
564 |
562 |
565 if ( arg ) |
563 if ( arg ) |
608 } else if ( file.type === 'image/webp' && up.settings.webp_upload_error ) { |
606 } else if ( file.type === 'image/webp' && up.settings.webp_upload_error ) { |
609 // Disallow uploading of WebP images if the server cannot edit them. |
607 // Disallow uploading of WebP images if the server cannot edit them. |
610 wpQueueError( pluploadL10n.noneditable_image ); |
608 wpQueueError( pluploadL10n.noneditable_image ); |
611 up.removeFile( file ); |
609 up.removeFile( file ); |
612 return; |
610 return; |
|
611 } else if ( file.type === 'image/avif' && up.settings.avif_upload_error ) { |
|
612 // Disallow uploading of AVIF images if the server cannot edit them. |
|
613 wpQueueError( pluploadL10n.noneditable_image ); |
|
614 up.removeFile( file ); |
|
615 return; |
613 } |
616 } |
614 |
617 |
615 fileQueued( file ); |
618 fileQueued( file ); |
616 }); |
619 }); |
617 |
620 |