Révision fc3d89c3
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/media/js/media.js | ||
---|---|---|
91 | 91 |
return; |
92 | 92 |
} |
93 | 93 |
|
94 |
// Grab the first of the selected media files. |
|
95 |
var mediaFile = mediaFiles[0]; |
|
94 |
var mediaFileValue; |
|
95 |
// Process the value based on multiselect. |
|
96 |
if (mediaFiles.length > 1) { |
|
97 |
// Reverse array to have files in correct order |
|
98 |
mediaFiles.reverse(); |
|
99 |
// Concatenate the array into a comma separated string. |
|
100 |
mediaFileValue = mediaFiles.map(function(file) { |
|
101 |
return file.fid; |
|
102 |
}).join(','); |
|
103 |
} |
|
104 |
else { |
|
105 |
// Grab the first of the selected media files. |
|
106 |
mediaFileValue = mediaFiles[0].fid; |
|
107 |
|
|
108 |
// Display a preview of the file using the selected media file's display. |
|
109 |
previewField.html(mediaFileValue.preview); |
|
110 |
} |
|
96 | 111 |
|
97 | 112 |
// Set the value of the hidden file ID field and trigger a change. |
98 |
uploadField.val(mediaFile.fid);
|
|
113 |
uploadField.val(mediaFileValue);
|
|
99 | 114 |
uploadField.trigger('change'); |
100 | 115 |
|
101 | 116 |
// Find the attach button and automatically trigger it. |
102 | 117 |
var attachButton = uploadField.siblings('.attach'); |
103 | 118 |
attachButton.trigger('mousedown'); |
104 |
|
|
105 |
// Display a preview of the file using the selected media file's display. |
|
106 |
previewField.html(mediaFile.preview); |
|
107 | 119 |
}, configuration); |
108 | 120 |
|
109 | 121 |
return false; |
Formats disponibles : Unified diff
Weekly update of contrib modules