[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 175: 5 /***/ ((module) => { 6 7 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, 8 MediaLibrary = wp.media.controller.MediaLibrary, 9 10 l10n = wp.media.view.l10n, 11 AudioDetails; 12 13 /** 14 * wp.media.view.MediaFrame.AudioDetails 15 * 16 * @memberOf wp.media.view.MediaFrame 17 * 18 * @class 19 * @augments wp.media.view.MediaFrame.MediaDetails 20 * @augments wp.media.view.MediaFrame.Select 21 * @augments wp.media.view.MediaFrame 22 * @augments wp.media.view.Frame 23 * @augments wp.media.View 24 * @augments wp.Backbone.View 25 * @augments Backbone.View 26 * @mixes wp.media.controller.StateMachine 27 */ 28 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.AudioDetails.prototype */{ 29 defaults: { 30 id: 'audio', 31 url: '', 32 menu: 'audio-details', 33 content: 'audio-details', 34 toolbar: 'audio-details', 35 type: 'link', 36 title: l10n.audioDetailsTitle, 37 priority: 120 38 }, 39 40 initialize: function( options ) { 41 options.DetailsView = wp.media.view.AudioDetails; 42 options.cancelText = l10n.audioDetailsCancel; 43 options.addText = l10n.audioAddSourceTitle; 44 45 MediaDetails.prototype.initialize.call( this, options ); 46 }, 47 48 bindHandlers: function() { 49 MediaDetails.prototype.bindHandlers.apply( this, arguments ); 50 51 this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this ); 52 this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this ); 53 }, 54 55 createStates: function() { 56 this.states.add([ 57 new wp.media.controller.AudioDetails( { 58 media: this.media 59 } ), 60 61 new MediaLibrary( { 62 type: 'audio', 63 id: 'replace-audio', 64 title: l10n.audioReplaceTitle, 65 toolbar: 'replace-audio', 66 media: this.media, 67 menu: 'audio-details' 68 } ), 69 70 new MediaLibrary( { 71 type: 'audio', 72 id: 'add-audio-source', 73 title: l10n.audioAddSourceTitle, 74 toolbar: 'add-audio-source', 75 media: this.media, 76 menu: false 77 } ) 78 ]); 79 } 80 }); 81 82 module.exports = AudioDetails; 83 84 85 /***/ }), 86 87 /***/ 241: 88 /***/ ((module) => { 89 90 /** 91 * wp.media.model.PostMedia 92 * 93 * Shared model class for audio and video. Updates the model after 94 * "Add Audio|Video Source" and "Replace Audio|Video" states return 95 * 96 * @memberOf wp.media.model 97 * 98 * @class 99 * @augments Backbone.Model 100 */ 101 var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{ 102 initialize: function() { 103 this.attachment = false; 104 }, 105 106 setSource: function( attachment ) { 107 this.attachment = attachment; 108 this.extension = attachment.get( 'filename' ).split('.').pop(); 109 110 if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) { 111 this.unset( 'src' ); 112 } 113 114 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { 115 this.set( this.extension, this.attachment.get( 'url' ) ); 116 } else { 117 this.unset( this.extension ); 118 } 119 }, 120 121 changeAttachment: function( attachment ) { 122 this.setSource( attachment ); 123 124 this.unset( 'src' ); 125 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { 126 this.unset( ext ); 127 }, this ); 128 } 129 }); 130 131 module.exports = PostMedia; 132 133 134 /***/ }), 135 136 /***/ 741: 137 /***/ ((module) => { 138 139 var Select = wp.media.view.MediaFrame.Select, 140 l10n = wp.media.view.l10n, 141 MediaDetails; 142 143 /** 144 * wp.media.view.MediaFrame.MediaDetails 145 * 146 * @memberOf wp.media.view.MediaFrame 147 * 148 * @class 149 * @augments wp.media.view.MediaFrame.Select 150 * @augments wp.media.view.MediaFrame 151 * @augments wp.media.view.Frame 152 * @augments wp.media.View 153 * @augments wp.Backbone.View 154 * @augments Backbone.View 155 * @mixes wp.media.controller.StateMachine 156 */ 157 MediaDetails = Select.extend(/** @lends wp.media.view.MediaFrame.MediaDetails.prototype */{ 158 defaults: { 159 id: 'media', 160 url: '', 161 menu: 'media-details', 162 content: 'media-details', 163 toolbar: 'media-details', 164 type: 'link', 165 priority: 120 166 }, 167 168 initialize: function( options ) { 169 this.DetailsView = options.DetailsView; 170 this.cancelText = options.cancelText; 171 this.addText = options.addText; 172 173 this.media = new wp.media.model.PostMedia( options.metadata ); 174 this.options.selection = new wp.media.model.Selection( this.media.attachment, { multiple: false } ); 175 Select.prototype.initialize.apply( this, arguments ); 176 }, 177 178 bindHandlers: function() { 179 var menu = this.defaults.menu; 180 181 Select.prototype.bindHandlers.apply( this, arguments ); 182 183 this.on( 'menu:create:' + menu, this.createMenu, this ); 184 this.on( 'content:render:' + menu, this.renderDetailsContent, this ); 185 this.on( 'menu:render:' + menu, this.renderMenu, this ); 186 this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this ); 187 }, 188 189 renderDetailsContent: function() { 190 var view = new this.DetailsView({ 191 controller: this, 192 model: this.state().media, 193 attachment: this.state().media.attachment 194 }).render(); 195 196 this.content.set( view ); 197 }, 198 199 renderMenu: function( view ) { 200 var lastState = this.lastState(), 201 previous = lastState && lastState.id, 202 frame = this; 203 204 view.set({ 205 cancel: { 206 text: this.cancelText, 207 priority: 20, 208 click: function() { 209 if ( previous ) { 210 frame.setState( previous ); 211 } else { 212 frame.close(); 213 } 214 } 215 }, 216 separateCancel: new wp.media.View({ 217 className: 'separator', 218 priority: 40 219 }) 220 }); 221 222 }, 223 224 setPrimaryButton: function(text, handler) { 225 this.toolbar.set( new wp.media.view.Toolbar({ 226 controller: this, 227 items: { 228 button: { 229 style: 'primary', 230 text: text, 231 priority: 80, 232 click: function() { 233 var controller = this.controller; 234 handler.call( this, controller, controller.state() ); 235 // Restore and reset the default state. 236 controller.setState( controller.options.state ); 237 controller.reset(); 238 } 239 } 240 } 241 }) ); 242 }, 243 244 renderDetailsToolbar: function() { 245 this.setPrimaryButton( l10n.update, function( controller, state ) { 246 controller.close(); 247 state.trigger( 'update', controller.media.toJSON() ); 248 } ); 249 }, 250 251 renderReplaceToolbar: function() { 252 this.setPrimaryButton( l10n.replace, function( controller, state ) { 253 var attachment = state.get( 'selection' ).single(); 254 controller.media.changeAttachment( attachment ); 255 state.trigger( 'replace', controller.media.toJSON() ); 256 } ); 257 }, 258 259 renderAddSourceToolbar: function() { 260 this.setPrimaryButton( this.addText, function( controller, state ) { 261 var attachment = state.get( 'selection' ).single(); 262 controller.media.setSource( attachment ); 263 state.trigger( 'add-source', controller.media.toJSON() ); 264 } ); 265 } 266 }); 267 268 module.exports = MediaDetails; 269 270 271 /***/ }), 272 273 /***/ 1206: 274 /***/ ((module) => { 275 276 var State = wp.media.controller.State, 277 l10n = wp.media.view.l10n, 278 AudioDetails; 279 280 /** 281 * wp.media.controller.AudioDetails 282 * 283 * The controller for the Audio Details state 284 * 285 * @memberOf wp.media.controller 286 * 287 * @class 288 * @augments wp.media.controller.State 289 * @augments Backbone.Model 290 */ 291 AudioDetails = State.extend(/** @lends wp.media.controller.AudioDetails.prototype */{ 292 defaults: { 293 id: 'audio-details', 294 toolbar: 'audio-details', 295 title: l10n.audioDetailsTitle, 296 content: 'audio-details', 297 menu: 'audio-details', 298 router: false, 299 priority: 60 300 }, 301 302 initialize: function( options ) { 303 this.media = options.media; 304 State.prototype.initialize.apply( this, arguments ); 305 } 306 }); 307 308 module.exports = AudioDetails; 309 310 311 /***/ }), 312 313 /***/ 3713: 314 /***/ ((module) => { 315 316 var MediaDetails = wp.media.view.MediaDetails, 317 AudioDetails; 318 319 /** 320 * wp.media.view.AudioDetails 321 * 322 * @memberOf wp.media.view 323 * 324 * @class 325 * @augments wp.media.view.MediaDetails 326 * @augments wp.media.view.Settings.AttachmentDisplay 327 * @augments wp.media.view.Settings 328 * @augments wp.media.View 329 * @augments wp.Backbone.View 330 * @augments Backbone.View 331 */ 332 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{ 333 className: 'audio-details', 334 template: wp.template('audio-details'), 335 336 setMedia: function() { 337 var audio = this.$('.wp-audio-shortcode'); 338 339 if ( audio.find( 'source' ).length ) { 340 if ( audio.is(':hidden') ) { 341 audio.show(); 342 } 343 this.media = MediaDetails.prepareSrc( audio.get(0) ); 344 } else { 345 audio.hide(); 346 this.media = false; 347 } 348 349 return this; 350 } 351 }); 352 353 module.exports = AudioDetails; 354 355 356 /***/ }), 357 358 /***/ 5039: 359 /***/ ((module) => { 360 361 /** 362 * wp.media.controller.VideoDetails 363 * 364 * The controller for the Video Details state 365 * 366 * @memberOf wp.media.controller 367 * 368 * @class 369 * @augments wp.media.controller.State 370 * @augments Backbone.Model 371 */ 372 var State = wp.media.controller.State, 373 l10n = wp.media.view.l10n, 374 VideoDetails; 375 376 VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{ 377 defaults: { 378 id: 'video-details', 379 toolbar: 'video-details', 380 title: l10n.videoDetailsTitle, 381 content: 'video-details', 382 menu: 'video-details', 383 router: false, 384 priority: 60 385 }, 386 387 initialize: function( options ) { 388 this.media = options.media; 389 State.prototype.initialize.apply( this, arguments ); 390 } 391 }); 392 393 module.exports = VideoDetails; 394 395 396 /***/ }), 397 398 /***/ 5836: 399 /***/ ((module) => { 400 401 var MediaDetails = wp.media.view.MediaDetails, 402 VideoDetails; 403 404 /** 405 * wp.media.view.VideoDetails 406 * 407 * @memberOf wp.media.view 408 * 409 * @class 410 * @augments wp.media.view.MediaDetails 411 * @augments wp.media.view.Settings.AttachmentDisplay 412 * @augments wp.media.view.Settings 413 * @augments wp.media.View 414 * @augments wp.Backbone.View 415 * @augments Backbone.View 416 */ 417 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{ 418 className: 'video-details', 419 template: wp.template('video-details'), 420 421 setMedia: function() { 422 var video = this.$('.wp-video-shortcode'); 423 424 if ( video.find( 'source' ).length ) { 425 if ( video.is(':hidden') ) { 426 video.show(); 427 } 428 429 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { 430 this.media = MediaDetails.prepareSrc( video.get(0) ); 431 } else { 432 this.media = video.get(0); 433 } 434 } else { 435 video.hide(); 436 this.media = false; 437 } 438 439 return this; 440 } 441 }); 442 443 module.exports = VideoDetails; 444 445 446 /***/ }), 447 448 /***/ 8646: 449 /***/ ((module) => { 450 451 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, 452 MediaLibrary = wp.media.controller.MediaLibrary, 453 l10n = wp.media.view.l10n, 454 VideoDetails; 455 456 /** 457 * wp.media.view.MediaFrame.VideoDetails 458 * 459 * @memberOf wp.media.view.MediaFrame 460 * 461 * @class 462 * @augments wp.media.view.MediaFrame.MediaDetails 463 * @augments wp.media.view.MediaFrame.Select 464 * @augments wp.media.view.MediaFrame 465 * @augments wp.media.view.Frame 466 * @augments wp.media.View 467 * @augments wp.Backbone.View 468 * @augments Backbone.View 469 * @mixes wp.media.controller.StateMachine 470 */ 471 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDetails.prototype */{ 472 defaults: { 473 id: 'video', 474 url: '', 475 menu: 'video-details', 476 content: 'video-details', 477 toolbar: 'video-details', 478 type: 'link', 479 title: l10n.videoDetailsTitle, 480 priority: 120 481 }, 482 483 initialize: function( options ) { 484 options.DetailsView = wp.media.view.VideoDetails; 485 options.cancelText = l10n.videoDetailsCancel; 486 options.addText = l10n.videoAddSourceTitle; 487 488 MediaDetails.prototype.initialize.call( this, options ); 489 }, 490 491 bindHandlers: function() { 492 MediaDetails.prototype.bindHandlers.apply( this, arguments ); 493 494 this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this ); 495 this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this ); 496 this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this ); 497 this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this ); 498 }, 499 500 createStates: function() { 501 this.states.add([ 502 new wp.media.controller.VideoDetails({ 503 media: this.media 504 }), 505 506 new MediaLibrary( { 507 type: 'video', 508 id: 'replace-video', 509 title: l10n.videoReplaceTitle, 510 toolbar: 'replace-video', 511 media: this.media, 512 menu: 'video-details' 513 } ), 514 515 new MediaLibrary( { 516 type: 'video', 517 id: 'add-video-source', 518 title: l10n.videoAddSourceTitle, 519 toolbar: 'add-video-source', 520 media: this.media, 521 menu: false 522 } ), 523 524 new MediaLibrary( { 525 type: 'image', 526 id: 'select-poster-image', 527 title: l10n.videoSelectPosterImageTitle, 528 toolbar: 'select-poster-image', 529 media: this.media, 530 menu: 'video-details' 531 } ), 532 533 new MediaLibrary( { 534 type: 'text', 535 id: 'add-track', 536 title: l10n.videoAddTrackTitle, 537 toolbar: 'add-track', 538 media: this.media, 539 menu: 'video-details' 540 } ) 541 ]); 542 }, 543 544 renderSelectPosterImageToolbar: function() { 545 this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) { 546 var urls = [], attachment = state.get( 'selection' ).single(); 547 548 controller.media.set( 'poster', attachment.get( 'url' ) ); 549 state.trigger( 'set-poster-image', controller.media.toJSON() ); 550 551 _.each( wp.media.view.settings.embedExts, function (ext) { 552 if ( controller.media.get( ext ) ) { 553 urls.push( controller.media.get( ext ) ); 554 } 555 } ); 556 557 wp.ajax.send( 'set-attachment-thumbnail', { 558 data : { 559 _ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail, 560 urls: urls, 561 thumbnail_id: attachment.get( 'id' ) 562 } 563 } ); 564 } ); 565 }, 566 567 renderAddTrackToolbar: function() { 568 this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) { 569 var attachment = state.get( 'selection' ).single(), 570 content = controller.media.get( 'content' ); 571 572 if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) { 573 content += [ 574 '<track srclang="en" label="English" kind="subtitles" src="', 575 attachment.get( 'url' ), 576 '" />' 577 ].join(''); 578 579 controller.media.set( 'content', content ); 580 } 581 state.trigger( 'add-track', controller.media.toJSON() ); 582 } ); 583 } 584 }); 585 586 module.exports = VideoDetails; 587 588 589 /***/ }), 590 591 /***/ 9467: 592 /***/ ((module) => { 593 594 /* global MediaElementPlayer */ 595 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay, 596 $ = jQuery, 597 MediaDetails; 598 599 /** 600 * wp.media.view.MediaDetails 601 * 602 * @memberOf wp.media.view 603 * 604 * @class 605 * @augments wp.media.view.Settings.AttachmentDisplay 606 * @augments wp.media.view.Settings 607 * @augments wp.media.View 608 * @augments wp.Backbone.View 609 * @augments Backbone.View 610 */ 611 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{ 612 initialize: function() { 613 _.bindAll(this, 'success'); 614 this.players = []; 615 this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers ); 616 this.on( 'ready', this.setPlayer ); 617 this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this ); 618 this.on( 'media:setting:remove', this.render ); 619 this.on( 'media:setting:remove', this.setPlayer ); 620 621 AttachmentDisplay.prototype.initialize.apply( this, arguments ); 622 }, 623 624 events: function(){ 625 return _.extend( { 626 'click .remove-setting' : 'removeSetting', 627 'change .content-track' : 'setTracks', 628 'click .remove-track' : 'setTracks', 629 'click .add-media-source' : 'addSource' 630 }, AttachmentDisplay.prototype.events ); 631 }, 632 633 prepare: function() { 634 return _.defaults({ 635 model: this.model.toJSON() 636 }, this.options ); 637 }, 638 639 /** 640 * Remove a setting's UI when the model unsets it 641 * 642 * @fires wp.media.view.MediaDetails#media:setting:remove 643 * 644 * @param {Event} e 645 */ 646 removeSetting : function(e) { 647 var wrap = $( e.currentTarget ).parent(), setting; 648 setting = wrap.find( 'input' ).data( 'setting' ); 649 650 if ( setting ) { 651 this.model.unset( setting ); 652 this.trigger( 'media:setting:remove', this ); 653 } 654 655 wrap.remove(); 656 }, 657 658 /** 659 * 660 * @fires wp.media.view.MediaDetails#media:setting:remove 661 */ 662 setTracks : function() { 663 var tracks = ''; 664 665 _.each( this.$('.content-track'), function(track) { 666 tracks += $( track ).val(); 667 } ); 668 669 this.model.set( 'content', tracks ); 670 this.trigger( 'media:setting:remove', this ); 671 }, 672 673 addSource : function( e ) { 674 this.controller.lastMime = $( e.currentTarget ).data( 'mime' ); 675 this.controller.setState( 'add-' + this.controller.defaults.id + '-source' ); 676 }, 677 678 loadPlayer: function () { 679 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); 680 this.scriptXhr = false; 681 }, 682 683 setPlayer : function() { 684 var src; 685 686 if ( this.players.length || ! this.media || this.scriptXhr ) { 687 return; 688 } 689 690 src = this.model.get( 'src' ); 691 692 if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) { 693 this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) ); 694 } else { 695 this.loadPlayer(); 696 } 697 }, 698 699 /** 700 * @abstract 701 */ 702 setMedia : function() { 703 return this; 704 }, 705 706 success : function(mejs) { 707 var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; 708 709 if ( 'flash' === mejs.pluginType && autoplay ) { 710 mejs.addEventListener( 'canplay', function() { 711 mejs.play(); 712 }, false ); 713 } 714 715 this.mejs = mejs; 716 }, 717 718 /** 719 * @return {media.view.MediaDetails} Returns itself to allow chaining. 720 */ 721 render: function() { 722 AttachmentDisplay.prototype.render.apply( this, arguments ); 723 724 setTimeout( _.bind( function() { 725 this.scrollToTop(); 726 }, this ), 10 ); 727 728 this.settings = _.defaults( { 729 success : this.success 730 }, wp.media.mixin.mejsSettings ); 731 732 return this.setMedia(); 733 }, 734 735 scrollToTop: function() { 736 this.$( '.embed-media-settings' ).scrollTop( 0 ); 737 } 738 },/** @lends wp.media.view.MediaDetails */{ 739 instances : 0, 740 /** 741 * When multiple players in the DOM contain the same src, things get weird. 742 * 743 * @param {HTMLElement} elem 744 * @return {HTMLElement} 745 */ 746 prepareSrc : function( elem ) { 747 var i = MediaDetails.instances++; 748 _.each( $( elem ).find( 'source' ), function( source ) { 749 source.src = [ 750 source.src, 751 source.src.indexOf('?') > -1 ? '&' : '?', 752 '_=', 753 i 754 ].join(''); 755 } ); 756 757 return elem; 758 } 759 }); 760 761 module.exports = MediaDetails; 762 763 764 /***/ }) 765 766 /******/ }); 767 /************************************************************************/ 768 /******/ // The module cache 769 /******/ var __webpack_module_cache__ = {}; 770 /******/ 771 /******/ // The require function 772 /******/ function __webpack_require__(moduleId) { 773 /******/ // Check if module is in cache 774 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 775 /******/ if (cachedModule !== undefined) { 776 /******/ return cachedModule.exports; 777 /******/ } 778 /******/ // Create a new module (and put it into the cache) 779 /******/ var module = __webpack_module_cache__[moduleId] = { 780 /******/ // no module.id needed 781 /******/ // no module.loaded needed 782 /******/ exports: {} 783 /******/ }; 784 /******/ 785 /******/ // Execute the module function 786 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 787 /******/ 788 /******/ // Return the exports of the module 789 /******/ return module.exports; 790 /******/ } 791 /******/ 792 /************************************************************************/ 793 /** 794 * @output wp-includes/js/media-audiovideo.js 795 */ 796 797 var media = wp.media, 798 baseSettings = window._wpmejsSettings || {}, 799 l10n = window._wpMediaViewsL10n || {}; 800 801 /** 802 * 803 * Defines the wp.media.mixin object. 804 * 805 * @mixin 806 * 807 * @since 4.2.0 808 */ 809 wp.media.mixin = { 810 mejsSettings: baseSettings, 811 812 /** 813 * Pauses and removes all players. 814 * 815 * @since 4.2.0 816 * 817 * @return {void} 818 */ 819 removeAllPlayers: function() { 820 var p; 821 822 if ( window.mejs && window.mejs.players ) { 823 for ( p in window.mejs.players ) { 824 window.mejs.players[p].pause(); 825 this.removePlayer( window.mejs.players[p] ); 826 } 827 } 828 }, 829 830 /** 831 * Removes the player. 832 * 833 * Override the MediaElement method for removing a player. 834 * MediaElement tries to pull the audio/video tag out of 835 * its container and re-add it to the DOM. 836 * 837 * @since 4.2.0 838 * 839 * @return {void} 840 */ 841 removePlayer: function(t) { 842 var featureIndex, feature; 843 844 if ( ! t.options ) { 845 return; 846 } 847 848 // Invoke features cleanup. 849 for ( featureIndex in t.options.features ) { 850 feature = t.options.features[featureIndex]; 851 if ( t['clean' + feature] ) { 852 try { 853 t['clean' + feature](t); 854 } catch (e) {} 855 } 856 } 857 858 if ( ! t.isDynamic ) { 859 t.node.remove(); 860 } 861 862 if ( 'html5' !== t.media.rendererName ) { 863 t.media.remove(); 864 } 865 866 delete window.mejs.players[t.id]; 867 868 t.container.remove(); 869 t.globalUnbind('resize', t.globalResizeCallback); 870 t.globalUnbind('keydown', t.globalKeydownCallback); 871 t.globalUnbind('click', t.globalClickCallback); 872 delete t.media.player; 873 }, 874 875 /** 876 * 877 * Removes and resets all players. 878 * 879 * Allows any class that has set 'player' to a MediaElementPlayer 880 * instance to remove the player when listening to events. 881 * 882 * Examples: modal closes, shortcode properties are removed, etc. 883 * 884 * @since 4.2.0 885 */ 886 unsetPlayers : function() { 887 if ( this.players && this.players.length ) { 888 _.each( this.players, function (player) { 889 player.pause(); 890 wp.media.mixin.removePlayer( player ); 891 } ); 892 this.players = []; 893 } 894 } 895 }; 896 897 /** 898 * Shortcode modeling for playlists. 899 * 900 * @since 4.2.0 901 */ 902 wp.media.playlist = new wp.media.collection({ 903 tag: 'playlist', 904 editTitle : l10n.editPlaylistTitle, 905 defaults : { 906 id: wp.media.view.settings.post.id, 907 style: 'light', 908 tracklist: true, 909 tracknumbers: true, 910 images: true, 911 artists: true, 912 type: 'audio' 913 } 914 }); 915 916 /** 917 * Shortcode modeling for audio. 918 * 919 * `edit()` prepares the shortcode for the media modal. 920 * `shortcode()` builds the new shortcode after an update. 921 * 922 * @namespace 923 * 924 * @since 4.2.0 925 */ 926 wp.media.audio = { 927 coerce : wp.media.coerce, 928 929 defaults : { 930 id : wp.media.view.settings.post.id, 931 src : '', 932 loop : false, 933 autoplay : false, 934 preload : 'none', 935 width : 400 936 }, 937 938 /** 939 * Instantiates a new media object with the next matching shortcode. 940 * 941 * @since 4.2.0 942 * 943 * @param {string} data The text to apply the shortcode on. 944 * @return {wp.media} The media object. 945 */ 946 edit : function( data ) { 947 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; 948 949 frame = wp.media({ 950 frame: 'audio', 951 state: 'audio-details', 952 metadata: _.defaults( shortcode.attrs.named, this.defaults ) 953 }); 954 955 return frame; 956 }, 957 958 /** 959 * Generates an audio shortcode. 960 * 961 * @since 4.2.0 962 * 963 * @param {Array} model Array with attributes for the shortcode. 964 * @return {wp.shortcode} The audio shortcode object. 965 */ 966 shortcode : function( model ) { 967 var content; 968 969 _.each( this.defaults, function( value, key ) { 970 model[ key ] = this.coerce( model, key ); 971 972 if ( value === model[ key ] ) { 973 delete model[ key ]; 974 } 975 }, this ); 976 977 content = model.content; 978 delete model.content; 979 980 return new wp.shortcode({ 981 tag: 'audio', 982 attrs: model, 983 content: content 984 }); 985 } 986 }; 987 988 /** 989 * Shortcode modeling for video. 990 * 991 * `edit()` prepares the shortcode for the media modal. 992 * `shortcode()` builds the new shortcode after update. 993 * 994 * @since 4.2.0 995 * 996 * @namespace 997 */ 998 wp.media.video = { 999 coerce : wp.media.coerce, 1000 1001 defaults : { 1002 id : wp.media.view.settings.post.id, 1003 src : '', 1004 poster : '', 1005 loop : false, 1006 autoplay : false, 1007 preload : 'metadata', 1008 content : '', 1009 width : 640, 1010 height : 360 1011 }, 1012 1013 /** 1014 * Instantiates a new media object with the next matching shortcode. 1015 * 1016 * @since 4.2.0 1017 * 1018 * @param {string} data The text to apply the shortcode on. 1019 * @return {wp.media} The media object. 1020 */ 1021 edit : function( data ) { 1022 var frame, 1023 shortcode = wp.shortcode.next( 'video', data ).shortcode, 1024 attrs; 1025 1026 attrs = shortcode.attrs.named; 1027 attrs.content = shortcode.content; 1028 1029 frame = wp.media({ 1030 frame: 'video', 1031 state: 'video-details', 1032 metadata: _.defaults( attrs, this.defaults ) 1033 }); 1034 1035 return frame; 1036 }, 1037 1038 /** 1039 * Generates an video shortcode. 1040 * 1041 * @since 4.2.0 1042 * 1043 * @param {Array} model Array with attributes for the shortcode. 1044 * @return {wp.shortcode} The video shortcode object. 1045 */ 1046 shortcode : function( model ) { 1047 var content; 1048 1049 _.each( this.defaults, function( value, key ) { 1050 model[ key ] = this.coerce( model, key ); 1051 1052 if ( value === model[ key ] ) { 1053 delete model[ key ]; 1054 } 1055 }, this ); 1056 1057 content = model.content; 1058 delete model.content; 1059 1060 return new wp.shortcode({ 1061 tag: 'video', 1062 attrs: model, 1063 content: content 1064 }); 1065 } 1066 }; 1067 1068 media.model.PostMedia = __webpack_require__( 241 ); 1069 media.controller.AudioDetails = __webpack_require__( 1206 ); 1070 media.controller.VideoDetails = __webpack_require__( 5039 ); 1071 media.view.MediaFrame.MediaDetails = __webpack_require__( 741 ); 1072 media.view.MediaFrame.AudioDetails = __webpack_require__( 175 ); 1073 media.view.MediaFrame.VideoDetails = __webpack_require__( 8646 ); 1074 media.view.MediaDetails = __webpack_require__( 9467 ); 1075 media.view.AudioDetails = __webpack_require__( 3713 ); 1076 media.view.VideoDetails = __webpack_require__( 5836 ); 1077 1078 /******/ })() 1079 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Apr 3 08:20:01 2025 | Cross-referenced by PHPXref |