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

2 lines
14 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(i){var s={};function r(t){if(s[t])return s[t].exports;var e=s[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=i,r.c=s,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(i,s,function(t){return e[t]}.bind(null,s));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=22)}({22:function(t,e,i){t.exports=i(23)},23:function(t,e,i){var s,r,n,a,o=jQuery;window.wp=window.wp||{},a=wp.media=function(t){var e,i=a.view.MediaFrame;if(i)return"select"===(t=_.defaults(t||{},{frame:"select"})).frame&&i.Select?e=new i.Select(t):"post"===t.frame&&i.Post?e=new i.Post(t):"manage"===t.frame&&i.Manage?e=new i.Manage(t):"image"===t.frame&&i.ImageDetails?e=new i.ImageDetails(t):"audio"===t.frame&&i.AudioDetails?e=new i.AudioDetails(t):"video"===t.frame&&i.VideoDetails?e=new i.VideoDetails(t):"edit-attachments"===t.frame&&i.EditAttachments&&(e=new i.EditAttachments(t)),delete t.frame,a.frame=e},_.extend(a,{model:{},view:{},controller:{},frames:{}}),n=a.model.l10n=window._wpMediaModelsL10n||{},a.model.settings=n.settings||{},delete n.settings,s=a.model.Attachment=i(24),r=a.model.Attachments=i(25),a.model.Query=i(26),a.model.PostImage=i(27),a.model.Selection=i(28),a.compare=function(t,e,i,s){return _.isEqual(t,e)?i===s?0:s<i?-1:1:e<t?-1:1},_.extend(a,{template:wp.template,post:wp.ajax.post,ajax:wp.ajax.send,fit:function(t){var e,i=t.width,s=t.height,r=t.maxWidth,n=t.maxHeight;return _.isUndefined(r)||_.isUndefined(n)?_.isUndefined(n)?e="width":_.isUndefined(r)&&n<s&&(e="height"):e=r/n<i/s?"width":"height","width"===e&&r<i?{width:r,height:Math.round(r*s/i)}:"height"===e&&n<s?{width:Math.round(n*i/s),height:n}:{width:i,height:s}},truncate:function(t,e,i){return e=e||30,i=i||"&hellip;",t.length<=e?t:t.substr(0,e/2)+i+t.substr(-1*e/2)}}),a.attachment=function(t){return s.get(t)},r.all=new r,a.query=function(t){return new r(null,{props:_.extend(_.defaults(t||{},{orderby:"date"}),{query:!0})})},o(window).on("unload",function(){window.wp=null})},24:function(t,e){var i,n=Backbone.$;i=Backbone.Model.extend({sync:function(t,e,i){return _.isUndefined(this.id)?n.Deferred().rejectWith(this).promise():"read"===t?((i=i||{}).context=this,i.data=_.extend(i.data||{},{action:"get-attachment",id:this.id}),wp.media.ajax(i)):"update"===t?this.get("nonces")&&this.get("nonces").update?((i=i||{}).context=this,i.data=_.extend(i.data||{},{action:"save-attachment",id:this.id,nonce:this.get("nonces").update,post_id:wp.media.model.settings.post.id}),e.hasChanged()&&(i.data.changes={},_.each(e.changed,function(t,e){i.data.changes[e]=this.get(e)},this)),wp.media.ajax(i)):n.Deferred().rejectWith(this).promise():"delete"===t?((i=i||{}).wait||(this.destroyed=!0),i.context=this,i.data=_.extend(i.data||{},{action:"delete-post",id:this.id,_wpnonce:this.get("nonces").delete}),wp.media.ajax(i).done(function(){this.destroyed=!0}).fail(function(){this.destroyed=!1})):Backbone.Model.prototype.sync.apply(this,arguments)},parse:function(t){return t&&(t.date=new Date(t.date),t.modified=new Date(t.modified)),t},saveCompat:function(t,s){var r=this;return this.get("nonces")&&this.get("nonces").update?wp.media.post("save-attachment-compat",_.defaults({id:this.id,nonce:this.get("nonces").update,post_id:wp.media.model.settings.post.id},t)).done(function(t,e,i){r.set(r.parse(t,i),s)}):n.Deferred().rejectWith(this).promise()}},{create:function(t){return wp.media.model.Attachments.all.push(t)},get:_.memoize(function(t,e){return wp.media.model.Attachments.all.push(e||{id:t}