WordPress/wp-includes/js/media-grid.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

!function o(n,s,a){function r(t,e){if(!s[t]){if(!n[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(d)return d(t,!0);throw(i=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",i}i=s[t]={exports:{}},n[t][0].call(i.exports,function(e){return r(n[t][1][e]||e)},i,i.exports,o,n,s,a)}return s[t].exports}for(var d="function"==typeof require&&require,e=0;e<a.length;e++)r(a[e]);return r}({1:[function(e,t,i){var o=wp.media.view.l10n,o=wp.media.controller.State.extend({defaults:{id:"edit-attachment",title:o.attachmentDetails,content:"edit-metadata",menu:!1,toolbar:!1,router:!1}});t.exports=o},{}],2:[function(e,t,i){var o=wp.media;o.controller.EditAttachmentMetadata=e("./controllers/edit-attachment-metadata.js"),o.view.MediaFrame.Manage=e("./views/frame/manage.js"),o.view.Attachment.Details.TwoColumn=e("./views/attachment/details-two-column.js"),o.view.MediaFrame.Manage.Router=e("./routers/manage.js"),o.view.EditImage.Details=e("./views/edit-image-details.js"),o.view.MediaFrame.EditAttachments=e("./views/frame/edit-attachments.js"),o.view.SelectModeToggleButton=e("./views/button/select-mode-toggle.js"),o.view.DeleteSelectedButton=e("./views/button/delete-selected.js"),o.view.DeleteSelectedPermanentlyButton=e("./views/button/delete-selected-permanently.js")},{"./controllers/edit-attachment-metadata.js":1,"./routers/manage.js":3,"./views/attachment/details-two-column.js":4,"./views/button/delete-selected-permanently.js":5,"./views/button/delete-selected.js":6,"./views/button/select-mode-toggle.js":7,"./views/edit-image-details.js":8,"./views/frame/edit-attachments.js":9,"./views/frame/manage.js":10}],3:[function(e,t,i){var o=Backbone.Router.extend({routes:{"upload.php?item=:slug":"showItem","upload.php?search=:query":"search"},baseUrl:function(e){return"upload.php"+e},search:function(e){jQuery("#media-search-input").val(e).trigger("input")},showItem:function(e){var t=wp.media,i=t.frame.state().get("library").findWhere({id:parseInt(e,10)});i?t.frame.trigger("edit:attachment",i):(i=t.attachment(e),t.frame.listenTo(i,"change",function(e){t.frame.stopListening(i),t.frame.trigger("edit:attachment",e)}),i.fetch())}});t.exports=o},{}],4:[function(e,t,i){var o=wp.media.view.Attachment.Details,n=o.extend({template:wp.template("attachment-details-two-column"),editAttachment:function(e){e.preventDefault(),this.controller.content.mode("edit-image")},toggleSelectionHandler:function(){},render:function(){o.prototype.render.apply(this,arguments),wp.media.mixin.removeAllPlayers(),this.$("audio, video").each(function(e,t){t=wp.media.view.MediaDetails.prepareSrc(t);new window.MediaElementPlayer(t,wp.media.mixin.mejsSettings)})}});t.exports=n},{}],5:[function(e,t,i){var o=wp.media.view.Button,n=wp.media.view.DeleteSelectedButton,s=n.extend({initialize:function(){n.prototype.initialize.apply(this,arguments),this.controller.on("select:activate",this.selectActivate,this),this.controller.on("select:deactivate",this.selectDeactivate,this)},filterChange:function(e){this.canShow="trash"===e.get("status")},selectActivate:function(){this.toggleDisabled(),this.$el.toggleClass("hidden",!this.canShow)},selectDeactivate:function(){this.toggleDisabled(),this.$el.addClass("hidden")},render:function(){return o.prototype.render.apply(this,arguments),this.selectActivate(),this}});t.exports=s},{}],6:[function(e,t,i){var o=wp.media.view.Button,n=wp.media.view.l10n,s=o.extend({initialize:function(){o.prototype.initialize.apply(this,arguments),this.options.filters&&this.options.filters.model.on("change",this.filterChange,this),this.controller.on("selection:toggle",this.toggleDisabled,this)},filterChange:function(e){"trash"===e.get("status")?this.model.set("text",n.untrashSelected):wp.media.view.settings.mediaTrash?this.model.set("text",n.trashSelected):this.model.set("text",n.deleteSelected)},toggleDisabled:function(){this.model.set("disabled",!this.controller.state().get("selection").length)},render:function(){return o.prototype.render.apply(this,arguments),this.controller.isModeActive("select")?this.$el.addClass("delete-selected-butto