- // Append the frame view directly the supplied container.
- this.$el.appendTo( this.options.container );
-
- this.createStates();
- this.bindRegionModeHandlers();
- this.render();
-
- // Update the URL when entering search string (at most once per second)
- $( '#media-search-input' ).on( 'input', _.debounce( function(e) {
- var val = $( e.currentTarget ).val(), url = '';
- if ( val ) {
- url += '?search=' + val;
- }
- self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
- }, 1000 ) );
- },
-
- /**
- * Create the default states for the frame.
- */
- createStates: function() {
- var options = this.options;
-
- if ( this.options.states ) {
- return;
- }
-
- // Add the default states.
- this.states.add([
- new media.controller.Library({
- library: media.query( options.library ),
- multiple: options.multiple,
- title: options.title,
- content: 'browse',
- toolbar: 'select',
- contentUserSetting: false,
- filterable: 'all',
- autoSelect: false
- })
- ]);
- },
-
- /**
- * Bind region mode activation events to proper handlers.
- */
- bindRegionModeHandlers: function() {
- this.on( 'content:create:browse', this.browseContent, this );
-
- // Handle a frame-level event for editing an attachment.
- this.on( 'edit:attachment', this.openEditAttachmentModal, this );
-
- this.on( 'select:activate', this.bindKeydown, this );
- this.on( 'select:deactivate', this.unbindKeydown, this );
- },
+ wp.media.mixin.removeAllPlayers();
+ this.$( 'audio, video' ).each( function (i, elem) {
+ var el = wp.media.view.MediaDetails.prepareSrc( elem );
+ new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings );
+ } );
+ }
+});
+
+module.exports = TwoColumn;
+
+},{}],5:[function(require,module,exports){
+/**
+ * wp.media.view.DeleteSelectedPermanentlyButton
+ *
+ * When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
+ *
+ * @class
+ * @augments wp.media.view.DeleteSelectedButton
+ * @augments wp.media.view.Button
+ * @augments wp.media.View
+ * @augments wp.Backbone.View
+ * @augments Backbone.View
+ */
+var Button = wp.media.view.Button,
+ DeleteSelected = wp.media.view.DeleteSelectedButton,
+ DeleteSelectedPermanently;
+
+DeleteSelectedPermanently = DeleteSelected.extend({
+ initialize: function() {
+ DeleteSelected.prototype.initialize.apply( this, arguments );
+ this.controller.on( 'select:activate', this.selectActivate, this );
+ this.controller.on( 'select:deactivate', this.selectDeactivate, this );
+ },
+
+ filterChange: function( model ) {
+ this.canShow = ( 'trash' === model.get( 'status' ) );
+ },
+
+ selectActivate: function() {
+ this.toggleDisabled();
+ this.$el.toggleClass( 'hidden', ! this.canShow );
+ },
+
+ selectDeactivate: function() {
+ this.toggleDisabled();
+ this.$el.addClass( 'hidden' );
+ },
+
+ render: function() {
+ Button.prototype.render.apply( this, arguments );
+ this.selectActivate();
+ return this;
+ }
+});
+
+module.exports = DeleteSelectedPermanently;
+
+},{}],6:[function(require,module,exports){
+/**
+ * wp.media.view.DeleteSelectedButton
+ *
+ * A button that handles bulk Delete/Trash logic
+ *
+ * @class
+ * @augments wp.media.view.Button
+ * @augments wp.media.View
+ * @augments wp.Backbone.View
+ * @augments Backbone.View
+ */
+var Button = wp.media.view.Button,
+ l10n = wp.media.view.l10n,
+ DeleteSelected;
+
+DeleteSelected = Button.extend({
+ initialize: function() {
+ Button.prototype.initialize.apply( this, arguments );
+ if ( this.options.filters ) {
+ this.options.filters.model.on( 'change', this.filterChange, this );
+ }
+ this.controller.on( 'selection:toggle', this.toggleDisabled, this );
+ },
+
+ filterChange: function( model ) {
+ if ( 'trash' === model.get( 'status' ) ) {
+ this.model.set( 'text', l10n.untrashSelected );
+ } else if ( wp.media.view.settings.mediaTrash ) {
+ this.model.set( 'text', l10n.trashSelected );
+ } else {
+ this.model.set( 'text', l10n.deleteSelected );
+ }
+ },
+
+ toggleDisabled: function() {
+ this.model.set( 'disabled', ! this.controller.state().get( 'selection' ).length );
+ },
+
+ render: function() {
+ Button.prototype.render.apply( this, arguments );
+ if ( this.controller.isModeActive( 'select' ) ) {
+ this.$el.addClass( 'delete-selected-button' );
+ } else {
+ this.$el.addClass( 'delete-selected-button hidden' );
+ }
+ this.toggleDisabled();
+ return this;
+ }
+});
+
+module.exports = DeleteSelected;
+
+},{}],7:[function(require,module,exports){
+/**
+ * wp.media.view.SelectModeToggleButton
+ *
+ * @class
+ * @augments wp.media.view.Button
+ * @augments wp.media.View
+ * @augments wp.Backbone.View
+ * @augments Backbone.View
+ */
+var Button = wp.media.view.Button,
+ l10n = wp.media.view.l10n,
+ SelectModeToggle;
+
+SelectModeToggle = Button.extend({
+ initialize: function() {
+ _.defaults( this.options, {
+ size : ''
+ } );
+
+ Button.prototype.initialize.apply( this, arguments );
+ this.controller.on( 'select:activate select:deactivate', this.toggleBulkEditHandler, this );
+ this.controller.on( 'selection:action:done', this.back, this );
+ },
+
+ back: function () {
+ this.controller.deactivateMode( 'select' ).activateMode( 'edit' );
+ },
+
+ click: function() {
+ Button.prototype.click.apply( this, arguments );
+ if ( this.controller.isModeActive( 'select' ) ) {
+ this.back();
+ } else {
+ this.controller.deactivateMode( 'edit' ).activateMode( 'select' );
+ }
+ },