Révision 2b3c8cc1
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/media/js/plugins/media.views.js | ||
---|---|---|
80 | 80 |
// Reset the list of selected files |
81 | 81 |
Drupal.media.browser.selectMedia([]); |
82 | 82 |
|
83 |
// Catch double click to submit a single item. |
|
84 |
$('.view-content .media-item', view).bind('dblclick', function () { |
|
85 |
var fid = $(this).closest('.media-item[data-fid]').data('fid'), |
|
86 |
selectedFiles = new Array(); |
|
87 |
|
|
88 |
// Remove all currently selected files |
|
89 |
$('.view-content .media-item', view).removeClass('selected'); |
|
90 |
|
|
91 |
// Mark it as selected |
|
92 |
$(this).addClass('selected'); |
|
93 |
|
|
94 |
// Because the files are added using drupal_add_js() and due to the fact |
|
95 |
// that drupal_get_js() runs a drupal_array_merge_deep() which re-numbers |
|
96 |
// numeric key values, we have to search in Drupal.settings.media.files |
|
97 |
// for the matching file ID rather than referencing it directly. |
|
98 |
for (index in Drupal.settings.media.files) { |
|
99 |
if (Drupal.settings.media.files[index].fid == fid) { |
|
100 |
selectedFiles.push(Drupal.settings.media.files[index]); |
|
101 |
|
|
102 |
// If multiple tabs contains the same file, it will be present in the |
|
103 |
// files-array multiple times, so we break out early so we don't have |
|
104 |
// it in the selectedFiles array multiple times. |
|
105 |
// This would interfer with multi-selection, so... |
|
106 |
break; |
|
107 |
} |
|
108 |
} |
|
109 |
Drupal.media.browser.selectMediaAndSubmit(selectedFiles); |
|
110 |
}); |
|
111 |
|
|
112 |
|
|
83 | 113 |
// Catch the click on a media item |
84 | 114 |
$('.view-content .media-item', view).bind('click', function () { |
85 | 115 |
var fid = $(this).closest('.media-item[data-fid]').data('fid'), |
Formats disponibles : Unified diff
Weekly update of contrib modules