author | ymh <ymh.work@gmail.com> |
Tue, 15 Dec 2020 13:49:49 +0100 | |
changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
permissions | -rw-r--r-- |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1 |
/******/ (function(modules) { // webpackBootstrap |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2 |
/******/ // The module cache |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3 |
/******/ var installedModules = {}; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
4 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
5 |
/******/ // The require function |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
6 |
/******/ function __webpack_require__(moduleId) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
7 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
8 |
/******/ // Check if module is in cache |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
9 |
/******/ if(installedModules[moduleId]) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
10 |
/******/ return installedModules[moduleId].exports; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
11 |
/******/ } |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
/******/ // Create a new module (and put it into the cache) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
/******/ var module = installedModules[moduleId] = { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
/******/ i: moduleId, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
/******/ l: false, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
/******/ exports: {} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
/******/ }; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
/******/ // Execute the module function |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
/******/ // Flag the module as loaded |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
/******/ module.l = true; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
/******/ // Return the exports of the module |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
/******/ return module.exports; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
27 |
/******/ } |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
28 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
30 |
/******/ // expose the modules object (__webpack_modules__) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
31 |
/******/ __webpack_require__.m = modules; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
/******/ // expose the module cache |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
/******/ __webpack_require__.c = installedModules; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
35 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
36 |
/******/ // define getter function for harmony exports |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
37 |
/******/ __webpack_require__.d = function(exports, name, getter) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
38 |
/******/ if(!__webpack_require__.o(exports, name)) { |
9 | 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' }); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
/******/ } |
9 | 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; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
65 |
/******/ }; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
67 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
68 |
/******/ __webpack_require__.n = function(module) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
69 |
/******/ var getter = module && module.__esModule ? |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
/******/ function getDefault() { return module['default']; } : |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
/******/ function getModuleExports() { return module; }; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
/******/ __webpack_require__.d(getter, 'a', getter); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
/******/ return getter; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
/******/ }; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
75 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
/******/ // Object.prototype.hasOwnProperty.call |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
77 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
/******/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
79 |
/******/ // __webpack_public_path__ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
/******/ __webpack_require__.p = ""; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
81 |
/******/ |
9 | 82 |
/******/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
83 |
/******/ // Load entry module and return exports |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
/******/ return __webpack_require__(__webpack_require__.s = 0); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
/******/ }) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
/************************************************************************/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
/******/ ([ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
/* 0 */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
/***/ (function(module, exports, __webpack_require__) { |
5 | 90 |
|
9 | 91 |
module.exports = __webpack_require__(1); |
92 |
||
93 |
||
94 |
/***/ }), |
|
95 |
/* 1 */ |
|
96 |
/***/ (function(module, exports, __webpack_require__) { |
|
97 |
||
98 |
/** |
|
99 |
* @output wp-includes/js/media-audiovideo.js |
|
100 |
*/ |
|
101 |
||
5 | 102 |
var media = wp.media, |
103 |
baseSettings = window._wpmejsSettings || {}, |
|
104 |
l10n = window._wpMediaViewsL10n || {}; |
|
105 |
||
106 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
* |
9 | 108 |
* Defines the wp.media.mixin object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
109 |
* |
5 | 110 |
* @mixin |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
111 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
112 |
* @since 4.2.0 |
5 | 113 |
*/ |
114 |
wp.media.mixin = { |
|
115 |
mejsSettings: baseSettings, |
|
116 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
117 |
/** |
9 | 118 |
* Pauses and removes all players. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
119 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
120 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
* @return {void} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
123 |
*/ |
5 | 124 |
removeAllPlayers: function() { |
125 |
var p; |
|
126 |
||
127 |
if ( window.mejs && window.mejs.players ) { |
|
128 |
for ( p in window.mejs.players ) { |
|
129 |
window.mejs.players[p].pause(); |
|
130 |
this.removePlayer( window.mejs.players[p] ); |
|
131 |
} |
|
132 |
} |
|
133 |
}, |
|
134 |
||
135 |
/** |
|
9 | 136 |
* Removes the player. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
* |
5 | 138 |
* Override the MediaElement method for removing a player. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
139 |
* MediaElement tries to pull the audio/video tag out of |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
140 |
* its container and re-add it to the DOM. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
* @return {void} |
5 | 145 |
*/ |
146 |
removePlayer: function(t) { |
|
147 |
var featureIndex, feature; |
|
148 |
||
149 |
if ( ! t.options ) { |
|
150 |
return; |
|
151 |
} |
|
152 |
||
16 | 153 |
// Invoke features cleanup. |
5 | 154 |
for ( featureIndex in t.options.features ) { |
155 |
feature = t.options.features[featureIndex]; |
|
156 |
if ( t['clean' + feature] ) { |
|
157 |
try { |
|
158 |
t['clean' + feature](t); |
|
159 |
} catch (e) {} |
|
160 |
} |
|
161 |
} |
|
162 |
||
163 |
if ( ! t.isDynamic ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
t.node.remove(); |
5 | 165 |
} |
166 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
167 |
if ( 'html5' !== t.media.rendererName ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
t.media.remove(); |
5 | 169 |
} |
170 |
||
171 |
delete window.mejs.players[t.id]; |
|
172 |
||
173 |
t.container.remove(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
t.globalUnbind('resize', t.globalResizeCallback); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
t.globalUnbind('keydown', t.globalKeydownCallback); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
t.globalUnbind('click', t.globalClickCallback); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
delete t.media.player; |
5 | 178 |
}, |
179 |
||
180 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
181 |
* |
9 | 182 |
* Removes and resets all players. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
* |
5 | 184 |
* Allows any class that has set 'player' to a MediaElementPlayer |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
* instance to remove the player when listening to events. |
5 | 186 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
* Examples: modal closes, shortcode properties are removed, etc. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
* @since 4.2.0 |
5 | 190 |
*/ |
191 |
unsetPlayers : function() { |
|
192 |
if ( this.players && this.players.length ) { |
|
193 |
_.each( this.players, function (player) { |
|
194 |
player.pause(); |
|
195 |
wp.media.mixin.removePlayer( player ); |
|
196 |
} ); |
|
197 |
this.players = []; |
|
198 |
} |
|
199 |
} |
|
200 |
}; |
|
201 |
||
202 |
/** |
|
9 | 203 |
* Shortcode modeling for playlists. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
* @since 4.2.0 |
5 | 206 |
*/ |
207 |
wp.media.playlist = new wp.media.collection({ |
|
208 |
tag: 'playlist', |
|
209 |
editTitle : l10n.editPlaylistTitle, |
|
210 |
defaults : { |
|
211 |
id: wp.media.view.settings.post.id, |
|
212 |
style: 'light', |
|
213 |
tracklist: true, |
|
214 |
tracknumbers: true, |
|
215 |
images: true, |
|
216 |
artists: true, |
|
217 |
type: 'audio' |
|
218 |
} |
|
219 |
}); |
|
220 |
||
221 |
/** |
|
9 | 222 |
* Shortcode modeling for audio. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
223 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
* `edit()` prepares the shortcode for the media modal. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
225 |
* `shortcode()` builds the new shortcode after an update. |
5 | 226 |
* |
227 |
* @namespace |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
229 |
* @since 4.2.0 |
5 | 230 |
*/ |
231 |
wp.media.audio = { |
|
232 |
coerce : wp.media.coerce, |
|
233 |
||
234 |
defaults : { |
|
235 |
id : wp.media.view.settings.post.id, |
|
236 |
src : '', |
|
237 |
loop : false, |
|
238 |
autoplay : false, |
|
239 |
preload : 'none', |
|
240 |
width : 400 |
|
241 |
}, |
|
242 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
/** |
9 | 244 |
* Instantiates a new media object with the next matching shortcode. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
245 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
246 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
247 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
248 |
* @param {string} data The text to apply the shortcode on. |
16 | 249 |
* @return {wp.media} The media object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
250 |
*/ |
5 | 251 |
edit : function( data ) { |
252 |
var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; |
|
253 |
||
254 |
frame = wp.media({ |
|
255 |
frame: 'audio', |
|
256 |
state: 'audio-details', |
|
257 |
metadata: _.defaults( shortcode.attrs.named, this.defaults ) |
|
258 |
}); |
|
259 |
||
260 |
return frame; |
|
261 |
}, |
|
262 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
263 |
/** |
9 | 264 |
* Generates an audio shortcode. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
265 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
266 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
267 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
268 |
* @param {Array} model Array with attributes for the shortcode. |
16 | 269 |
* @return {wp.shortcode} The audio shortcode object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
270 |
*/ |
5 | 271 |
shortcode : function( model ) { |
272 |
var content; |
|
273 |
||
274 |
_.each( this.defaults, function( value, key ) { |
|
275 |
model[ key ] = this.coerce( model, key ); |
|
276 |
||
277 |
if ( value === model[ key ] ) { |
|
278 |
delete model[ key ]; |
|
279 |
} |
|
280 |
}, this ); |
|
281 |
||
282 |
content = model.content; |
|
283 |
delete model.content; |
|
284 |
||
285 |
return new wp.shortcode({ |
|
286 |
tag: 'audio', |
|
287 |
attrs: model, |
|
288 |
content: content |
|
289 |
}); |
|
290 |
} |
|
291 |
}; |
|
292 |
||
293 |
/** |
|
9 | 294 |
* Shortcode modeling for video. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
295 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
296 |
* `edit()` prepares the shortcode for the media modal. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
297 |
* `shortcode()` builds the new shortcode after update. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
298 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
299 |
* @since 4.2.0 |
5 | 300 |
* |
301 |
* @namespace |
|
302 |
*/ |
|
303 |
wp.media.video = { |
|
304 |
coerce : wp.media.coerce, |
|
305 |
||
306 |
defaults : { |
|
307 |
id : wp.media.view.settings.post.id, |
|
308 |
src : '', |
|
309 |
poster : '', |
|
310 |
loop : false, |
|
311 |
autoplay : false, |
|
312 |
preload : 'metadata', |
|
313 |
content : '', |
|
314 |
width : 640, |
|
315 |
height : 360 |
|
316 |
}, |
|
317 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
/** |
9 | 319 |
* Instantiates a new media object with the next matching shortcode. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
322 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
323 |
* @param {string} data The text to apply the shortcode on. |
16 | 324 |
* @return {wp.media} The media object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
325 |
*/ |
5 | 326 |
edit : function( data ) { |
327 |
var frame, |
|
328 |
shortcode = wp.shortcode.next( 'video', data ).shortcode, |
|
329 |
attrs; |
|
330 |
||
331 |
attrs = shortcode.attrs.named; |
|
332 |
attrs.content = shortcode.content; |
|
333 |
||
334 |
frame = wp.media({ |
|
335 |
frame: 'video', |
|
336 |
state: 'video-details', |
|
337 |
metadata: _.defaults( attrs, this.defaults ) |
|
338 |
}); |
|
339 |
||
340 |
return frame; |
|
341 |
}, |
|
342 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
/** |
9 | 344 |
* Generates an video shortcode. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
345 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
346 |
* @since 4.2.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
347 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
348 |
* @param {Array} model Array with attributes for the shortcode. |
16 | 349 |
* @return {wp.shortcode} The video shortcode object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
*/ |
5 | 351 |
shortcode : function( model ) { |
352 |
var content; |
|
353 |
||
354 |
_.each( this.defaults, function( value, key ) { |
|
355 |
model[ key ] = this.coerce( model, key ); |
|
356 |
||
357 |
if ( value === model[ key ] ) { |
|
358 |
delete model[ key ]; |
|
359 |
} |
|
360 |
}, this ); |
|
361 |
||
362 |
content = model.content; |
|
363 |
delete model.content; |
|
364 |
||
365 |
return new wp.shortcode({ |
|
366 |
tag: 'video', |
|
367 |
attrs: model, |
|
368 |
content: content |
|
369 |
}); |
|
370 |
} |
|
371 |
}; |
|
372 |
||
9 | 373 |
media.model.PostMedia = __webpack_require__( 2 ); |
374 |
media.controller.AudioDetails = __webpack_require__( 3 ); |
|
375 |
media.controller.VideoDetails = __webpack_require__( 4 ); |
|
376 |
media.view.MediaFrame.MediaDetails = __webpack_require__( 5 ); |
|
377 |
media.view.MediaFrame.AudioDetails = __webpack_require__( 6 ); |
|
378 |
media.view.MediaFrame.VideoDetails = __webpack_require__( 7 ); |
|
379 |
media.view.MediaDetails = __webpack_require__( 8 ); |
|
380 |
media.view.AudioDetails = __webpack_require__( 9 ); |
|
381 |
media.view.VideoDetails = __webpack_require__( 10 ); |
|
5 | 382 |
|
383 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
384 |
/***/ }), |
9 | 385 |
/* 2 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
386 |
/***/ (function(module, exports) { |
5 | 387 |
|
388 |
/** |
|
389 |
* wp.media.model.PostMedia |
|
390 |
* |
|
391 |
* Shared model class for audio and video. Updates the model after |
|
392 |
* "Add Audio|Video Source" and "Replace Audio|Video" states return |
|
393 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
394 |
* @memberOf wp.media.model |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
395 |
* |
5 | 396 |
* @class |
397 |
* @augments Backbone.Model |
|
398 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
399 |
var PostMedia = Backbone.Model.extend(/** @lends wp.media.model.PostMedia.prototype */{ |
5 | 400 |
initialize: function() { |
401 |
this.attachment = false; |
|
402 |
}, |
|
403 |
||
404 |
setSource: function( attachment ) { |
|
405 |
this.attachment = attachment; |
|
406 |
this.extension = attachment.get( 'filename' ).split('.').pop(); |
|
407 |
||
408 |
if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) { |
|
409 |
this.unset( 'src' ); |
|
410 |
} |
|
411 |
||
412 |
if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { |
|
413 |
this.set( this.extension, this.attachment.get( 'url' ) ); |
|
414 |
} else { |
|
415 |
this.unset( this.extension ); |
|
416 |
} |
|
417 |
}, |
|
418 |
||
419 |
changeAttachment: function( attachment ) { |
|
420 |
this.setSource( attachment ); |
|
421 |
||
422 |
this.unset( 'src' ); |
|
423 |
_.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { |
|
424 |
this.unset( ext ); |
|
425 |
}, this ); |
|
426 |
} |
|
427 |
}); |
|
428 |
||
429 |
module.exports = PostMedia; |
|
430 |
||
431 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
432 |
/***/ }), |
9 | 433 |
/* 3 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
434 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
435 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
436 |
var State = wp.media.controller.State, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
437 |
l10n = wp.media.view.l10n, |
5 | 438 |
AudioDetails; |
439 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
440 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
441 |
* wp.media.controller.AudioDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
442 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
443 |
* The controller for the Audio Details state |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
444 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
445 |
* @memberOf wp.media.controller |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
446 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
447 |
* @class |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
448 |
* @augments wp.media.controller.State |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
449 |
* @augments Backbone.Model |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
450 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
451 |
AudioDetails = State.extend(/** @lends wp.media.controller.AudioDetails.prototype */{ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
452 |
defaults: { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
453 |
id: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
454 |
toolbar: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
455 |
title: l10n.audioDetailsTitle, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
456 |
content: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
457 |
menu: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
router: false, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
459 |
priority: 60 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
460 |
}, |
5 | 461 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
initialize: function( options ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
463 |
this.media = options.media; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
464 |
State.prototype.initialize.apply( this, arguments ); |
5 | 465 |
} |
466 |
}); |
|
467 |
||
468 |
module.exports = AudioDetails; |
|
469 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
470 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
471 |
/***/ }), |
9 | 472 |
/* 4 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
473 |
/***/ (function(module, exports) { |
5 | 474 |
|
475 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
476 |
* wp.media.controller.VideoDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
477 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
478 |
* The controller for the Video Details state |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
479 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
480 |
* @memberOf wp.media.controller |
5 | 481 |
* |
482 |
* @class |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
* @augments wp.media.controller.State |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
* @augments Backbone.Model |
5 | 485 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
486 |
var State = wp.media.controller.State, |
5 | 487 |
l10n = wp.media.view.l10n, |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
488 |
VideoDetails; |
5 | 489 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
490 |
VideoDetails = State.extend(/** @lends wp.media.controller.VideoDetails.prototype */{ |
5 | 491 |
defaults: { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
492 |
id: 'video-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
493 |
toolbar: 'video-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
494 |
title: l10n.videoDetailsTitle, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
495 |
content: 'video-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
496 |
menu: 'video-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
497 |
router: false, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
498 |
priority: 60 |
5 | 499 |
}, |
500 |
||
501 |
initialize: function( options ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
502 |
this.media = options.media; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
503 |
State.prototype.initialize.apply( this, arguments ); |
5 | 504 |
} |
505 |
}); |
|
506 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
507 |
module.exports = VideoDetails; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
508 |
|
5 | 509 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
510 |
/***/ }), |
9 | 511 |
/* 5 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
512 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
513 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
514 |
var Select = wp.media.view.MediaFrame.Select, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
515 |
l10n = wp.media.view.l10n, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
516 |
MediaDetails; |
5 | 517 |
|
518 |
/** |
|
519 |
* wp.media.view.MediaFrame.MediaDetails |
|
520 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
521 |
* @memberOf wp.media.view.MediaFrame |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
522 |
* |
5 | 523 |
* @class |
524 |
* @augments wp.media.view.MediaFrame.Select |
|
525 |
* @augments wp.media.view.MediaFrame |
|
526 |
* @augments wp.media.view.Frame |
|
527 |
* @augments wp.media.View |
|
528 |
* @augments wp.Backbone.View |
|
529 |
* @augments Backbone.View |
|
530 |
* @mixes wp.media.controller.StateMachine |
|
531 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
532 |
MediaDetails = Select.extend(/** @lends wp.media.view.MediaFrame.MediaDetails.prototype */{ |
5 | 533 |
defaults: { |
534 |
id: 'media', |
|
535 |
url: '', |
|
536 |
menu: 'media-details', |
|
537 |
content: 'media-details', |
|
538 |
toolbar: 'media-details', |
|
539 |
type: 'link', |
|
540 |
priority: 120 |
|
541 |
}, |
|
542 |
||
543 |
initialize: function( options ) { |
|
544 |
this.DetailsView = options.DetailsView; |
|
545 |
this.cancelText = options.cancelText; |
|
546 |
this.addText = options.addText; |
|
547 |
||
548 |
this.media = new wp.media.model.PostMedia( options.metadata ); |
|
549 |
this.options.selection = new wp.media.model.Selection( this.media.attachment, { multiple: false } ); |
|
550 |
Select.prototype.initialize.apply( this, arguments ); |
|
551 |
}, |
|
552 |
||
553 |
bindHandlers: function() { |
|
554 |
var menu = this.defaults.menu; |
|
555 |
||
556 |
Select.prototype.bindHandlers.apply( this, arguments ); |
|
557 |
||
558 |
this.on( 'menu:create:' + menu, this.createMenu, this ); |
|
559 |
this.on( 'content:render:' + menu, this.renderDetailsContent, this ); |
|
560 |
this.on( 'menu:render:' + menu, this.renderMenu, this ); |
|
561 |
this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this ); |
|
562 |
}, |
|
563 |
||
564 |
renderDetailsContent: function() { |
|
565 |
var view = new this.DetailsView({ |
|
566 |
controller: this, |
|
567 |
model: this.state().media, |
|
568 |
attachment: this.state().media.attachment |
|
569 |
}).render(); |
|
570 |
||
571 |
this.content.set( view ); |
|
572 |
}, |
|
573 |
||
574 |
renderMenu: function( view ) { |
|
575 |
var lastState = this.lastState(), |
|
576 |
previous = lastState && lastState.id, |
|
577 |
frame = this; |
|
578 |
||
579 |
view.set({ |
|
580 |
cancel: { |
|
581 |
text: this.cancelText, |
|
582 |
priority: 20, |
|
583 |
click: function() { |
|
584 |
if ( previous ) { |
|
585 |
frame.setState( previous ); |
|
586 |
} else { |
|
587 |
frame.close(); |
|
588 |
} |
|
589 |
} |
|
590 |
}, |
|
591 |
separateCancel: new wp.media.View({ |
|
592 |
className: 'separator', |
|
593 |
priority: 40 |
|
594 |
}) |
|
595 |
}); |
|
596 |
||
597 |
}, |
|
598 |
||
599 |
setPrimaryButton: function(text, handler) { |
|
600 |
this.toolbar.set( new wp.media.view.Toolbar({ |
|
601 |
controller: this, |
|
602 |
items: { |
|
603 |
button: { |
|
604 |
style: 'primary', |
|
605 |
text: text, |
|
606 |
priority: 80, |
|
607 |
click: function() { |
|
608 |
var controller = this.controller; |
|
609 |
handler.call( this, controller, controller.state() ); |
|
610 |
// Restore and reset the default state. |
|
611 |
controller.setState( controller.options.state ); |
|
612 |
controller.reset(); |
|
613 |
} |
|
614 |
} |
|
615 |
} |
|
616 |
}) ); |
|
617 |
}, |
|
618 |
||
619 |
renderDetailsToolbar: function() { |
|
620 |
this.setPrimaryButton( l10n.update, function( controller, state ) { |
|
621 |
controller.close(); |
|
622 |
state.trigger( 'update', controller.media.toJSON() ); |
|
623 |
} ); |
|
624 |
}, |
|
625 |
||
626 |
renderReplaceToolbar: function() { |
|
627 |
this.setPrimaryButton( l10n.replace, function( controller, state ) { |
|
628 |
var attachment = state.get( 'selection' ).single(); |
|
629 |
controller.media.changeAttachment( attachment ); |
|
630 |
state.trigger( 'replace', controller.media.toJSON() ); |
|
631 |
} ); |
|
632 |
}, |
|
633 |
||
634 |
renderAddSourceToolbar: function() { |
|
635 |
this.setPrimaryButton( this.addText, function( controller, state ) { |
|
636 |
var attachment = state.get( 'selection' ).single(); |
|
637 |
controller.media.setSource( attachment ); |
|
638 |
state.trigger( 'add-source', controller.media.toJSON() ); |
|
639 |
} ); |
|
640 |
} |
|
641 |
}); |
|
642 |
||
643 |
module.exports = MediaDetails; |
|
644 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
645 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
646 |
/***/ }), |
9 | 647 |
/* 6 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
648 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
649 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
650 |
var MediaDetails = wp.media.view.MediaFrame.MediaDetails, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
651 |
MediaLibrary = wp.media.controller.MediaLibrary, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
652 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
653 |
l10n = wp.media.view.l10n, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
654 |
AudioDetails; |
5 | 655 |
|
656 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
657 |
* wp.media.view.MediaFrame.AudioDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
658 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
659 |
* @memberOf wp.media.view.MediaFrame |
5 | 660 |
* |
661 |
* @class |
|
662 |
* @augments wp.media.view.MediaFrame.MediaDetails |
|
663 |
* @augments wp.media.view.MediaFrame.Select |
|
664 |
* @augments wp.media.view.MediaFrame |
|
665 |
* @augments wp.media.view.Frame |
|
666 |
* @augments wp.media.View |
|
667 |
* @augments wp.Backbone.View |
|
668 |
* @augments Backbone.View |
|
669 |
* @mixes wp.media.controller.StateMachine |
|
670 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
671 |
AudioDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.AudioDetails.prototype */{ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
672 |
defaults: { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
673 |
id: 'audio', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
674 |
url: '', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
675 |
menu: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
676 |
content: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
677 |
toolbar: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
678 |
type: 'link', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
679 |
title: l10n.audioDetailsTitle, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
680 |
priority: 120 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
681 |
}, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
682 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
683 |
initialize: function( options ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
684 |
options.DetailsView = wp.media.view.AudioDetails; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
685 |
options.cancelText = l10n.audioDetailsCancel; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
686 |
options.addText = l10n.audioAddSourceTitle; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
687 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
688 |
MediaDetails.prototype.initialize.call( this, options ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
689 |
}, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
690 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
691 |
bindHandlers: function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
692 |
MediaDetails.prototype.bindHandlers.apply( this, arguments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
693 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
694 |
this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
695 |
this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
696 |
}, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
697 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
698 |
createStates: function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
699 |
this.states.add([ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
700 |
new wp.media.controller.AudioDetails( { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
701 |
media: this.media |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
702 |
} ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
703 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
704 |
new MediaLibrary( { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
705 |
type: 'audio', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
706 |
id: 'replace-audio', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
707 |
title: l10n.audioReplaceTitle, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
708 |
toolbar: 'replace-audio', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
709 |
media: this.media, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
710 |
menu: 'audio-details' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
711 |
} ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
712 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
713 |
new MediaLibrary( { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
714 |
type: 'audio', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
715 |
id: 'add-audio-source', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
716 |
title: l10n.audioAddSourceTitle, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
717 |
toolbar: 'add-audio-source', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
718 |
media: this.media, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
719 |
menu: false |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
720 |
} ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
721 |
]); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
722 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
723 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
724 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
725 |
module.exports = AudioDetails; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
726 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
727 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
728 |
/***/ }), |
9 | 729 |
/* 7 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
730 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
731 |
|
5 | 732 |
var MediaDetails = wp.media.view.MediaFrame.MediaDetails, |
733 |
MediaLibrary = wp.media.controller.MediaLibrary, |
|
734 |
l10n = wp.media.view.l10n, |
|
735 |
VideoDetails; |
|
736 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
* wp.media.view.MediaFrame.VideoDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
739 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
* @memberOf wp.media.view.MediaFrame |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
741 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
742 |
* @class |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
743 |
* @augments wp.media.view.MediaFrame.MediaDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
744 |
* @augments wp.media.view.MediaFrame.Select |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
745 |
* @augments wp.media.view.MediaFrame |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
746 |
* @augments wp.media.view.Frame |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
747 |
* @augments wp.media.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
748 |
* @augments wp.Backbone.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
749 |
* @augments Backbone.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
750 |
* @mixes wp.media.controller.StateMachine |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
751 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
752 |
VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDetails.prototype */{ |
5 | 753 |
defaults: { |
754 |
id: 'video', |
|
755 |
url: '', |
|
756 |
menu: 'video-details', |
|
757 |
content: 'video-details', |
|
758 |
toolbar: 'video-details', |
|
759 |
type: 'link', |
|
760 |
title: l10n.videoDetailsTitle, |
|
761 |
priority: 120 |
|
762 |
}, |
|
763 |
||
764 |
initialize: function( options ) { |
|
765 |
options.DetailsView = wp.media.view.VideoDetails; |
|
766 |
options.cancelText = l10n.videoDetailsCancel; |
|
767 |
options.addText = l10n.videoAddSourceTitle; |
|
768 |
||
769 |
MediaDetails.prototype.initialize.call( this, options ); |
|
770 |
}, |
|
771 |
||
772 |
bindHandlers: function() { |
|
773 |
MediaDetails.prototype.bindHandlers.apply( this, arguments ); |
|
774 |
||
775 |
this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this ); |
|
776 |
this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this ); |
|
777 |
this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this ); |
|
778 |
this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this ); |
|
779 |
}, |
|
780 |
||
781 |
createStates: function() { |
|
782 |
this.states.add([ |
|
783 |
new wp.media.controller.VideoDetails({ |
|
784 |
media: this.media |
|
785 |
}), |
|
786 |
||
787 |
new MediaLibrary( { |
|
788 |
type: 'video', |
|
789 |
id: 'replace-video', |
|
790 |
title: l10n.videoReplaceTitle, |
|
791 |
toolbar: 'replace-video', |
|
792 |
media: this.media, |
|
793 |
menu: 'video-details' |
|
794 |
} ), |
|
795 |
||
796 |
new MediaLibrary( { |
|
797 |
type: 'video', |
|
798 |
id: 'add-video-source', |
|
799 |
title: l10n.videoAddSourceTitle, |
|
800 |
toolbar: 'add-video-source', |
|
801 |
media: this.media, |
|
802 |
menu: false |
|
803 |
} ), |
|
804 |
||
805 |
new MediaLibrary( { |
|
806 |
type: 'image', |
|
807 |
id: 'select-poster-image', |
|
808 |
title: l10n.videoSelectPosterImageTitle, |
|
809 |
toolbar: 'select-poster-image', |
|
810 |
media: this.media, |
|
811 |
menu: 'video-details' |
|
812 |
} ), |
|
813 |
||
814 |
new MediaLibrary( { |
|
815 |
type: 'text', |
|
816 |
id: 'add-track', |
|
817 |
title: l10n.videoAddTrackTitle, |
|
818 |
toolbar: 'add-track', |
|
819 |
media: this.media, |
|
820 |
menu: 'video-details' |
|
821 |
} ) |
|
822 |
]); |
|
823 |
}, |
|
824 |
||
825 |
renderSelectPosterImageToolbar: function() { |
|
826 |
this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) { |
|
827 |
var urls = [], attachment = state.get( 'selection' ).single(); |
|
828 |
||
829 |
controller.media.set( 'poster', attachment.get( 'url' ) ); |
|
830 |
state.trigger( 'set-poster-image', controller.media.toJSON() ); |
|
831 |
||
832 |
_.each( wp.media.view.settings.embedExts, function (ext) { |
|
833 |
if ( controller.media.get( ext ) ) { |
|
834 |
urls.push( controller.media.get( ext ) ); |
|
835 |
} |
|
836 |
} ); |
|
837 |
||
838 |
wp.ajax.send( 'set-attachment-thumbnail', { |
|
839 |
data : { |
|
840 |
urls: urls, |
|
841 |
thumbnail_id: attachment.get( 'id' ) |
|
842 |
} |
|
843 |
} ); |
|
844 |
} ); |
|
845 |
}, |
|
846 |
||
847 |
renderAddTrackToolbar: function() { |
|
848 |
this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) { |
|
849 |
var attachment = state.get( 'selection' ).single(), |
|
850 |
content = controller.media.get( 'content' ); |
|
851 |
||
852 |
if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) { |
|
853 |
content += [ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
854 |
'<track srclang="en" label="English" kind="subtitles" src="', |
5 | 855 |
attachment.get( 'url' ), |
856 |
'" />' |
|
857 |
].join(''); |
|
858 |
||
859 |
controller.media.set( 'content', content ); |
|
860 |
} |
|
861 |
state.trigger( 'add-track', controller.media.toJSON() ); |
|
862 |
} ); |
|
863 |
} |
|
864 |
}); |
|
865 |
||
866 |
module.exports = VideoDetails; |
|
867 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
868 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
869 |
/***/ }), |
9 | 870 |
/* 8 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
871 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
872 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
873 |
/* global MediaElementPlayer */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
874 |
var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
875 |
$ = jQuery, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
876 |
MediaDetails; |
5 | 877 |
|
878 |
/** |
|
879 |
* wp.media.view.MediaDetails |
|
880 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
881 |
* @memberOf wp.media.view |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
882 |
* |
5 | 883 |
* @class |
884 |
* @augments wp.media.view.Settings.AttachmentDisplay |
|
885 |
* @augments wp.media.view.Settings |
|
886 |
* @augments wp.media.View |
|
887 |
* @augments wp.Backbone.View |
|
888 |
* @augments Backbone.View |
|
889 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
890 |
MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{ |
5 | 891 |
initialize: function() { |
892 |
_.bindAll(this, 'success'); |
|
893 |
this.players = []; |
|
16 | 894 |
this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers ); |
5 | 895 |
this.on( 'ready', this.setPlayer ); |
896 |
this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this ); |
|
897 |
this.on( 'media:setting:remove', this.render ); |
|
898 |
this.on( 'media:setting:remove', this.setPlayer ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
899 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
900 |
AttachmentDisplay.prototype.initialize.apply( this, arguments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
901 |
}, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
902 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
903 |
events: function(){ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
904 |
return _.extend( { |
5 | 905 |
'click .remove-setting' : 'removeSetting', |
906 |
'change .content-track' : 'setTracks', |
|
907 |
'click .remove-track' : 'setTracks', |
|
908 |
'click .add-media-source' : 'addSource' |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
909 |
}, AttachmentDisplay.prototype.events ); |
5 | 910 |
}, |
911 |
||
912 |
prepare: function() { |
|
913 |
return _.defaults({ |
|
914 |
model: this.model.toJSON() |
|
915 |
}, this.options ); |
|
916 |
}, |
|
917 |
||
918 |
/** |
|
919 |
* Remove a setting's UI when the model unsets it |
|
920 |
* |
|
921 |
* @fires wp.media.view.MediaDetails#media:setting:remove |
|
922 |
* |
|
923 |
* @param {Event} e |
|
924 |
*/ |
|
925 |
removeSetting : function(e) { |
|
926 |
var wrap = $( e.currentTarget ).parent(), setting; |
|
927 |
setting = wrap.find( 'input' ).data( 'setting' ); |
|
928 |
||
929 |
if ( setting ) { |
|
930 |
this.model.unset( setting ); |
|
931 |
this.trigger( 'media:setting:remove', this ); |
|
932 |
} |
|
933 |
||
934 |
wrap.remove(); |
|
935 |
}, |
|
936 |
||
937 |
/** |
|
938 |
* |
|
939 |
* @fires wp.media.view.MediaDetails#media:setting:remove |
|
940 |
*/ |
|
941 |
setTracks : function() { |
|
942 |
var tracks = ''; |
|
943 |
||
944 |
_.each( this.$('.content-track'), function(track) { |
|
945 |
tracks += $( track ).val(); |
|
946 |
} ); |
|
947 |
||
948 |
this.model.set( 'content', tracks ); |
|
949 |
this.trigger( 'media:setting:remove', this ); |
|
950 |
}, |
|
951 |
||
952 |
addSource : function( e ) { |
|
953 |
this.controller.lastMime = $( e.currentTarget ).data( 'mime' ); |
|
954 |
this.controller.setState( 'add-' + this.controller.defaults.id + '-source' ); |
|
955 |
}, |
|
956 |
||
957 |
loadPlayer: function () { |
|
958 |
this.players.push( new MediaElementPlayer( this.media, this.settings ) ); |
|
959 |
this.scriptXhr = false; |
|
960 |
}, |
|
961 |
||
962 |
setPlayer : function() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
963 |
var src; |
5 | 964 |
|
965 |
if ( this.players.length || ! this.media || this.scriptXhr ) { |
|
966 |
return; |
|
967 |
} |
|
968 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
969 |
src = this.model.get( 'src' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
970 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
971 |
if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Vimeo' in window ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
972 |
this.scriptXhr = $.getScript( 'https://player.vimeo.com/api/player.js', _.bind( this.loadPlayer, this ) ); |
5 | 973 |
} else { |
974 |
this.loadPlayer(); |
|
975 |
} |
|
976 |
}, |
|
977 |
||
978 |
/** |
|
979 |
* @abstract |
|
980 |
*/ |
|
981 |
setMedia : function() { |
|
982 |
return this; |
|
983 |
}, |
|
984 |
||
985 |
success : function(mejs) { |
|
986 |
var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; |
|
987 |
||
988 |
if ( 'flash' === mejs.pluginType && autoplay ) { |
|
989 |
mejs.addEventListener( 'canplay', function() { |
|
990 |
mejs.play(); |
|
991 |
}, false ); |
|
992 |
} |
|
993 |
||
994 |
this.mejs = mejs; |
|
995 |
}, |
|
996 |
||
997 |
/** |
|
16 | 998 |
* @return {media.view.MediaDetails} Returns itself to allow chaining. |
5 | 999 |
*/ |
1000 |
render: function() { |
|
1001 |
AttachmentDisplay.prototype.render.apply( this, arguments ); |
|
1002 |
||
1003 |
setTimeout( _.bind( function() { |
|
16 | 1004 |
this.scrollToTop(); |
5 | 1005 |
}, this ), 10 ); |
1006 |
||
1007 |
this.settings = _.defaults( { |
|
1008 |
success : this.success |
|
1009 |
}, wp.media.mixin.mejsSettings ); |
|
1010 |
||
1011 |
return this.setMedia(); |
|
1012 |
}, |
|
1013 |
||
16 | 1014 |
scrollToTop: function() { |
5 | 1015 |
this.$( '.embed-media-settings' ).scrollTop( 0 ); |
1016 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1017 |
},/** @lends wp.media.view.MediaDetails */{ |
5 | 1018 |
instances : 0, |
1019 |
/** |
|
1020 |
* When multiple players in the DOM contain the same src, things get weird. |
|
1021 |
* |
|
1022 |
* @param {HTMLElement} elem |
|
16 | 1023 |
* @return {HTMLElement} |
5 | 1024 |
*/ |
1025 |
prepareSrc : function( elem ) { |
|
1026 |
var i = MediaDetails.instances++; |
|
1027 |
_.each( $( elem ).find( 'source' ), function( source ) { |
|
1028 |
source.src = [ |
|
1029 |
source.src, |
|
1030 |
source.src.indexOf('?') > -1 ? '&' : '?', |
|
1031 |
'_=', |
|
1032 |
i |
|
1033 |
].join(''); |
|
1034 |
} ); |
|
1035 |
||
1036 |
return elem; |
|
1037 |
} |
|
1038 |
}); |
|
1039 |
||
1040 |
module.exports = MediaDetails; |
|
1041 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1042 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1043 |
/***/ }), |
9 | 1044 |
/* 9 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1045 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1046 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1047 |
var MediaDetails = wp.media.view.MediaDetails, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1048 |
AudioDetails; |
5 | 1049 |
|
1050 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1051 |
* wp.media.view.AudioDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1052 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1053 |
* @memberOf wp.media.view |
5 | 1054 |
* |
1055 |
* @class |
|
1056 |
* @augments wp.media.view.MediaDetails |
|
1057 |
* @augments wp.media.view.Settings.AttachmentDisplay |
|
1058 |
* @augments wp.media.view.Settings |
|
1059 |
* @augments wp.media.View |
|
1060 |
* @augments wp.Backbone.View |
|
1061 |
* @augments Backbone.View |
|
1062 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1063 |
AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototype */{ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1064 |
className: 'audio-details', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1065 |
template: wp.template('audio-details'), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1066 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1067 |
setMedia: function() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1068 |
var audio = this.$('.wp-audio-shortcode'); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1069 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1070 |
if ( audio.find( 'source' ).length ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1071 |
if ( audio.is(':hidden') ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1072 |
audio.show(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1073 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1074 |
this.media = MediaDetails.prepareSrc( audio.get(0) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1075 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1076 |
audio.hide(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1077 |
this.media = false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1078 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1079 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1080 |
return this; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1081 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1082 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1083 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1084 |
module.exports = AudioDetails; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1085 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1086 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1087 |
/***/ }), |
9 | 1088 |
/* 10 */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1089 |
/***/ (function(module, exports) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1090 |
|
5 | 1091 |
var MediaDetails = wp.media.view.MediaDetails, |
1092 |
VideoDetails; |
|
1093 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1094 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1095 |
* wp.media.view.VideoDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1096 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1097 |
* @memberOf wp.media.view |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1098 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1099 |
* @class |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1100 |
* @augments wp.media.view.MediaDetails |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1101 |
* @augments wp.media.view.Settings.AttachmentDisplay |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1102 |
* @augments wp.media.view.Settings |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1103 |
* @augments wp.media.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1104 |
* @augments wp.Backbone.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1105 |
* @augments Backbone.View |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1106 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1107 |
VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototype */{ |
5 | 1108 |
className: 'video-details', |
1109 |
template: wp.template('video-details'), |
|
1110 |
||
1111 |
setMedia: function() { |
|
1112 |
var video = this.$('.wp-video-shortcode'); |
|
1113 |
||
1114 |
if ( video.find( 'source' ).length ) { |
|
1115 |
if ( video.is(':hidden') ) { |
|
1116 |
video.show(); |
|
1117 |
} |
|
1118 |
||
1119 |
if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { |
|
1120 |
this.media = MediaDetails.prepareSrc( video.get(0) ); |
|
1121 |
} else { |
|
1122 |
this.media = video.get(0); |
|
1123 |
} |
|
1124 |
} else { |
|
1125 |
video.hide(); |
|
1126 |
this.media = false; |
|
1127 |
} |
|
1128 |
||
1129 |
return this; |
|
1130 |
} |
|
1131 |
}); |
|
1132 |
||
1133 |
module.exports = VideoDetails; |
|
1134 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1135 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1136 |
/***/ }) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1137 |
/******/ ]); |