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