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

2 lines
14 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(i){var o={};function n(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}n.m=i,n.c=o,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([,,,,,,,,,,,function(e,t,i){e.exports=i(12)},function(e,t,i){var o=wp.media;o.controller.EditAttachmentMetadata=i(13),o.view.MediaFrame.Manage=i(14),o.view.Attachment.Details.TwoColumn=i(15),o.view.MediaFrame.Manage.Router=i(16),o.view.EditImage.Details=i(17),o.view.MediaFrame.EditAttachments=i(18),o.view.SelectModeToggleButton=i(19),o.view.DeleteSelectedButton=i(20),o.view.DeleteSelectedPermanentlyButton=i(21)},function(e,t){var i,o=wp.media.view.l10n;i=wp.media.controller.State.extend({defaults:{id:"edit-attachment",title:o.attachmentDetails,content:"edit-metadata",menu:!1,toolbar:!1,router:!1}}),e.exports=i},function(e,t){var i,o=wp.media.view.MediaFrame,n=wp.media.controller.Library,s=Backbone.$;i=o.extend({initialize:function(){_.defaults(this.options,{title:"",modal:!1,selection:[],library:{},multiple:"add",state:"library",uploader:!0,mode:["grid","edit"]}),this.$body=s(document.body),this.$window=s(window),this.$adminBar=s("#wpadminbar"),this.$uploaderToggler=s(".page-title-action").attr("aria-expanded","false").on("click",_.bind(this.addNewClickHandler,this)),this.$window.on("scroll resize",_.debounce(_.bind(this.fixPosition,this),15)),this.$el.addClass("wp-core-ui"),!wp.Uploader.limitExceeded&&wp.Uploader.browser.supported||(this.options.uploader=!1),this.options.uploader&&(this.uploader=new wp.media.view.UploaderWindow({controller:this,uploader:{dropzone:document.body,container:document.body}}).render(),this.uploader.ready(),s("body").append(this.uploader.el),this.options.uploader=!1),this.gridRouter=new wp.media.view.MediaFrame.Manage.Router,o.prototype.initialize.apply(this,arguments),this.$el.appendTo(this.options.container),this.createStates(),this.bindRegionModeHandlers(),this.render(),this.bindSearchHandler(),wp.media.frames.browse=this},bindSearchHandler:function(){var e=this.$("#media-search-input"),t=this.browserView.toolbar.get("search").$el,i=this.$(".view-list"),o=_.throttle(function(e){var t=s(e.currentTarget).val(),i="";t&&(i+="?search="+t,this.gridRouter.navigate(this.gridRouter.baseUrl(i),{replace:!0}))},1e3);e.on("input",_.bind(o,this)),this.gridRouter.on("route:search",function(){var e=window.location.href;-1<e.indexOf("mode=")?e=e.replace(/mode=[^&]+/g,"mode=list"):e+=-1<e.indexOf("?")?"&mode=list":"?mode=list",e=e.replace("search=","s="),i.prop("href",e)}).on("route:reset",function(){t.val("").trigger("input")})},createStates:function(){var e=this.options;this.options.states||this.states.add([new n({library:wp.media.query(e.library),multiple:e.multiple,title:e.title,content:"browse",toolbar:"select",contentUserSetting:!1,filterable:"all",autoSelect:!1})])},bindRegionModeHandlers:function(){this.on("content:create:browse",this.browseContent,this),this.on("edit:attachment",this.openEditAttachmentModal,this),this.on("select:activate",this.bindKeydown,this),this.on("select:deactivate",this.unbindKeydown,this)},handleKeydown:function(e){27===e.which&&(e.preventDefault(),this.deactivateMode("select").activateMode("edit"))},bindKeydown:function(){this.$body.on("keydown.select",_.bind(this.handleKeydown,this))},unbindKeydown:function(){this.$body.off("keydown.select")},fixPosition:function(){var e,t;this