Changeset 41752 for trunk/src/wp-includes/js/media-models.js
- Timestamp:
- 10/04/2017 09:00:15 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/js/media-models.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-models.js
r41386 r41752 1 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 1 /******/ (function(modules) { // webpackBootstrap 2 /******/ // The module cache 3 /******/ var installedModules = {}; 4 /******/ 5 /******/ // The require function 6 /******/ function __webpack_require__(moduleId) { 7 /******/ 8 /******/ // Check if module is in cache 9 /******/ if(installedModules[moduleId]) { 10 /******/ return installedModules[moduleId].exports; 11 /******/ } 12 /******/ // Create a new module (and put it into the cache) 13 /******/ var module = installedModules[moduleId] = { 14 /******/ i: moduleId, 15 /******/ l: false, 16 /******/ exports: {} 17 /******/ }; 18 /******/ 19 /******/ // Execute the module function 20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 /******/ 22 /******/ // Flag the module as loaded 23 /******/ module.l = true; 24 /******/ 25 /******/ // Return the exports of the module 26 /******/ return module.exports; 27 /******/ } 28 /******/ 29 /******/ 30 /******/ // expose the modules object (__webpack_modules__) 31 /******/ __webpack_require__.m = modules; 32 /******/ 33 /******/ // expose the module cache 34 /******/ __webpack_require__.c = installedModules; 35 /******/ 36 /******/ // define getter function for harmony exports 37 /******/ __webpack_require__.d = function(exports, name, getter) { 38 /******/ if(!__webpack_require__.o(exports, name)) { 39 /******/ Object.defineProperty(exports, name, { 40 /******/ configurable: false, 41 /******/ enumerable: true, 42 /******/ get: getter 43 /******/ }); 44 /******/ } 45 /******/ }; 46 /******/ 47 /******/ // getDefaultExport function for compatibility with non-harmony modules 48 /******/ __webpack_require__.n = function(module) { 49 /******/ var getter = module && module.__esModule ? 50 /******/ function getDefault() { return module['default']; } : 51 /******/ function getModuleExports() { return module; }; 52 /******/ __webpack_require__.d(getter, 'a', getter); 53 /******/ return getter; 54 /******/ }; 55 /******/ 56 /******/ // Object.prototype.hasOwnProperty.call 57 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 /******/ 59 /******/ // __webpack_public_path__ 60 /******/ __webpack_require__.p = ""; 61 /******/ 62 /******/ // Load entry module and return exports 63 /******/ return __webpack_require__(__webpack_require__.s = 20); 64 /******/ }) 65 /************************************************************************/ 66 /******/ ({ 67 68 /***/ 20: 69 /***/ (function(module, exports, __webpack_require__) { 70 2 71 var $ = jQuery, 3 72 Attachment, Attachments, l10n, media; … … 66 135 delete l10n.settings; 67 136 68 Attachment = media.model.Attachment = require( './models/attachment.js');69 Attachments = media.model.Attachments = require( './models/attachments.js');70 71 media.model.Query = require( './models/query.js');72 media.model.PostImage = require( './models/post-image.js');73 media.model.Selection = require( './models/selection.js');137 Attachment = media.model.Attachment = __webpack_require__( 21 ); 138 Attachments = media.model.Attachments = __webpack_require__( 22 ); 139 140 media.model.Query = __webpack_require__( 23 ); 141 media.model.PostImage = __webpack_require__( 24 ); 142 media.model.Selection = __webpack_require__( 25 ); 74 143 75 144 /** … … 239 308 }); 240 309 241 },{"./models/attachment.js":2,"./models/attachments.js":3,"./models/post-image.js":4,"./models/query.js":5,"./models/selection.js":6}],2:[function(require,module,exports){ 310 311 /***/ }), 312 313 /***/ 21: 314 /***/ (function(module, exports) { 315 242 316 var $ = Backbone.$, 243 317 Attachment; … … 410 484 module.exports = Attachment; 411 485 412 },{}],3:[function(require,module,exports){ 486 487 /***/ }), 488 489 /***/ 22: 490 /***/ (function(module, exports) { 491 413 492 /** 414 493 * wp.media.model.Attachments … … 955 1034 module.exports = Attachments; 956 1035 957 },{}],4:[function(require,module,exports){ 1036 1037 /***/ }), 1038 1039 /***/ 23: 1040 /***/ (function(module, exports) { 1041 1042 var Attachments = wp.media.model.Attachments, 1043 Query; 1044 1045 /** 1046 * wp.media.model.Query 1047 * 1048 * A collection of attachments that match the supplied query arguments. 1049 * 1050 * Note: Do NOT change this.args after the query has been initialized. 1051 * Things will break. 1052 * 1053 * @memberOf wp.media.model 1054 * 1055 * @class 1056 * @augments wp.media.model.Attachments 1057 * @augments Backbone.Collection 1058 * 1059 * @param {array} [models] Models to initialize with the collection. 1060 * @param {object} [options] Options hash. 1061 * @param {object} [options.args] Attachments query arguments. 1062 * @param {object} [options.args.posts_per_page] 1063 */ 1064 Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ 1065 /** 1066 * @param {array} [models=[]] Array of initial models to populate the collection. 1067 * @param {object} [options={}] 1068 */ 1069 initialize: function( models, options ) { 1070 var allowed; 1071 1072 options = options || {}; 1073 Attachments.prototype.initialize.apply( this, arguments ); 1074 1075 this.args = options.args; 1076 this._hasMore = true; 1077 this.created = new Date(); 1078 1079 this.filters.order = function( attachment ) { 1080 var orderby = this.props.get('orderby'), 1081 order = this.props.get('order'); 1082 1083 if ( ! this.comparator ) { 1084 return true; 1085 } 1086 1087 // We want any items that can be placed before the last 1088 // item in the set. If we add any items after the last 1089 // item, then we can't guarantee the set is complete. 1090 if ( this.length ) { 1091 return 1 !== this.comparator( attachment, this.last(), { ties: true }); 1092 1093 // Handle the case where there are no items yet and 1094 // we're sorting for recent items. In that case, we want 1095 // changes that occurred after we created the query. 1096 } else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) { 1097 return attachment.get( orderby ) >= this.created; 1098 1099 // If we're sorting by menu order and we have no items, 1100 // accept any items that have the default menu order (0). 1101 } else if ( 'ASC' === order && 'menuOrder' === orderby ) { 1102 return attachment.get( orderby ) === 0; 1103 } 1104 1105 // Otherwise, we don't want any items yet. 1106 return false; 1107 }; 1108 1109 // Observe the central `wp.Uploader.queue` collection to watch for 1110 // new matches for the query. 1111 // 1112 // Only observe when a limited number of query args are set. There 1113 // are no filters for other properties, so observing will result in 1114 // false positives in those queries. 1115 allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ]; 1116 if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) { 1117 this.observe( wp.Uploader.queue ); 1118 } 1119 }, 1120 /** 1121 * Whether there are more attachments that haven't been sync'd from the server 1122 * that match the collection's query. 1123 * 1124 * @returns {boolean} 1125 */ 1126 hasMore: function() { 1127 return this._hasMore; 1128 }, 1129 /** 1130 * Fetch more attachments from the server for the collection. 1131 * 1132 * @param {object} [options={}] 1133 * @returns {Promise} 1134 */ 1135 more: function( options ) { 1136 var query = this; 1137 1138 // If there is already a request pending, return early with the Deferred object. 1139 if ( this._more && 'pending' === this._more.state() ) { 1140 return this._more; 1141 } 1142 1143 if ( ! this.hasMore() ) { 1144 return jQuery.Deferred().resolveWith( this ).promise(); 1145 } 1146 1147 options = options || {}; 1148 options.remove = false; 1149 1150 return this._more = this.fetch( options ).done( function( resp ) { 1151 if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) { 1152 query._hasMore = false; 1153 } 1154 }); 1155 }, 1156 /** 1157 * Overrides Backbone.Collection.sync 1158 * Overrides wp.media.model.Attachments.sync 1159 * 1160 * @param {String} method 1161 * @param {Backbone.Model} model 1162 * @param {Object} [options={}] 1163 * @returns {Promise} 1164 */ 1165 sync: function( method, model, options ) { 1166 var args, fallback; 1167 1168 // Overload the read method so Attachment.fetch() functions correctly. 1169 if ( 'read' === method ) { 1170 options = options || {}; 1171 options.context = this; 1172 options.data = _.extend( options.data || {}, { 1173 action: 'query-attachments', 1174 post_id: wp.media.model.settings.post.id 1175 }); 1176 1177 // Clone the args so manipulation is non-destructive. 1178 args = _.clone( this.args ); 1179 1180 // Determine which page to query. 1181 if ( -1 !== args.posts_per_page ) { 1182 args.paged = Math.round( this.length / args.posts_per_page ) + 1; 1183 } 1184 1185 options.data.query = args; 1186 return wp.media.ajax( options ); 1187 1188 // Otherwise, fall back to Backbone.sync() 1189 } else { 1190 /** 1191 * Call wp.media.model.Attachments.sync or Backbone.sync 1192 */ 1193 fallback = Attachments.prototype.sync ? Attachments.prototype : Backbone; 1194 return fallback.sync.apply( this, arguments ); 1195 } 1196 } 1197 }, /** @lends wp.media.model.Query */{ 1198 /** 1199 * @readonly 1200 */ 1201 defaultProps: { 1202 orderby: 'date', 1203 order: 'DESC' 1204 }, 1205 /** 1206 * @readonly 1207 */ 1208 defaultArgs: { 1209 posts_per_page: 40 1210 }, 1211 /** 1212 * @readonly 1213 */ 1214 orderby: { 1215 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ], 1216 /** 1217 * A map of JavaScript orderby values to their WP_Query equivalents. 1218 * @type {Object} 1219 */ 1220 valuemap: { 1221 'id': 'ID', 1222 'uploadedTo': 'parent', 1223 'menuOrder': 'menu_order ID' 1224 } 1225 }, 1226 /** 1227 * A map of JavaScript query properties to their WP_Query equivalents. 1228 * 1229 * @readonly 1230 */ 1231 propmap: { 1232 'search': 's', 1233 'type': 'post_mime_type', 1234 'perPage': 'posts_per_page', 1235 'menuOrder': 'menu_order', 1236 'uploadedTo': 'post_parent', 1237 'status': 'post_status', 1238 'include': 'post__in', 1239 'exclude': 'post__not_in' 1240 }, 1241 /** 1242 * Creates and returns an Attachments Query collection given the properties. 1243 * 1244 * Caches query objects and reuses where possible. 1245 * 1246 * @static 1247 * @method 1248 * 1249 * @param {object} [props] 1250 * @param {Object} [props.cache=true] Whether to use the query cache or not. 1251 * @param {Object} [props.order] 1252 * @param {Object} [props.orderby] 1253 * @param {Object} [props.include] 1254 * @param {Object} [props.exclude] 1255 * @param {Object} [props.s] 1256 * @param {Object} [props.post_mime_type] 1257 * @param {Object} [props.posts_per_page] 1258 * @param {Object} [props.menu_order] 1259 * @param {Object} [props.post_parent] 1260 * @param {Object} [props.post_status] 1261 * @param {Object} [options] 1262 * 1263 * @returns {wp.media.model.Query} A new Attachments Query collection. 1264 */ 1265 get: (function(){ 1266 /** 1267 * @static 1268 * @type Array 1269 */ 1270 var queries = []; 1271 1272 /** 1273 * @returns {Query} 1274 */ 1275 return function( props, options ) { 1276 var args = {}, 1277 orderby = Query.orderby, 1278 defaults = Query.defaultProps, 1279 query, 1280 cache = !! props.cache || _.isUndefined( props.cache ); 1281 1282 // Remove the `query` property. This isn't linked to a query, 1283 // this *is* the query. 1284 delete props.query; 1285 delete props.cache; 1286 1287 // Fill default args. 1288 _.defaults( props, defaults ); 1289 1290 // Normalize the order. 1291 props.order = props.order.toUpperCase(); 1292 if ( 'DESC' !== props.order && 'ASC' !== props.order ) { 1293 props.order = defaults.order.toUpperCase(); 1294 } 1295 1296 // Ensure we have a valid orderby value. 1297 if ( ! _.contains( orderby.allowed, props.orderby ) ) { 1298 props.orderby = defaults.orderby; 1299 } 1300 1301 _.each( [ 'include', 'exclude' ], function( prop ) { 1302 if ( props[ prop ] && ! _.isArray( props[ prop ] ) ) { 1303 props[ prop ] = [ props[ prop ] ]; 1304 } 1305 } ); 1306 1307 // Generate the query `args` object. 1308 // Correct any differing property names. 1309 _.each( props, function( value, prop ) { 1310 if ( _.isNull( value ) ) { 1311 return; 1312 } 1313 1314 args[ Query.propmap[ prop ] || prop ] = value; 1315 }); 1316 1317 // Fill any other default query args. 1318 _.defaults( args, Query.defaultArgs ); 1319 1320 // `props.orderby` does not always map directly to `args.orderby`. 1321 // Substitute exceptions specified in orderby.keymap. 1322 args.orderby = orderby.valuemap[ props.orderby ] || props.orderby; 1323 1324 // Search the query cache for a matching query. 1325 if ( cache ) { 1326 query = _.find( queries, function( query ) { 1327 return _.isEqual( query.args, args ); 1328 }); 1329 } else { 1330 queries = []; 1331 } 1332 1333 // Otherwise, create a new query and add it to the cache. 1334 if ( ! query ) { 1335 query = new Query( [], _.extend( options || {}, { 1336 props: props, 1337 args: args 1338 } ) ); 1339 queries.push( query ); 1340 } 1341 1342 return query; 1343 }; 1344 }()) 1345 }); 1346 1347 module.exports = Query; 1348 1349 1350 /***/ }), 1351 1352 /***/ 24: 1353 /***/ (function(module, exports) { 1354 958 1355 /** 959 1356 * wp.media.model.PostImage … … 1111 1508 module.exports = PostImage; 1112 1509 1113 },{}],5:[function(require,module,exports){ 1114 var Attachments = wp.media.model.Attachments, 1115 Query; 1116 1117 /** 1118 * wp.media.model.Query 1119 * 1120 * A collection of attachments that match the supplied query arguments. 1121 * 1122 * Note: Do NOT change this.args after the query has been initialized. 1123 * Things will break. 1124 * 1125 * @memberOf wp.media.model 1126 * 1127 * @class 1128 * @augments wp.media.model.Attachments 1129 * @augments Backbone.Collection 1130 * 1131 * @param {array} [models] Models to initialize with the collection. 1132 * @param {object} [options] Options hash. 1133 * @param {object} [options.args] Attachments query arguments. 1134 * @param {object} [options.args.posts_per_page] 1135 */ 1136 Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ 1137 /** 1138 * @param {array} [models=[]] Array of initial models to populate the collection. 1139 * @param {object} [options={}] 1140 */ 1141 initialize: function( models, options ) { 1142 var allowed; 1143 1144 options = options || {}; 1145 Attachments.prototype.initialize.apply( this, arguments ); 1146 1147 this.args = options.args; 1148 this._hasMore = true; 1149 this.created = new Date(); 1150 1151 this.filters.order = function( attachment ) { 1152 var orderby = this.props.get('orderby'), 1153 order = this.props.get('order'); 1154 1155 if ( ! this.comparator ) { 1156 return true; 1157 } 1158 1159 // We want any items that can be placed before the last 1160 // item in the set. If we add any items after the last 1161 // item, then we can't guarantee the set is complete. 1162 if ( this.length ) { 1163 return 1 !== this.comparator( attachment, this.last(), { ties: true }); 1164 1165 // Handle the case where there are no items yet and 1166 // we're sorting for recent items. In that case, we want 1167 // changes that occurred after we created the query. 1168 } else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) { 1169 return attachment.get( orderby ) >= this.created; 1170 1171 // If we're sorting by menu order and we have no items, 1172 // accept any items that have the default menu order (0). 1173 } else if ( 'ASC' === order && 'menuOrder' === orderby ) { 1174 return attachment.get( orderby ) === 0; 1175 } 1176 1177 // Otherwise, we don't want any items yet. 1178 return false; 1179 }; 1180 1181 // Observe the central `wp.Uploader.queue` collection to watch for 1182 // new matches for the query. 1183 // 1184 // Only observe when a limited number of query args are set. There 1185 // are no filters for other properties, so observing will result in 1186 // false positives in those queries. 1187 allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ]; 1188 if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) { 1189 this.observe( wp.Uploader.queue ); 1190 } 1191 }, 1192 /** 1193 * Whether there are more attachments that haven't been sync'd from the server 1194 * that match the collection's query. 1195 * 1196 * @returns {boolean} 1197 */ 1198 hasMore: function() { 1199 return this._hasMore; 1200 }, 1201 /** 1202 * Fetch more attachments from the server for the collection. 1203 * 1204 * @param {object} [options={}] 1205 * @returns {Promise} 1206 */ 1207 more: function( options ) { 1208 var query = this; 1209 1210 // If there is already a request pending, return early with the Deferred object. 1211 if ( this._more && 'pending' === this._more.state() ) { 1212 return this._more; 1213 } 1214 1215 if ( ! this.hasMore() ) { 1216 return jQuery.Deferred().resolveWith( this ).promise(); 1217 } 1218 1219 options = options || {}; 1220 options.remove = false; 1221 1222 return this._more = this.fetch( options ).done( function( resp ) { 1223 if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) { 1224 query._hasMore = false; 1225 } 1226 }); 1227 }, 1228 /** 1229 * Overrides Backbone.Collection.sync 1230 * Overrides wp.media.model.Attachments.sync 1231 * 1232 * @param {String} method 1233 * @param {Backbone.Model} model 1234 * @param {Object} [options={}] 1235 * @returns {Promise} 1236 */ 1237 sync: function( method, model, options ) { 1238 var args, fallback; 1239 1240 // Overload the read method so Attachment.fetch() functions correctly. 1241 if ( 'read' === method ) { 1242 options = options || {}; 1243 options.context = this; 1244 options.data = _.extend( options.data || {}, { 1245 action: 'query-attachments', 1246 post_id: wp.media.model.settings.post.id 1247 }); 1248 1249 // Clone the args so manipulation is non-destructive. 1250 args = _.clone( this.args ); 1251 1252 // Determine which page to query. 1253 if ( -1 !== args.posts_per_page ) { 1254 args.paged = Math.round( this.length / args.posts_per_page ) + 1; 1255 } 1256 1257 options.data.query = args; 1258 return wp.media.ajax( options ); 1259 1260 // Otherwise, fall back to Backbone.sync() 1261 } else { 1262 /** 1263 * Call wp.media.model.Attachments.sync or Backbone.sync 1264 */ 1265 fallback = Attachments.prototype.sync ? Attachments.prototype : Backbone; 1266 return fallback.sync.apply( this, arguments ); 1267 } 1268 } 1269 }, /** @lends wp.media.model.Query */{ 1270 /** 1271 * @readonly 1272 */ 1273 defaultProps: { 1274 orderby: 'date', 1275 order: 'DESC' 1276 }, 1277 /** 1278 * @readonly 1279 */ 1280 defaultArgs: { 1281 posts_per_page: 40 1282 }, 1283 /** 1284 * @readonly 1285 */ 1286 orderby: { 1287 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ], 1288 /** 1289 * A map of JavaScript orderby values to their WP_Query equivalents. 1290 * @type {Object} 1291 */ 1292 valuemap: { 1293 'id': 'ID', 1294 'uploadedTo': 'parent', 1295 'menuOrder': 'menu_order ID' 1296 } 1297 }, 1298 /** 1299 * A map of JavaScript query properties to their WP_Query equivalents. 1300 * 1301 * @readonly 1302 */ 1303 propmap: { 1304 'search': 's', 1305 'type': 'post_mime_type', 1306 'perPage': 'posts_per_page', 1307 'menuOrder': 'menu_order', 1308 'uploadedTo': 'post_parent', 1309 'status': 'post_status', 1310 'include': 'post__in', 1311 'exclude': 'post__not_in' 1312 }, 1313 /** 1314 * Creates and returns an Attachments Query collection given the properties. 1315 * 1316 * Caches query objects and reuses where possible. 1317 * 1318 * @static 1319 * @method 1320 * 1321 * @param {object} [props] 1322 * @param {Object} [props.cache=true] Whether to use the query cache or not. 1323 * @param {Object} [props.order] 1324 * @param {Object} [props.orderby] 1325 * @param {Object} [props.include] 1326 * @param {Object} [props.exclude] 1327 * @param {Object} [props.s] 1328 * @param {Object} [props.post_mime_type] 1329 * @param {Object} [props.posts_per_page] 1330 * @param {Object} [props.menu_order] 1331 * @param {Object} [props.post_parent] 1332 * @param {Object} [props.post_status] 1333 * @param {Object} [options] 1334 * 1335 * @returns {wp.media.model.Query} A new Attachments Query collection. 1336 */ 1337 get: (function(){ 1338 /** 1339 * @static 1340 * @type Array 1341 */ 1342 var queries = []; 1343 1344 /** 1345 * @returns {Query} 1346 */ 1347 return function( props, options ) { 1348 var args = {}, 1349 orderby = Query.orderby, 1350 defaults = Query.defaultProps, 1351 query, 1352 cache = !! props.cache || _.isUndefined( props.cache ); 1353 1354 // Remove the `query` property. This isn't linked to a query, 1355 // this *is* the query. 1356 delete props.query; 1357 delete props.cache; 1358 1359 // Fill default args. 1360 _.defaults( props, defaults ); 1361 1362 // Normalize the order. 1363 props.order = props.order.toUpperCase(); 1364 if ( 'DESC' !== props.order && 'ASC' !== props.order ) { 1365 props.order = defaults.order.toUpperCase(); 1366 } 1367 1368 // Ensure we have a valid orderby value. 1369 if ( ! _.contains( orderby.allowed, props.orderby ) ) { 1370 props.orderby = defaults.orderby; 1371 } 1372 1373 _.each( [ 'include', 'exclude' ], function( prop ) { 1374 if ( props[ prop ] && ! _.isArray( props[ prop ] ) ) { 1375 props[ prop ] = [ props[ prop ] ]; 1376 } 1377 } ); 1378 1379 // Generate the query `args` object. 1380 // Correct any differing property names. 1381 _.each( props, function( value, prop ) { 1382 if ( _.isNull( value ) ) { 1383 return; 1384 } 1385 1386 args[ Query.propmap[ prop ] || prop ] = value; 1387 }); 1388 1389 // Fill any other default query args. 1390 _.defaults( args, Query.defaultArgs ); 1391 1392 // `props.orderby` does not always map directly to `args.orderby`. 1393 // Substitute exceptions specified in orderby.keymap. 1394 args.orderby = orderby.valuemap[ props.orderby ] || props.orderby; 1395 1396 // Search the query cache for a matching query. 1397 if ( cache ) { 1398 query = _.find( queries, function( query ) { 1399 return _.isEqual( query.args, args ); 1400 }); 1401 } else { 1402 queries = []; 1403 } 1404 1405 // Otherwise, create a new query and add it to the cache. 1406 if ( ! query ) { 1407 query = new Query( [], _.extend( options || {}, { 1408 props: props, 1409 args: args 1410 } ) ); 1411 queries.push( query ); 1412 } 1413 1414 return query; 1415 }; 1416 }()) 1417 }); 1418 1419 module.exports = Query; 1420 1421 },{}],6:[function(require,module,exports){ 1510 1511 /***/ }), 1512 1513 /***/ 25: 1514 /***/ (function(module, exports) { 1515 1422 1516 var Attachments = wp.media.model.Attachments, 1423 1517 Selection; … … 1518 1612 module.exports = Selection; 1519 1613 1520 },{}]},{},[1]); 1614 1615 /***/ }) 1616 1617 /******/ });
Note: See TracChangeset
for help on using the changeset viewer.