with subviews, including screen reader text
+ this.toolbar.set( 'selectModeToggleButton', new wp.media.view.SelectModeToggleButton({
+ text: l10n.bulkSelect,
+ controller: this.controller,
+ priority: -70
+ }).render() );
+
+ this.toolbar.set( 'deleteSelectedButton', new wp.media.view.DeleteSelectedButton({
+ filters: Filters,
+ style: 'primary',
+ disabled: true,
+ text: mediaTrash ? l10n.trashSelected : l10n.deleteSelected,
+ controller: this.controller,
+ priority: -60,
+ click: function() {
+ var changed = [], removed = [],
+ selection = this.controller.state().get( 'selection' ),
+ library = this.controller.state().get( 'library' );
+
+ if ( ! selection.length ) {
+ return;
+ }
+
+ if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) {
+ return;
+ }
+
+ if ( mediaTrash &&
+ 'trash' !== selection.at( 0 ).get( 'status' ) &&
+ ! window.confirm( l10n.warnBulkTrash ) ) {
+
+ return;
+ }
+
+ selection.each( function( model ) {
+ if ( ! model.get( 'nonces' )['delete'] ) {
+ removed.push( model );
+ return;
+ }
+
+ if ( mediaTrash && 'trash' === model.get( 'status' ) ) {
+ model.set( 'status', 'inherit' );
+ changed.push( model.save() );
+ removed.push( model );
+ } else if ( mediaTrash ) {
+ model.set( 'status', 'trash' );
+ changed.push( model.save() );
+ removed.push( model );
+ } else {
+ model.destroy({wait: true});
+ }
+ } );
+
+ if ( changed.length ) {
+ selection.remove( removed );
+
+ $.when.apply( null, changed ).then( _.bind( function() {
+ library._requery( true );
+ this.controller.trigger( 'selection:action:done' );
+ }, this ) );
+ } else {
+ this.controller.trigger( 'selection:action:done' );
+ }
+ }
+ }).render() );
+
+ if ( mediaTrash ) {
+ this.toolbar.set( 'deleteSelectedPermanentlyButton', new wp.media.view.DeleteSelectedPermanentlyButton({
+ filters: Filters,
+ style: 'primary',
+ disabled: true,
+ text: l10n.deleteSelected,
+ controller: this.controller,
+ priority: -55,
+ click: function() {
+ var removed = [], selection = this.controller.state().get( 'selection' );
+
+ if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) {
+ return;
+ }
+
+ selection.each( function( model ) {
+ if ( ! model.get( 'nonces' )['delete'] ) {
+ removed.push( model );
+ return;
+ }
+
+ model.destroy();
+ } );
+
+ selection.remove( removed );
+ this.controller.trigger( 'selection:action:done' );
+ }
+ }).render() );
+ }
+
+ } else if ( this.options.date ) {
+ // DateFilter is a
")[0],priority:-40})),this.options.suggestedWidth&&this.options.suggestedHeight&&this.toolbar.set("suggestedDimensions",new d({el:g(''+f.suggestedDimensions+" "+this.options.suggestedWidth+" × "+this.options.suggestedHeight+"
")[0],priority:-40}))},updateContent:function(){var a,b=this;a=this.controller.isModeActive("grid")?b.attachmentsNoResults:b.uploader,this.collection.length?(a.$el.addClass("hidden"),b.toolbar.get("spinner").hide()):(this.toolbar.get("spinner").show(),this.dfd=this.collection.more().done(function(){b.collection.length?a.$el.addClass("hidden"):a.$el.removeClass("hidden"),b.toolbar.get("spinner").hide()}))},createUploader:function(){this.uploader=new wp.media.view.UploaderInline({controller:this.controller,status:!1,message:this.controller.isModeActive("grid")?"":f.noItemsFound,canClose:this.controller.isModeActive("grid")}),this.uploader.hide(),this.views.add(this.uploader)},toggleUploader:function(){this.uploader.$el.hasClass("hidden")?this.uploader.show():this.uploader.hide()},createAttachments:function(){this.attachments=new wp.media.view.Attachments({controller:this.controller,collection:this.collection,selection:this.options.selection,model:this.model,sortable:this.options.sortable,scrollElement:this.options.scrollElement,idealColumnWidth:this.options.idealColumnWidth,AttachmentView:this.options.AttachmentView}),this.attachments.listenTo(this.controller,"attachment:keydown:arrow",this.attachments.arrowEvent),this.attachments.listenTo(this.controller,"attachment:details:shift-tab",this.attachments.restoreFocus),this.views.add(this.attachments),this.controller.isModeActive("grid")&&(this.attachmentsNoResults=new d({controller:this.controller,tagName:"p"}),this.attachmentsNoResults.$el.addClass("hidden no-media"),this.attachmentsNoResults.$el.html(f.noMedia),this.views.add(this.attachmentsNoResults))},createSidebar:function(){var a=this.options,b=a.selection,c=this.sidebar=new wp.media.view.Sidebar({controller:this.controller});this.views.add(c),this.controller.uploader&&c.set("uploads",new wp.media.view.UploaderStatus({controller:this.controller,priority:40})),b.on("selection:single",this.createSingle,this),b.on("selection:unsingle",this.disposeSingle,this),b.single()&&this.createSingle()},createSingle:function(){var a=this.sidebar,b=this.options.selection.single();a.set("details",new wp.media.view.Attachment.Details({controller:this.controller,model:b,priority:80})),a.set("compat",new wp.media.view.AttachmentCompat({controller:this.controller,model:b,priority:120})),this.options.display&&a.set("display",new wp.media.view.Settings.AttachmentDisplay({controller:this.controller,model:this.model.display(b),attachment:b,priority:160,userSettings:this.model.get("displayUserSettings")})),"insert"===this.model.id&&a.$el.addClass("visible")},disposeSingle:function(){var a=this.sidebar;a.unset("details"),a.unset("compat"),a.unset("display"),a.$el.removeClass("visible")}}),b.exports=c},{}],31:[function(a,b){var c,d=wp.media.view.Attachments;c=d.extend({events:{},initialize:function(){return _.defaults(this.options,{sortable:!1,resize:!1,AttachmentView:wp.media.view.Attachment.Selection}),d.prototype.initialize.apply(this,arguments)}}),b.exports=c},{}],32:[function(a,b){var c,d=Backbone.$;c=wp.media.View.extend({tagName:"div",className:"button-group button-large media-button-group",initialize:function(){this.buttons=_.map(this.options.buttons||[],function(a){return a instanceof Backbone.View?a:new wp.media.view.Button(a).render()}),delete this.options.buttons,this.options.classes&&this.$el.addClass(this.options.classes)},render:function(){return this.$el.html(d(_.pluck(this.buttons,"el")).detach()),this}}),b.exports=c},{}],33:[function(a,b){var c=wp.media.View.extend({tagName:"a",className:"media-button",attributes:{href:"#"},events:{click:"click"},defaults:{text:"",style:"",size:"large",disabled:!1},initialize:function(){this.model=new Backbone.Model(this.defaults),_.each(this.defaults,function(a,b){var c=this.options[b];_.isUndefined(c)||(this.model.set(b,c),delete this.options[b])},this),this.listenTo(this.model,"change",this.render)},render:function(){var a=["button",this.className],b=this.model.toJSON();return b.style&&a.push("button-"+b.style),b.size&&a.push("button-"+b.size),a=_.uniq(a.concat(this.options.classes)),this.el.className=a.join(" "),this.$el.attr("disabled",b.disabled),this.$el.text(this.model.get("text")),this},click:function(a){"#"===this.attributes.href&&a.preventDefault(),this.options.click&&!this.model.get("disabled")&&this.options.click.apply(this,arguments)}});b.exports=c},{}],34:[function(a,b){var c,d=wp.media.View,e=wp.media.view.UploaderStatus,f=wp.media.view.l10n,g=jQuery;c=d.extend({className:"crop-content",template:wp.template("crop-content"),initialize:function(){_.bindAll(this,"onImageLoad")},ready:function(){this.controller.frame.on("content:error:crop",this.onError,this),this.$image=this.$el.find(".crop-image"),this.$image.on("load",this.onImageLoad),g(window).on("resize.cropper",_.debounce(this.onImageLoad,250))},remove:function(){g(window).off("resize.cropper"),this.$el.remove(),this.$el.off(),d.prototype.remove.apply(this,arguments)},prepare:function(){return{title:f.cropYourImage,url:this.options.attachment.get("url")}},onImageLoad:function(){var a=this.controller.get("imgSelectOptions");"function"==typeof a&&(a=a(this.options.attachment,this.controller)),a=_.extend(a,{parent:this.$el}),this.trigger("image-loaded"),this.controller.imgSelect=this.$image.imgAreaSelect(a)},onError:function(){var a=this.options.attachment.get("filename");this.views.add(".upload-errors",new wp.media.view.UploaderStatusError({filename:e.prototype.filename(a),message:window._wpMediaViewsL10n.cropError}),{at:0})}}),b.exports=c},{}],35:[function(a,b){var c,d=wp.media.View;c=d.extend({className:"image-editor",template:wp.template("image-editor"),initialize:function(a){this.editor=window.imageEdit,this.controller=a.controller,d.prototype.initialize.apply(this,arguments)},prepare:function(){return this.model.toJSON()},loadEditor:function(){var a=this.editor.open(this.model.get("id"),this.model.get("nonces").edit,this);a.done(_.bind(this.focus,this))},focus:function(){this.$(".imgedit-submit .button").eq(0).focus()},back:function(){var a=this.controller.lastState();this.controller.setState(a)},refresh:function(){this.model.fetch()},save:function(){var a=this.controller.lastState();this.model.fetch().done(_.bind(function(){this.controller.setState(a)},this))}}),b.exports=c},{}],36:[function(a,b){var c=wp.media.View.extend({className:"media-embed",initialize:function(){this.url=new wp.media.view.EmbedUrl({controller:this.controller,model:this.model.props}).render(),this.views.set([this.url]),this.refresh(),this.listenTo(this.model,"change:type",this.refresh),this.listenTo(this.model,"change:loading",this.loading)},settings:function(a){this._settings&&this._settings.remove(),this._settings=a,this.views.add(a)},refresh:function(){var a,b=this.model.get("type");if("image"===b)a=wp.media.view.EmbedImage;else{if("link"!==b)return;a=wp.media.view.EmbedLink}this.settings(new a({controller:this.controller,model:this.model.props,priority:40}))},loading:function(){this.$el.toggleClass("embed-loading",this.model.get("loading"))}});b.exports=c},{}],37:[function(a,b){var c,d=wp.media.view.Settings.AttachmentDisplay;c=d.extend({className:"embed-media-settings",template:wp.template("embed-image-settings"),initialize:function(){d.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:url",this.updateImage)},updateImage:function(){this.$("img").attr("src",this.model.get("url"))}}),b.exports=c},{}],38:[function(a,b){var c,d=jQuery;c=wp.media.view.Settings.extend({className:"embed-link-settings",template:wp.template("embed-link-settings"),initialize:function(){this.spinner=d('