1 |
ca0757b9
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
(function ($) {
|
9 |
|
|
namespace('Drupal.media.formatForm');
|
10 |
|
|
|
11 |
|
|
Drupal.media.mediaFormatSelected = {};
|
12 |
|
|
|
13 |
|
|
Drupal.behaviors.mediaFormatForm = {
|
14 |
|
|
attach: function (context, settings) {
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
$('#media-wysiwyg-format-form').once('format', function() {
|
28 |
|
|
$('<a class="button fake-ok">' + Drupal.t('Submit') + '</a>').appendTo($('#media-wysiwyg-format-form')).bind('click', Drupal.media.formatForm.submit);
|
29 |
|
|
});
|
30 |
|
|
}
|
31 |
|
|
};
|
32 |
|
|
|
33 |
|
|
Drupal.media.formatForm.getOptions = function () {
|
34 |
|
|
|
35 |
|
|
var ret = {};
|
36 |
|
|
|
37 |
|
|
$.each($('#media-wysiwyg-format-form .fieldset-wrapper *').serializeArray(), function (i, field) {
|
38 |
|
|
ret[field.name] = field.value;
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
if (field.name.match(/\[format\]/i)) {
|
42 |
|
|
field.name = field.name.replace(/\[format\]/i, '[value]');
|
43 |
|
|
field.key = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, '');
|
44 |
|
|
|
45 |
2b3c8cc1
|
Assos Assos
|
if (Drupal.wysiwyg && Drupal.wysiwyg.instances[field.key]) {
|
46 |
ca0757b9
|
Assos Assos
|
|
47 |
|
|
ret[field.name] = Drupal.wysiwyg.instances[field.key].getContent();
|
48 |
|
|
|
49 |
2b3c8cc1
|
Assos Assos
|
|
50 |
|
|
ret[field.name] = encodeURIComponent(ret[field.name]);
|
51 |
ca0757b9
|
Assos Assos
|
}
|
52 |
|
|
}
|
53 |
|
|
});
|
54 |
|
|
|
55 |
|
|
return ret;
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
Drupal.media.formatForm.getFormattedMedia = function () {
|
59 |
|
|
var formatType = $("#edit-format").val();
|
60 |
|
|
return { type: formatType, options: Drupal.media.formatForm.getOptions(), html: Drupal.settings.media.formatFormFormats[formatType] };
|
61 |
|
|
};
|
62 |
|
|
|
63 |
|
|
Drupal.media.formatForm.submit = function () {
|
64 |
|
|
|
65 |
|
|
var buttons = $(parent.window.document.body).find('#mediaStyleSelector').parent('.ui-dialog').find('.ui-dialog-buttonpane button');
|
66 |
|
|
buttons[0].click();
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
})(jQuery); |