Changeset 31661
- Timestamp:
- 03/07/2015 11:05:57 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r31579 r31661 434 434 text-overflow: ellipsis; 435 435 margin: 0; 436 padding: 5px 10px 0;436 padding: 0 10px; 437 437 } 438 438 … … 447 447 .customize-control .thumbnail-image img { 448 448 cursor: pointer; 449 } 450 451 #customize-controls .thumbnail-audio .thumbnail { 452 max-width: 64px; 453 max-height: 64px; 454 margin: 10px; 455 float: left; 449 456 } 450 457 -
trunk/src/wp-admin/js/customize-controls.js
r31538 r31661 1 /* globals _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n */1 /* globals _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer */ 2 2 (function( exports, $ ){ 3 3 var Container, focus, api = wp.customize; … … 317 317 var self = this; 318 318 params = params || {}; 319 var section = this, previousCompleteCallback = params.completeCallback; 320 params.completeCallback = function () { 321 if ( previousCompleteCallback ) { 322 previousCompleteCallback.apply( section, arguments ); 323 } 324 if ( expanded ) { 325 section.container.trigger( 'expanded' ); 326 } else { 327 section.container.trigger( 'collapsed' ); 328 } 329 }; 319 330 if ( ( expanded && this.expanded.get() ) || ( ! expanded && ! this.expanded.get() ) ) { 320 331 params.unchanged = true; … … 1375 1386 var control = this; 1376 1387 // Shortcut so that we don't have to use _.bind every time we add a callback. 1377 _.bindAll( control, 'restoreDefault', 'removeFile', 'openFrame', 'select' );1388 _.bindAll( control, 'restoreDefault', 'removeFile', 'openFrame', 'select', 'pausePlayer' ); 1378 1389 1379 1390 // Bind events, with delegation to facilitate re-rendering. 1380 1391 control.container.on( 'click keydown', '.upload-button', control.openFrame ); 1392 control.container.on( 'click keydown', '.upload-button', control.pausePlayer ); 1381 1393 control.container.on( 'click keydown', '.thumbnail-image img', control.openFrame ); 1382 1394 control.container.on( 'click keydown', '.default-button', control.restoreDefault ); 1395 control.container.on( 'click keydown', '.remove-button', control.pausePlayer ); 1383 1396 control.container.on( 'click keydown', '.remove-button', control.removeFile ); 1397 control.container.on( 'click keydown', '.remove-button', control.cleanupPlayer ); 1398 1399 // Resize the player controls when it becomes visible (ie when section is expanded) 1400 api.section( control.section() ).container 1401 .on( 'expanded', function() { 1402 if ( control.player ) { 1403 control.player.setControlsSize(); 1404 } 1405 }) 1406 .on( 'collapsed', function() { 1407 control.pausePlayer(); 1408 }); 1384 1409 1385 1410 // Re-render whenever the control's setting changes. 1386 1411 control.setting.bind( function () { control.renderContent(); } ); 1412 }, 1413 1414 pausePlayer: function () { 1415 this.player && this.player.pause(); 1416 }, 1417 1418 cleanupPlayer: function () { 1419 this.player && wp.media.mixin.removePlayer( this.player ); 1387 1420 }, 1388 1421 … … 1432 1465 select: function() { 1433 1466 // Get the attachment from the modal frame. 1434 var attachment = this.frame.state().get( 'selection' ).first().toJSON(); 1467 var node, 1468 attachment = this.frame.state().get( 'selection' ).first().toJSON(), 1469 mejsSettings = window._wpmejsSettings || {}; 1435 1470 1436 1471 this.params.attachment = attachment; … … 1438 1473 // Set the Customizer setting; the callback takes care of rendering. 1439 1474 this.setting( attachment.url ); 1475 node = this.container.find( 'audio, video' ).get(0); 1476 1477 // Initialize audio/video previews. 1478 if ( node ) { 1479 this.player = new MediaElementPlayer( node, mejsSettings ); 1480 } else { 1481 this.cleanupPlayer(); 1482 } 1440 1483 }, 1441 1484 -
trunk/src/wp-includes/class-wp-customize-control.php
r31539 r31661 764 764 <img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" /> 765 765 <# } else if ( 'audio' === data.attachment.type ) { #> 766 <img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" /> 766 <# if ( data.attachment.image && data.attachment.image.src && data.attachment.image.src !== data.attachment.icon ) { #> 767 <img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" /> 768 <# } else { #> 769 <img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" /> 770 <# } #> 767 771 <p class="attachment-meta attachment-meta-title">“{{ data.attachment.title }}”</p> 768 772 <# if ( data.attachment.album || data.attachment.meta.album ) { #> … … 772 776 <p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p> 773 777 <# } #> 778 <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none"> 779 <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/> 780 </audio> 781 <# } else if ( 'video' === data.attachment.type ) { #> 782 <div class="wp-media-wrapper wp-video"> 783 <video controls="controls" class="wp-video-shortcode" preload="metadata" 784 <# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>> 785 <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/> 786 </video> 787 </div> 774 788 <# } else { #> 775 789 <img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" />
Note: See TracChangeset
for help on using the changeset viewer.