1 /******/ (function(modules) { // webpackBootstrap |
1 /******/ (function() { // webpackBootstrap |
2 /******/ // The module cache |
2 /******/ var __webpack_modules__ = ({ |
3 /******/ var installedModules = {}; |
3 |
4 /******/ |
4 /***/ 6045: |
5 /******/ // The require function |
5 /***/ (function(module) { |
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, { enumerable: true, get: getter }); |
|
40 /******/ } |
|
41 /******/ }; |
|
42 /******/ |
|
43 /******/ // define __esModule on exports |
|
44 /******/ __webpack_require__.r = function(exports) { |
|
45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
47 /******/ } |
|
48 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
49 /******/ }; |
|
50 /******/ |
|
51 /******/ // create a fake namespace object |
|
52 /******/ // mode & 1: value is a module id, require it |
|
53 /******/ // mode & 2: merge all properties of value into the ns |
|
54 /******/ // mode & 4: return value when already ns object |
|
55 /******/ // mode & 8|1: behave like require |
|
56 /******/ __webpack_require__.t = function(value, mode) { |
|
57 /******/ if(mode & 1) value = __webpack_require__(value); |
|
58 /******/ if(mode & 8) return value; |
|
59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
60 /******/ var ns = Object.create(null); |
|
61 /******/ __webpack_require__.r(ns); |
|
62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
64 /******/ return ns; |
|
65 /******/ }; |
|
66 /******/ |
|
67 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
68 /******/ __webpack_require__.n = function(module) { |
|
69 /******/ var getter = module && module.__esModule ? |
|
70 /******/ function getDefault() { return module['default']; } : |
|
71 /******/ function getModuleExports() { return module; }; |
|
72 /******/ __webpack_require__.d(getter, 'a', getter); |
|
73 /******/ return getter; |
|
74 /******/ }; |
|
75 /******/ |
|
76 /******/ // Object.prototype.hasOwnProperty.call |
|
77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
78 /******/ |
|
79 /******/ // __webpack_public_path__ |
|
80 /******/ __webpack_require__.p = ""; |
|
81 /******/ |
|
82 /******/ |
|
83 /******/ // Load entry module and return exports |
|
84 /******/ return __webpack_require__(__webpack_require__.s = 0); |
|
85 /******/ }) |
|
86 /************************************************************************/ |
|
87 /******/ ({ |
|
88 |
|
89 /***/ "+RYg": |
|
90 /***/ (function(module, exports) { |
|
91 |
|
92 /** |
|
93 * wp.media.model.PostMedia |
|
94 * |
|
95 * Shared model class for audio and video. Updates the model after |
|
96 * "Add Audio|Video Source" and "Replace Audio|Video" states return |
|
97 * |
|
98 * @memberOf wp.media.model |
|
99 * |
|
100 * @class |
|
101 * @augments Backbone.Model |
|
102 */ |
|
103 var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{ |
|
104 initialize: function() { |
|
105 this.attachment = false; |
|
106 }, |
|
107 |
|
108 setSource: function( attachment ) { |
|
109 this.attachment = attachment; |
|
110 this.extension = attachment.get( 'filename' ).split('.').pop(); |
|
111 |
|
112 if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) { |
|
113 this.unset( 'src' ); |
|
114 } |
|
115 |
|
116 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { |
|
117 this.set( this.extension, this.attachment.get( 'url' ) ); |
|
118 } else { |
|
119 this.unset( this.extension ); |
|
120 } |
|
121 }, |
|
122 |
|
123 changeAttachment: function( attachment ) { |
|
124 this.setSource( attachment ); |
|
125 |
|
126 this.unset( 'src' ); |
|
127 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { |
|
128 this.unset( ext ); |
|
129 }, this ); |
|
130 } |
|
131 }); |
|
132 |
|
133 module.exports = PostMedia; |
|
134 |
|
135 |
|
136 /***/ }), |
|
137 |
|
138 /***/ "/4UI": |
|
139 /***/ (function(module, exports) { |
|
140 |
|
141 /* global MediaElementPlayer */ |
|
142 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay, |
|
143 $ = jQuery, |
|
144 MediaDetails; |
|
145 |
|
146 /** |
|
147 * wp.media.view.MediaDetails |
|
148 * |
|
149 * @memberOf wp.media.view |
|
150 * |
|
151 * @class |
|
152 * @augments wp.media.view.Settings.AttachmentDisplay |
|
153 * @augments wp.media.view.Settings |
|
154 * @augments wp.media.View |
|
155 * @augments wp.Backbone.View |
|
156 * @augments Backbone.View |
|
157 */ |
|
158 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{ |
|
159 initialize: function() { |
|
160 _.bindAll(this, 'success'); |
|
161 this.players = []; |
|
162 this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers ); |
|
163 this.on( 'ready', this.setPlayer ); |
|
164 this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this ); |
|
165 this.on( 'media:setting:remove', this.render ); |
|
166 this.on( 'media:setting:remove', this.setPlayer ); |
|
167 |
|
168 AttachmentDisplay.prototype.initialize.apply( this, arguments ); |
|
169 }, |
|
170 |
|
171 events: function(){ |
|
172 return _.extend( { |
|
173 'click .remove-setting' : 'removeSetting', |
|
174 'change .content-track' : 'setTracks', |
|
175 'click .remove-track' : 'setTracks', |
|
176 'click .add-media-source' : 'addSource' |
|
177 }, AttachmentDisplay.prototype.events ); |
|
178 }, |
|
179 |
|
180 prepare: function() { |
|
181 return _.defaults({ |
|
182 model: this.model.toJSON() |
|
183 }, this.options ); |
|
184 }, |
|
185 |
|
186 /** |
|
187 * Remove a setting's UI when the model unsets it |
|
188 * |
|
189 * @fires wp.media.view.MediaDetails#media:setting:remove |
|
190 * |
|
191 * @param {Event} e |
|
192 */ |
|
193 removeSetting : function(e) { |
|
194 var wrap = $( e.currentTarget ).parent(), setting; |
|
195 setting = wrap.find( 'input' ).data( 'setting' ); |
|
196 |
|
197 if ( setting ) { |
|
198 this.model.unset( setting ); |
|
199 this.trigger( 'media:setting:remove', this ); |
|
200 } |
|
201 |
|
202 wrap.remove(); |
|
203 }, |
|
204 |
|
205 /** |
|
206 * |
|
207 * @fires wp.media.view.MediaDetails#media:setting:remove |
|
208 */ |
|
209 setTracks : function() { |
|
210 var tracks = ''; |
|
211 |
|
212 _.each( this.$('.content-track'), function(track) { |
|
213 tracks += $( track ).val(); |
|
214 } ); |
|
215 |
|
216 this.model.set( 'content', tracks ); |
|
217 this.trigger( 'media:setting:remove', this ); |
|
218 }, |
|
219 |
|
220 addSource : function( e ) { |
|
221 this.controller.lastMime = $( e.currentTarget ).data( 'mime' ); |
|
222 this.controller.setState( 'add-' + this.controller.defaults.id + '-source' ); |
|
223 }, |
|
224 |
|
225 loadPlayer: function () { |
|
226 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); |
|
227 this.scriptXhr = false; |
|
228 }, |
|
229 |
|
230 setPlayer : function() { |
|
231 var src; |
|
232 |
|
233 if ( this.players.length || ! this.media || this.scriptXhr ) { |
|
234 return; |
|
235 } |
|
236 |
|
237 src = this.model.get( 'src' ); |
|
238 |
|
239 if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) { |
|
240 this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) ); |
|
241 } else { |
|
242 this.loadPlayer(); |
|
243 } |
|
244 }, |
|
245 |
|
246 /** |
|
247 * @abstract |
|
248 */ |
|
249 setMedia : function() { |
|
250 return this; |
|
251 }, |
|
252 |
|
253 success : function(mejs) { |
|
254 var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; |
|
255 |
|
256 if ( 'flash' === mejs.pluginType && autoplay ) { |
|
257 mejs.addEventListener( 'canplay', function() { |
|
258 mejs.play(); |
|
259 }, false ); |
|
260 } |
|
261 |
|
262 this.mejs = mejs; |
|
263 }, |
|
264 |
|
265 /** |
|
266 * @return {media.view.MediaDetails} Returns itself to allow chaining. |
|
267 */ |
|
268 render: function() { |
|
269 AttachmentDisplay.prototype.render.apply( this, arguments ); |
|
270 |
|
271 setTimeout( _.bind( function() { |
|
272 this.scrollToTop(); |
|
273 }, this ), 10 ); |
|
274 |
|
275 this.settings = _.defaults( { |
|
276 success : this.success |
|
277 }, wp.media.mixin.mejsSettings ); |
|
278 |
|
279 return this.setMedia(); |
|
280 }, |
|
281 |
|
282 scrollToTop: function() { |
|
283 this.$( '.embed-media-settings' ).scrollTop( 0 ); |
|
284 } |
|
285 },/** @lends wp.media.view.MediaDetails */{ |
|
286 instances : 0, |
|
287 /** |
|
288 * When multiple players in the DOM contain the same src, things get weird. |
|
289 * |
|
290 * @param {HTMLElement} elem |
|
291 * @return {HTMLElement} |
|
292 */ |
|
293 prepareSrc : function( elem ) { |
|
294 var i = MediaDetails.instances++; |
|
295 _.each( $( elem ).find( 'source' ), function( source ) { |
|
296 source.src = [ |
|
297 source.src, |
|
298 source.src.indexOf('?') > -1 ? '&' : '?', |
|
299 '_=', |
|
300 i |
|
301 ].join(''); |
|
302 } ); |
|
303 |
|
304 return elem; |
|
305 } |
|
306 }); |
|
307 |
|
308 module.exports = MediaDetails; |
|
309 |
|
310 |
|
311 /***/ }), |
|
312 |
|
313 /***/ 0: |
|
314 /***/ (function(module, exports, __webpack_require__) { |
|
315 |
|
316 module.exports = __webpack_require__("pMD9"); |
|
317 |
|
318 |
|
319 /***/ }), |
|
320 |
|
321 /***/ "6pp6": |
|
322 /***/ (function(module, exports) { |
|
323 |
6 |
324 var State = wp.media.controller.State, |
7 var State = wp.media.controller.State, |
325 l10n = wp.media.view.l10n, |
8 l10n = wp.media.view.l10n, |
326 AudioDetails; |
9 AudioDetails; |
327 |
10 |
356 module.exports = AudioDetails; |
39 module.exports = AudioDetails; |
357 |
40 |
358 |
41 |
359 /***/ }), |
42 /***/ }), |
360 |
43 |
361 /***/ "Bdio": |
44 /***/ 580: |
362 /***/ (function(module, exports) { |
45 /***/ (function(module) { |
|
46 |
|
47 /** |
|
48 * wp.media.controller.VideoDetails |
|
49 * |
|
50 * The controller for the Video Details state |
|
51 * |
|
52 * @memberOf wp.media.controller |
|
53 * |
|
54 * @class |
|
55 * @augments wp.media.controller.State |
|
56 * @augments Backbone.Model |
|
57 */ |
|
58 var State = wp.media.controller.State, |
|
59 l10n = wp.media.view.l10n, |
|
60 VideoDetails; |
|
61 |
|
62 VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{ |
|
63 defaults: { |
|
64 id: 'video-details', |
|
65 toolbar: 'video-details', |
|
66 title: l10n.videoDetailsTitle, |
|
67 content: 'video-details', |
|
68 menu: 'video-details', |
|
69 router: false, |
|
70 priority: 60 |
|
71 }, |
|
72 |
|
73 initialize: function( options ) { |
|
74 this.media = options.media; |
|
75 State.prototype.initialize.apply( this, arguments ); |
|
76 } |
|
77 }); |
|
78 |
|
79 module.exports = VideoDetails; |
|
80 |
|
81 |
|
82 /***/ }), |
|
83 |
|
84 /***/ 6615: |
|
85 /***/ (function(module) { |
|
86 |
|
87 /** |
|
88 * wp.media.model.PostMedia |
|
89 * |
|
90 * Shared model class for audio and video. Updates the model after |
|
91 * "Add Audio|Video Source" and "Replace Audio|Video" states return |
|
92 * |
|
93 * @memberOf wp.media.model |
|
94 * |
|
95 * @class |
|
96 * @augments Backbone.Model |
|
97 */ |
|
98 var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{ |
|
99 initialize: function() { |
|
100 this.attachment = false; |
|
101 }, |
|
102 |
|
103 setSource: function( attachment ) { |
|
104 this.attachment = attachment; |
|
105 this.extension = attachment.get( 'filename' ).split('.').pop(); |
|
106 |
|
107 if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) { |
|
108 this.unset( 'src' ); |
|
109 } |
|
110 |
|
111 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { |
|
112 this.set( this.extension, this.attachment.get( 'url' ) ); |
|
113 } else { |
|
114 this.unset( this.extension ); |
|
115 } |
|
116 }, |
|
117 |
|
118 changeAttachment: function( attachment ) { |
|
119 this.setSource( attachment ); |
|
120 |
|
121 this.unset( 'src' ); |
|
122 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { |
|
123 this.unset( ext ); |
|
124 }, this ); |
|
125 } |
|
126 }); |
|
127 |
|
128 module.exports = PostMedia; |
|
129 |
|
130 |
|
131 /***/ }), |
|
132 |
|
133 /***/ 1764: |
|
134 /***/ (function(module) { |
|
135 |
|
136 var MediaDetails = wp.media.view.MediaDetails, |
|
137 AudioDetails; |
|
138 |
|
139 /** |
|
140 * wp.media.view.AudioDetails |
|
141 * |
|
142 * @memberOf wp.media.view |
|
143 * |
|
144 * @class |
|
145 * @augments wp.media.view.MediaDetails |
|
146 * @augments wp.media.view.Settings.AttachmentDisplay |
|
147 * @augments wp.media.view.Settings |
|
148 * @augments wp.media.View |
|
149 * @augments wp.Backbone.View |
|
150 * @augments Backbone.View |
|
151 */ |
|
152 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{ |
|
153 className: 'audio-details', |
|
154 template: wp.template('audio-details'), |
|
155 |
|
156 setMedia: function() { |
|
157 var audio = this.$('.wp-audio-shortcode'); |
|
158 |
|
159 if ( audio.find( 'source' ).length ) { |
|
160 if ( audio.is(':hidden') ) { |
|
161 audio.show(); |
|
162 } |
|
163 this.media = MediaDetails.prepareSrc( audio.get(0) ); |
|
164 } else { |
|
165 audio.hide(); |
|
166 this.media = false; |
|
167 } |
|
168 |
|
169 return this; |
|
170 } |
|
171 }); |
|
172 |
|
173 module.exports = AudioDetails; |
|
174 |
|
175 |
|
176 /***/ }), |
|
177 |
|
178 /***/ 5262: |
|
179 /***/ (function(module) { |
363 |
180 |
364 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, |
181 var MediaDetails = wp.media.view.MediaFrame.MediaDetails, |
365 MediaLibrary = wp.media.controller.MediaLibrary, |
182 MediaLibrary = wp.media.controller.MediaLibrary, |
366 |
183 |
367 l10n = wp.media.view.l10n, |
184 l10n = wp.media.view.l10n, |
439 module.exports = AudioDetails; |
256 module.exports = AudioDetails; |
440 |
257 |
441 |
258 |
442 /***/ }), |
259 /***/ }), |
443 |
260 |
444 /***/ "LX3m": |
261 /***/ 6445: |
445 /***/ (function(module, exports) { |
262 /***/ (function(module) { |
446 |
|
447 var MediaDetails = wp.media.view.MediaDetails, |
|
448 AudioDetails; |
|
449 |
|
450 /** |
|
451 * wp.media.view.AudioDetails |
|
452 * |
|
453 * @memberOf wp.media.view |
|
454 * |
|
455 * @class |
|
456 * @augments wp.media.view.MediaDetails |
|
457 * @augments wp.media.view.Settings.AttachmentDisplay |
|
458 * @augments wp.media.view.Settings |
|
459 * @augments wp.media.View |
|
460 * @augments wp.Backbone.View |
|
461 * @augments Backbone.View |
|
462 */ |
|
463 AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{ |
|
464 className: 'audio-details', |
|
465 template: wp.template('audio-details'), |
|
466 |
|
467 setMedia: function() { |
|
468 var audio = this.$('.wp-audio-shortcode'); |
|
469 |
|
470 if ( audio.find( 'source' ).length ) { |
|
471 if ( audio.is(':hidden') ) { |
|
472 audio.show(); |
|
473 } |
|
474 this.media = MediaDetails.prepareSrc( audio.get(0) ); |
|
475 } else { |
|
476 audio.hide(); |
|
477 this.media = false; |
|
478 } |
|
479 |
|
480 return this; |
|
481 } |
|
482 }); |
|
483 |
|
484 module.exports = AudioDetails; |
|
485 |
|
486 |
|
487 /***/ }), |
|
488 |
|
489 /***/ "MT9K": |
|
490 /***/ (function(module, exports) { |
|
491 |
|
492 var MediaDetails = wp.media.view.MediaDetails, |
|
493 VideoDetails; |
|
494 |
|
495 /** |
|
496 * wp.media.view.VideoDetails |
|
497 * |
|
498 * @memberOf wp.media.view |
|
499 * |
|
500 * @class |
|
501 * @augments wp.media.view.MediaDetails |
|
502 * @augments wp.media.view.Settings.AttachmentDisplay |
|
503 * @augments wp.media.view.Settings |
|
504 * @augments wp.media.View |
|
505 * @augments wp.Backbone.View |
|
506 * @augments Backbone.View |
|
507 */ |
|
508 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{ |
|
509 className: 'video-details', |
|
510 template: wp.template('video-details'), |
|
511 |
|
512 setMedia: function() { |
|
513 var video = this.$('.wp-video-shortcode'); |
|
514 |
|
515 if ( video.find( 'source' ).length ) { |
|
516 if ( video.is(':hidden') ) { |
|
517 video.show(); |
|
518 } |
|
519 |
|
520 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { |
|
521 this.media = MediaDetails.prepareSrc( video.get(0) ); |
|
522 } else { |
|
523 this.media = video.get(0); |
|
524 } |
|
525 } else { |
|
526 video.hide(); |
|
527 this.media = false; |
|
528 } |
|
529 |
|
530 return this; |
|
531 } |
|
532 }); |
|
533 |
|
534 module.exports = VideoDetails; |
|
535 |
|
536 |
|
537 /***/ }), |
|
538 |
|
539 /***/ "RQe2": |
|
540 /***/ (function(module, exports) { |
|
541 |
263 |
542 var Select = wp.media.view.MediaFrame.Select, |
264 var Select = wp.media.view.MediaFrame.Select, |
543 l10n = wp.media.view.l10n, |
265 l10n = wp.media.view.l10n, |
544 MediaDetails; |
266 MediaDetails; |
545 |
267 |
853 module.exports = VideoDetails; |
535 module.exports = VideoDetails; |
854 |
536 |
855 |
537 |
856 /***/ }), |
538 /***/ }), |
857 |
539 |
858 /***/ "pMD9": |
540 /***/ 8867: |
859 /***/ (function(module, exports, __webpack_require__) { |
541 /***/ (function(module) { |
860 |
542 |
|
543 /* global MediaElementPlayer */ |
|
544 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay, |
|
545 $ = jQuery, |
|
546 MediaDetails; |
|
547 |
|
548 /** |
|
549 * wp.media.view.MediaDetails |
|
550 * |
|
551 * @memberOf wp.media.view |
|
552 * |
|
553 * @class |
|
554 * @augments wp.media.view.Settings.AttachmentDisplay |
|
555 * @augments wp.media.view.Settings |
|
556 * @augments wp.media.View |
|
557 * @augments wp.Backbone.View |
|
558 * @augments Backbone.View |
|
559 */ |
|
560 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{ |
|
561 initialize: function() { |
|
562 _.bindAll(this, 'success'); |
|
563 this.players = []; |
|
564 this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers ); |
|
565 this.on( 'ready', this.setPlayer ); |
|
566 this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this ); |
|
567 this.on( 'media:setting:remove', this.render ); |
|
568 this.on( 'media:setting:remove', this.setPlayer ); |
|
569 |
|
570 AttachmentDisplay.prototype.initialize.apply( this, arguments ); |
|
571 }, |
|
572 |
|
573 events: function(){ |
|
574 return _.extend( { |
|
575 'click .remove-setting' : 'removeSetting', |
|
576 'change .content-track' : 'setTracks', |
|
577 'click .remove-track' : 'setTracks', |
|
578 'click .add-media-source' : 'addSource' |
|
579 }, AttachmentDisplay.prototype.events ); |
|
580 }, |
|
581 |
|
582 prepare: function() { |
|
583 return _.defaults({ |
|
584 model: this.model.toJSON() |
|
585 }, this.options ); |
|
586 }, |
|
587 |
|
588 /** |
|
589 * Remove a setting's UI when the model unsets it |
|
590 * |
|
591 * @fires wp.media.view.MediaDetails#media:setting:remove |
|
592 * |
|
593 * @param {Event} e |
|
594 */ |
|
595 removeSetting : function(e) { |
|
596 var wrap = $( e.currentTarget ).parent(), setting; |
|
597 setting = wrap.find( 'input' ).data( 'setting' ); |
|
598 |
|
599 if ( setting ) { |
|
600 this.model.unset( setting ); |
|
601 this.trigger( 'media:setting:remove', this ); |
|
602 } |
|
603 |
|
604 wrap.remove(); |
|
605 }, |
|
606 |
|
607 /** |
|
608 * |
|
609 * @fires wp.media.view.MediaDetails#media:setting:remove |
|
610 */ |
|
611 setTracks : function() { |
|
612 var tracks = ''; |
|
613 |
|
614 _.each( this.$('.content-track'), function(track) { |
|
615 tracks += $( track ).val(); |
|
616 } ); |
|
617 |
|
618 this.model.set( 'content', tracks ); |
|
619 this.trigger( 'media:setting:remove', this ); |
|
620 }, |
|
621 |
|
622 addSource : function( e ) { |
|
623 this.controller.lastMime = $( e.currentTarget ).data( 'mime' ); |
|
624 this.controller.setState( 'add-' + this.controller.defaults.id + '-source' ); |
|
625 }, |
|
626 |
|
627 loadPlayer: function () { |
|
628 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); |
|
629 this.scriptXhr = false; |
|
630 }, |
|
631 |
|
632 setPlayer : function() { |
|
633 var src; |
|
634 |
|
635 if ( this.players.length || ! this.media || this.scriptXhr ) { |
|
636 return; |
|
637 } |
|
638 |
|
639 src = this.model.get( 'src' ); |
|
640 |
|
641 if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) { |
|
642 this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) ); |
|
643 } else { |
|
644 this.loadPlayer(); |
|
645 } |
|
646 }, |
|
647 |
|
648 /** |
|
649 * @abstract |
|
650 */ |
|
651 setMedia : function() { |
|
652 return this; |
|
653 }, |
|
654 |
|
655 success : function(mejs) { |
|
656 var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; |
|
657 |
|
658 if ( 'flash' === mejs.pluginType && autoplay ) { |
|
659 mejs.addEventListener( 'canplay', function() { |
|
660 mejs.play(); |
|
661 }, false ); |
|
662 } |
|
663 |
|
664 this.mejs = mejs; |
|
665 }, |
|
666 |
|
667 /** |
|
668 * @return {media.view.MediaDetails} Returns itself to allow chaining. |
|
669 */ |
|
670 render: function() { |
|
671 AttachmentDisplay.prototype.render.apply( this, arguments ); |
|
672 |
|
673 setTimeout( _.bind( function() { |
|
674 this.scrollToTop(); |
|
675 }, this ), 10 ); |
|
676 |
|
677 this.settings = _.defaults( { |
|
678 success : this.success |
|
679 }, wp.media.mixin.mejsSettings ); |
|
680 |
|
681 return this.setMedia(); |
|
682 }, |
|
683 |
|
684 scrollToTop: function() { |
|
685 this.$( '.embed-media-settings' ).scrollTop( 0 ); |
|
686 } |
|
687 },/** @lends wp.media.view.MediaDetails */{ |
|
688 instances : 0, |
|
689 /** |
|
690 * When multiple players in the DOM contain the same src, things get weird. |
|
691 * |
|
692 * @param {HTMLElement} elem |
|
693 * @return {HTMLElement} |
|
694 */ |
|
695 prepareSrc : function( elem ) { |
|
696 var i = MediaDetails.instances++; |
|
697 _.each( $( elem ).find( 'source' ), function( source ) { |
|
698 source.src = [ |
|
699 source.src, |
|
700 source.src.indexOf('?') > -1 ? '&' : '?', |
|
701 '_=', |
|
702 i |
|
703 ].join(''); |
|
704 } ); |
|
705 |
|
706 return elem; |
|
707 } |
|
708 }); |
|
709 |
|
710 module.exports = MediaDetails; |
|
711 |
|
712 |
|
713 /***/ }), |
|
714 |
|
715 /***/ 7697: |
|
716 /***/ (function(module) { |
|
717 |
|
718 var MediaDetails = wp.media.view.MediaDetails, |
|
719 VideoDetails; |
|
720 |
|
721 /** |
|
722 * wp.media.view.VideoDetails |
|
723 * |
|
724 * @memberOf wp.media.view |
|
725 * |
|
726 * @class |
|
727 * @augments wp.media.view.MediaDetails |
|
728 * @augments wp.media.view.Settings.AttachmentDisplay |
|
729 * @augments wp.media.view.Settings |
|
730 * @augments wp.media.View |
|
731 * @augments wp.Backbone.View |
|
732 * @augments Backbone.View |
|
733 */ |
|
734 VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{ |
|
735 className: 'video-details', |
|
736 template: wp.template('video-details'), |
|
737 |
|
738 setMedia: function() { |
|
739 var video = this.$('.wp-video-shortcode'); |
|
740 |
|
741 if ( video.find( 'source' ).length ) { |
|
742 if ( video.is(':hidden') ) { |
|
743 video.show(); |
|
744 } |
|
745 |
|
746 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { |
|
747 this.media = MediaDetails.prepareSrc( video.get(0) ); |
|
748 } else { |
|
749 this.media = video.get(0); |
|
750 } |
|
751 } else { |
|
752 video.hide(); |
|
753 this.media = false; |
|
754 } |
|
755 |
|
756 return this; |
|
757 } |
|
758 }); |
|
759 |
|
760 module.exports = VideoDetails; |
|
761 |
|
762 |
|
763 /***/ }) |
|
764 |
|
765 /******/ }); |
|
766 /************************************************************************/ |
|
767 /******/ // The module cache |
|
768 /******/ var __webpack_module_cache__ = {}; |
|
769 /******/ |
|
770 /******/ // The require function |
|
771 /******/ function __webpack_require__(moduleId) { |
|
772 /******/ // Check if module is in cache |
|
773 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
|
774 /******/ if (cachedModule !== undefined) { |
|
775 /******/ return cachedModule.exports; |
|
776 /******/ } |
|
777 /******/ // Create a new module (and put it into the cache) |
|
778 /******/ var module = __webpack_module_cache__[moduleId] = { |
|
779 /******/ // no module.id needed |
|
780 /******/ // no module.loaded needed |
|
781 /******/ exports: {} |
|
782 /******/ }; |
|
783 /******/ |
|
784 /******/ // Execute the module function |
|
785 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
|
786 /******/ |
|
787 /******/ // Return the exports of the module |
|
788 /******/ return module.exports; |
|
789 /******/ } |
|
790 /******/ |
|
791 /************************************************************************/ |
|
792 var __webpack_exports__ = {}; |
|
793 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. |
|
794 !function() { |
861 /** |
795 /** |
862 * @output wp-includes/js/media-audiovideo.js |
796 * @output wp-includes/js/media-audiovideo.js |
863 */ |
797 */ |
864 |
798 |
865 var media = wp.media, |
799 var media = wp.media, |