[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 1206: 5 /***/ ((module) => { 6 7 var State = wp.media.controller.State, 8 l10n = wp.media.view.l10n, 9 AudioDetails; 10 11 /** 12 * wp.media.controller.AudioDetails 13 * 14 * The controller for the Audio Details state 15 * 16 * @memberOf wp.media.controller 17 * 18 * @class 19 * @augments wp.media.controller.State 20 * @augments Backbone.Model 21 */ 22 AudioDetails = State.extend(/** @lends wp.media.controller.AudioDetails.prototype */{ 23 defaults: { 24 id: 'audio-details', 25 toolbar: 'audio-details', 26 title: l10n.audioDetailsTitle, 27 content: 'audio-details', 28 menu: 'audio-details', 29 router: false, 30 priority: 60 31 }, 32 33 initialize: function( options ) { 34 this.media = options.media; 35 State.prototype.initialize.apply( this, arguments ); 36 } 37 }); 38 39 module.exports = AudioDetails; 40 41 42 /***/ }), 43 44 /***/ 5039: 45 /***/ ((module) => { 46 47 /** 48 * wp.media.controller.VideoDetails 49 * 50 * The controller for the Video Details state 51 * 52 * @memberOf wp.media.controller 53 * 54 * @class 55 * @augments wp.media.controller.State 56 * @augments Backbone.Model 57 */ 58 var State = wp.media.controller.State, 59 l10n = wp.media.view.l10n, 60 VideoDetails; 61 62 VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{ 63 defaults: { 64 id: 'video-details', 65 toolbar: 'video-details', 66 title: l10n.videoDetailsTitle, 67 content: 'video-details', 68 menu: 'video-details', 69 router: false, 70 priority: 60 71 }, 72 73 initialize: function( options ) { 74 this.media = options.media; 75 State.prototype.initialize.apply( this, arguments ); 76 } 77 }); 78 79 module.exports = VideoDetails; 80 81 82 /***/ }), 83 84 /***/ 241: 85 /***/ ((module) => { 86 87 /** 88 * wp.media.model.PostMedia 89 * 90 * Shared model class for audio and video. Updates the model after 91 * "Add Audio|Video Source" and "Replace Audio|Video" states return 92 * 93 * @memberOf wp.media.model 94 * 95 * @class 96 * @augments Backbone.Model 97 */ 98 var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{ 99 initialize: function() { 100 this.attachment = false; 101 }, 102 103 setSource: function( attachment ) { 104 this.attachment = attachment; 105 this.extension = attachment.get( 'filename' ).split('.').pop(); 106 107 if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) { 108 this.unset( 'src' ); 109 } 110 111 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { 112 this.set( this.extension, this.attachment.get( 'url' ) ); 113 } else { 114 this.unset( this.extension ); 115 } 116 }, 117 118 changeAttachment: function( attachment ) { 119 this.setSource( attachment ); 120 121 this.unset( 'src' ); 122 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { 123 this.unset( ext ); 124 }, this ); 125 } 126 }); 127 128 module.exports = PostMedia; 129 130 131 /***/ }), 132 133 /***/ 3713: 134 /***/ ((module) => { 135 136 var MediaDetails = wp.media.view.MediaDetails, 137 AudioDetails; 138 139 /** 140 * wp.media.view.AudioDetails 141 * 142 * @memberOf wp.media.view 143 * 144 * @class 145 * @augments wp.media.view.MediaDetails 146 * @augments wp.media.view.Settings.AttachmentDisplay 147 * @augments wp.media.view.Settings 148 * @augments wp.media.View 149 * @augments wp.Backbone.View 150 * @augments Backbone.View 151 */ 152 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{ 153 className: 'audio-details', 154 template: wp.template('audio-details'), 155 156 setMedia: function() { 157 var audio = this.$('.wp-audio-shortcode'); 158 159 if ( audio.find( 'source' ).length ) { 160 if ( audio.is(':hidden') ) { 161 audio.show(); 162 } 163 this.media = MediaDetails.prepareSrc( audio.get(0) ); 164 } else { 165 audio.hide(); 166 this.media = false; 167 } 168 169 return this; 170 } 171 }); 172 173 module.exports = AudioDetails; 174 175 176 /***/ }), 177 178 /***/ 175: 179 /***/ ((module) => { 180 181 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, 182 MediaLibrary = wp.media.controller.MediaLibrary, 183 184 l10n = wp.media.view.l10n, 185 AudioDetails; 186 187 /** 188 * wp.media.view.MediaFrame.AudioDetails 189 * 190 * @memberOf wp.media.view.MediaFrame 191 * 192 * @class 193 * @augments wp.media.view.MediaFrame.MediaDetails 194 * @augments wp.media.view.MediaFrame.Select 195 * @augments wp.media.view.MediaFrame 196 * @augments wp.media.view.Frame 197 * @augments wp.media.View 198 * @augments wp.Backbone.View 199 * @augments Backbone.View 200 * @mixes wp.media.controller.StateMachine 201 */ 202 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.AudioDetails.prototype */{ 203 defaults: { 204 id: 'audio', 205 url: '', 206 menu: 'audio-details', 207 content: 'audio-details', 208 toolbar: 'audio-details', 209 type: 'link', 210 title: l10n.audioDetailsTitle, 211 priority: 120 212 }, 213 214 initialize: function( options ) { 215 options.DetailsView = wp.media.view.AudioDetails; 216 options.cancelText = l10n.audioDetailsCancel; 217 options.addText = l10n.audioAddSourceTitle; 218 219 MediaDetails.prototype.initialize.call( this, options ); 220 }, 221 222 bindHandlers: function() { 223 MediaDetails.prototype.bindHandlers.apply( this, arguments ); 224 225 this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this ); 226 this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this ); 227 }, 228 229 createStates: function() { 230 this.states.add([ 231 new wp.media.controller.AudioDetails( { 232 media: this.media 233 } ), 234 235 new MediaLibrary( { 236 type: 'audio', 237 id: 'replace-audio', 238 title: l10n.audioReplaceTitle, 239 toolbar: 'replace-audio', 240 media: this.media, 241 menu: 'audio-details' 242 } ), 243 244 new MediaLibrary( { 245 type: 'audio', 246 id: 'add-audio-source', 247 title: l10n.audioAddSourceTitle, 248 toolbar: 'add-audio-source', 249 media: this.media, 250 menu: false 251 } ) 252 ]); 253 } 254 }); 255 256 module.exports = AudioDetails; 257 258 259 /***/ }), 260 261 /***/ 741: 262 /***/ ((module) => { 263 264 var Select = wp.media.view.MediaFrame.Select, 265 l10n = wp.media.view.l10n, 266 MediaDetails; 267 268 /** 269 * wp.media.view.MediaFrame.MediaDetails 270 * 271 * @memberOf wp.media.view.MediaFrame 272 * 273 * @class 274 * @augments wp.media.view.MediaFrame.Select 275 * @augments wp.media.view.MediaFrame 276 * @augments wp.media.view.Frame 277 * @augments wp.media.View 278 * @augments wp.Backbone.View 279 * @augments Backbone.View 280 * @mixes wp.media.controller.StateMachine 281 */ 282 MediaDetails = Select.extend(/** @lends wp.media.view.MediaFrame.MediaDetails.prototype */{ 283 defaults: { 284 id: 'media', 285 url: '', 286 menu: 'media-details', 287 content: 'media-details', 288 toolbar: 'media-details', 289 type: 'link', 290 priority: 120 291 }, 292 293 initialize: function( options ) { 294 this.DetailsView = options.DetailsView; 295 this.cancelText = options.cancelText; 296 this.addText = options.addText; 297 298 this.media = new wp.media.model.PostMedia( options.metadata ); 299 this.options.selection = new wp.media.model.Selection( this.media.attachment, { multiple: false } ); 300 Select.prototype.initialize.apply( this, arguments ); 301 }, 302 303 bindHandlers: function() { 304 var menu = this.defaults.menu; 305 306 Select.prototype.bindHandlers.apply( this, arguments ); 307 308 this.on( 'menu:create:' + menu, this.createMenu, this ); 309 this.on( 'content:render:' + menu, this.renderDetailsContent, this ); 310 this.on( 'menu:render:' + menu, this.renderMenu, this ); 311 this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this ); 312 }, 313 314 renderDetailsContent: function() { 315 var view = new this.DetailsView({ 316 controller: this, 317 model: this.state().media, 318 attachment: this.state().media.attachment 319 }).render(); 320 321 this.content.set( view ); 322 }, 323 324 renderMenu: function( view ) { 325 var lastState = this.lastState(), 326 previous = lastState && lastState.id, 327 frame = this; 328 329 view.set({ 330 cancel: { 331 text: this.cancelText, 332 priority: 20, 333 click: function() { 334 if ( previous ) { 335 frame.setState( previous ); 336 } else { 337 frame.close(); 338 } 339 } 340 }, 341 separateCancel: new wp.media.View({ 342 className: 'separator', 343 priority: 40 344 }) 345 }); 346 347 }, 348 349 setPrimaryButton: function(text, handler) { 350 this.toolbar.set( new wp.media.view.Toolbar({ 351 controller: this, 352 items: { 353 button: { 354 style: 'primary', 355 text: text, 356 priority: 80, 357 click: function() { 358 var controller = this.controller; 359 handler.call( this, controller, controller.state() ); 360 // Restore and reset the default state. 361 controller.setState( controller.options.state ); 362 controller.reset(); 363 } 364 } 365 } 366 }) ); 367 }, 368 369 renderDetailsToolbar: function() { 370 this.setPrimaryButton( l10n.update, function( controller, state ) { 371 controller.close(); 372 state.trigger( 'update', controller.media.toJSON() ); 373 } ); 374 }, 375 376 renderReplaceToolbar: function() { 377 this.setPrimaryButton( l10n.replace, function( controller, state ) { 378 var attachment = state.get( 'selection' ).single(); 379 controller.media.changeAttachment( attachment ); 380 state.trigger( 'replace', controller.media.toJSON() ); 381 } ); 382 }, 383 384 renderAddSourceToolbar: function() { 385 this.setPrimaryButton( this.addText, function( controller, state ) { 386 var attachment = state.get( 'selection' ).single(); 387 controller.media.setSource( attachment ); 388 state.trigger( 'add-source', controller.media.toJSON() ); 389 } ); 390 } 391 }); 392 393 module.exports = MediaDetails; 394 395 396 /***/ }), 397 398 /***/ 8646: 399 /***/ ((module) => { 400 401 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, 402 MediaLibrary = wp.media.controller.MediaLibrary, 403 l10n = wp.media.view.l10n, 404 VideoDetails; 405 406 /** 407 * wp.media.view.MediaFrame.VideoDetails 408 * 409 * @memberOf wp.media.view.MediaFrame 410 * 411 * @class 412 * @augments wp.media.view.MediaFrame.MediaDetails 413 * @augments wp.media.view.MediaFrame.Select 414 * @augments wp.media.view.MediaFrame 415 * @augments wp.media.view.Frame 416 * @augments wp.media.View 417 * @augments wp.Backbone.View 418 * @augments Backbone.View 419 * @mixes wp.media.controller.StateMachine 420 */ 421 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDetails.prototype */{ 422 defaults: { 423 id: 'video', 424 url: '', 425 menu: 'video-details', 426 content: 'video-details', 427 toolbar: 'video-details', 428 type: 'link', 429 title: l10n.videoDetailsTitle, 430 priority: 120 431 }, 432 433 initialize: function( options ) { 434 options.DetailsView = wp.media.view.VideoDetails; 435 options.cancelText = l10n.videoDetailsCancel; 436 options.addText = l10n.videoAddSourceTitle; 437 438 MediaDetails.prototype.initialize.call( this, options ); 439 }, 440 441 bindHandlers: function() { 442 MediaDetails.prototype.bindHandlers.apply( this, arguments ); 443 444 this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this ); 445 this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this ); 446 this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this ); 447 this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this ); 448 }, 449 450 createStates: function() { 451 this.states.add([ 452 new wp.media.controller.VideoDetails({ 453 media: this.media 454 }), 455 456 new MediaLibrary( { 457 type: 'video', 458 id: 'replace-video', 459 title: l10n.videoReplaceTitle, 460 toolbar: 'replace-video', 461 media: this.media, 462 menu: 'video-details' 463 } ), 464 465 new MediaLibrary( { 466 type: 'video', 467 id: 'add-video-source', 468 title: l10n.videoAddSourceTitle, 469 toolbar: 'add-video-source', 470 media: this.media, 471 menu: false 472 } ), 473 474 new MediaLibrary( { 475 type: 'image', 476 id: 'select-poster-image', 477 title: l10n.videoSelectPosterImageTitle, 478 toolbar: 'select-poster-image', 479 media: this.media, 480 menu: 'video-details' 481 } ), 482 483 new MediaLibrary( { 484 type: 'text', 485 id: 'add-track', 486 title: l10n.videoAddTrackTitle, 487 toolbar: 'add-track', 488 media: this.media, 489 menu: 'video-details' 490 } ) 491 ]); 492 }, 493 494 renderSelectPosterImageToolbar: function() { 495 this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) { 496 var urls = [], attachment = state.get( 'selection' ).single(); 497 498 controller.media.set( 'poster', attachment.get( 'url' ) ); 499 state.trigger( 'set-poster-image', controller.media.toJSON() ); 500 501 _.each( wp.media.view.settings.embedExts, function (ext) { 502 if ( controller.media.get( ext ) ) { 503 urls.push( controller.media.get( ext ) ); 504 } 505 } ); 506 507 wp.ajax.send( 'set-attachment-thumbnail', { 508 data : { 509 _ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail, 510 urls: urls, 511 thumbnail_id: attachment.get( 'id' ) 512 } 513 } ); 514 } ); 515 }, 516 517 renderAddTrackToolbar: function() { 518 this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) { 519 var attachment = state.get( 'selection' ).single(), 520 content = controller.media.get( 'content' ); 521 522 if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) { 523 content += [ 524 '<track srclang="en" label="English" kind="subtitles" src="', 525 attachment.get( 'url' ), 526 '" />' 527 ].join(''); 528 529 controller.media.set( 'content', content ); 530 } 531 state.trigger( 'add-track', controller.media.toJSON() ); 532 } ); 533 } 534 }); 535 536 module.exports = VideoDetails; 537 538 539 /***/ }), 540 541 /***/ 9467: 542 /***/ ((module) => { 543 544 /* global MediaElementPlayer */ 545 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay, 546 $ = jQuery, 547 MediaDetails; 548 549 /** 550 * wp.media.view.MediaDetails 551 * 552 * @memberOf wp.media.view 553 * 554 * @class 555 * @augments wp.media.view.Settings.AttachmentDisplay 556 * @augments wp.media.view.Settings 557 * @augments wp.media.View 558 * @augments wp.Backbone.View 559 * @augments Backbone.View 560 */ 561 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{ 562 initialize: function() { 563 _.bindAll(this, 'success'); 564 this.players = []; 565 this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers ); 566 this.on( 'ready', this.setPlayer ); 567 this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this ); 568 this.on( 'media:setting:remove', this.render ); 569 this.on( 'media:setting:remove', this.setPlayer ); 570 571 AttachmentDisplay.prototype.initialize.apply( this, arguments ); 572 }, 573 574 events: function(){ 575 return _.extend( { 576 'click .remove-setting' : 'removeSetting', 577 'change .content-track' : 'setTracks', 578 'click .remove-track' : 'setTracks', 579 'click .add-media-source' : 'addSource' 580 }, AttachmentDisplay.prototype.events ); 581 }, 582 583 prepare: function() { 584 return _.defaults({ 585 model: this.model.toJSON() 586 }, this.options ); 587 }, 588 589 /** 590 * Remove a setting's UI when the model unsets it 591 * 592 * @fires wp.media.view.MediaDetails#media:setting:remove 593 * 594 * @param {Event} e 595 */ 596 removeSetting : function(e) { 597 var wrap = $( e.currentTarget ).parent(), setting; 598 setting = wrap.find( 'input' ).data( 'setting' ); 599 600 if ( setting ) { 601 this.model.unset( setting ); 602 this.trigger( 'media:setting:remove', this ); 603 } 604 605 wrap.remove(); 606 }, 607 608 /** 609 * 610 * @fires wp.media.view.MediaDetails#media:setting:remove 611 */ 612 setTracks : function() { 613 var tracks = ''; 614 615 _.each( this.$('.content-track'), function(track) { 616 tracks += $( track ).val(); 617 } ); 618 619 this.model.set( 'content', tracks ); 620 this.trigger( 'media:setting:remove', this ); 621 }, 622 623 addSource : function( e ) { 624 this.controller.lastMime = $( e.currentTarget ).data( 'mime' ); 625 this.controller.setState( 'add-' + this.controller.defaults.id + '-source' ); 626 }, 627 628 loadPlayer: function () { 629 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); 630 this.scriptXhr = false; 631 }, 632 633 setPlayer : function() { 634 var src; 635 636 if ( this.players.length || ! this.media || this.scriptXhr ) { 637 return; 638 } 639 640 src = this.model.get( 'src' ); 641 642 if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) { 643 this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) ); 644 } else { 645 this.loadPlayer(); 646 } 647 }, 648 649 /** 650 * @abstract 651 */ 652 setMedia : function() { 653 return this; 654 }, 655 656 success : function(mejs) { 657 var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; 658 659 if ( 'flash' === mejs.pluginType && autoplay ) { 660 mejs.addEventListener( 'canplay', function() { 661 mejs.play(); 662 }, false ); 663 } 664 665 this.mejs = mejs; 666 }, 667 668 /** 669 * @return {media.view.MediaDetails} Returns itself to allow chaining. 670 */ 671 render: function() { 672 AttachmentDisplay.prototype.render.apply( this, arguments ); 673 674 setTimeout( _.bind( function() { 675 this.scrollToTop(); 676 }, this ), 10 ); 677 678 this.settings = _.defaults( { 679 success : this.success 680 }, wp.media.mixin.mejsSettings ); 681 682 return this.setMedia(); 683 }, 684 685 scrollToTop: function() { 686 this.$( '.embed-media-settings' ).scrollTop( 0 ); 687 } 688 },/** @lends wp.media.view.MediaDetails */{ 689 instances : 0, 690 /** 691 * When multiple players in the DOM contain the same src, things get weird. 692 * 693 * @param {HTMLElement} elem 694 * @return {HTMLElement} 695 */ 696 prepareSrc : function( elem ) { 697 var i = MediaDetails.instances++; 698 _.each( $( elem ).find( 'source' ), function( source ) { 699 source.src = [ 700 source.src, 701 source.src.indexOf('?') > -1 ? '&' : '?', 702 '_=', 703 i 704 ].join(''); 705 } ); 706 707 return elem; 708 } 709 }); 710 711 module.exports = MediaDetails; 712 713 714 /***/ }), 715 716 /***/ 5836: 717 /***/ ((module) => { 718 719 var MediaDetails = wp.media.view.MediaDetails, 720 VideoDetails; 721 722 /** 723 * wp.media.view.VideoDetails 724 * 725 * @memberOf wp.media.view 726 * 727 * @class 728 * @augments wp.media.view.MediaDetails 729 * @augments wp.media.view.Settings.AttachmentDisplay 730 * @augments wp.media.view.Settings 731 * @augments wp.media.View 732 * @augments wp.Backbone.View 733 * @augments Backbone.View 734 */ 735 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{ 736 className: 'video-details', 737 template: wp.template('video-details'), 738 739 setMedia: function() { 740 var video = this.$('.wp-video-shortcode'); 741 742 if ( video.find( 'source' ).length ) { 743 if ( video.is(':hidden') ) { 744 video.show(); 745 } 746 747 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { 748 this.media = MediaDetails.prepareSrc( video.get(0) ); 749 } else { 750 this.media = video.get(0); 751 } 752 } else { 753 video.hide(); 754 this.media = false; 755 } 756 757 return this; 758 } 759 }); 760 761 module.exports = VideoDetails; 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 : Tue Dec 17 08:20:01 2024 | Cross-referenced by PHPXref |