2014-07-04 05:39:15 +02:00
|
|
|
!function(a,b,c,d){var e,f=d.media;f.view.l10n?e=f.view.l10n:(e=f.view.l10n="undefined"==typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n,delete e.settings),f.controller.EditImageNoFrame=f.controller._State.extend({defaults:{id:"edit-attachment",title:e.editImage,menu:!1,router:"edit-metadata",content:"edit-metadata",toolbar:"toolbar",url:""},initialize:function(){f.controller._State.prototype.initialize.apply(this,arguments)},activate:function(){this.listenTo(this.frame,"toolbar:render:edit-image",this.toolbar)},_postActivate:function(){this._content(),this._router()},deactivate:function(){this.stopListening(this.frame)},toolbar:function(){var a=this.frame,b=a.lastState(),c=b&&b.id;a.toolbar.set(new f.view.Toolbar({controller:a,items:{back:{style:"primary",text:e.back,priority:20,click:function(){c?a.setState(c):a.close()}}}}))},_router:function(){var a,b=this.frame.router,c=this.get("router");this.frame.$el.toggleClass("hide-router",!c),c&&(this.frame.router.render(c),a=b.get(),a&&a.select&&a.select(this.frame.content.mode()))},_content:function(){var a=this.get("content");a&&this.frame.content.render(a)}}),f.view.MediaFrame.Manage=f.view.MediaFrame.extend({initialize:function(){b.defaults(this.options,{title:e.mediaLibraryTitle,modal:!1,selection:[],library:{},multiple:!1,state:"library",uploader:!0,mode:["grid","edit"]}),this.$el.addClass("wp-core-ui media-grid-view"),(d.Uploader.limitExceeded||!d.Uploader.browser.supported)&&(this.options.uploader=!1),this.options.uploader&&(this.uploader=new f.view.UploaderWindow({controller:this,uploader:{dropzone:a("body"),container:a("body")}}).render(),this.uploader.ready(),a("body").append(this.uploader.el),this.options.uploader=!1),f.view.MediaFrame.prototype.initialize.apply(this,arguments),this.$el.appendTo(this.options.container),this.createSelection(),this.createStates(),this.bindHandlers(),this.render()},createSelection:function(){var a=this.options.selection;a instanceof f.model.Selection||(this.options.selection=new f.model.Selection(a,{multiple:this.options.multiple})),this._selection={attachments:new f.model.Attachments,difference:[]}},createStates:function(){var a=this.options;this.options.states||this.states.add([new f.controller.Library({library:f.query(a.library),multiple:a.multiple,title:a.title,priority:20,toolbar:!1,router:!1,content:"browse",filterable:"mime-types"})])},bindHandlers:function(){this.on("content:create:browse",this.browseContent,this),this.on("content:render:edit-image",this.editImageContent,this),this.on("edit:attachment",this.editAttachment,this),this.on("edit:attachment:next",this.editNextAttachment,this),this.on("edit:attachment:previous",this.editPreviousAttachment,this)},editPreviousAttachment:function(a){var b=this.state().get("library"),c=b.indexOf(a);this.trigger("edit:attachment",b.at(c-1))},editNextAttachment:function(a){var b=this.state().get("library"),c=b.indexOf(a);this.trigger("edit:attachment",b.at(c+1))},editAttachment:function(a){var b,c,d=this.state().get("library");b=d.indexOf(a)>0?!0:!1,c=d.indexOf(a)<d.length-1?!0:!1,new f.view.Frame.EditAttachment({hasPrevious:b,hasNext:c,model:a,gridController:this})},browseContent:function(a){var b=this.state();a.view=new f.view.AttachmentsBrowser({controller:this,collection:b.get("library"),selection:b.get("selection"),model:b,sortable:b.get("sortable"),search:b.get("searchable"),filters:b.get("filterable"),display:b.get("displaySettings"),dragInfo:b.get("dragInfo"),bulkEdit:!0,sidebar:!1,suggestedWidth:b.get("suggestedWidth"),suggestedHeight:b.get("suggestedHeight"),AttachmentView:b.get("AttachmentView")})},editImageContent:function(){var a=this.state().get("image"),b=new f.view.EditImage({model:a,controller:this}).render();this.content.set(b),b.loadEditor()}}),f.view.Attachment.Details.TwoColumn=f.view.Attachment.Details.extend({template:d.template("attachment-details-two-column"),initialize:function(){this.$el.attr("aria-label",this.model.attributes.title).attr("aria-checked",!1),this.model.on("change:sizes change:uploading",this.render,this),this.model.on("change:title",this._syncTi
|