
| Current Path : /var/www/html1/testsite/web/core/modules/media_library/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/testsite/web/core/modules/media_library/js/media_library.widget.js |
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, Sortable) {
Drupal.behaviors.MediaLibraryWidgetSortable = {
attach: function attach(context) {
var selection = context.querySelectorAll('.js-media-library-selection');
selection.forEach(function (widget) {
Sortable.create(widget, {
draggable: '.js-media-library-item',
handle: '.js-media-library-item-preview',
onEnd: function onEnd() {
$(widget).children().each(function (index, child) {
$(child).find('.js-media-library-item-weight').val(index);
});
}
});
});
}
};
Drupal.behaviors.MediaLibraryWidgetToggleWeight = {
attach: function attach(context) {
var strings = {
show: Drupal.t('Show media item weights'),
hide: Drupal.t('Hide media item weights')
};
$('.js-media-library-widget-toggle-weight', context).once('media-library-toggle').on('click', function (e) {
e.preventDefault();
$(e.currentTarget).toggleClass('active').text($(e.currentTarget).hasClass('active') ? strings.hide : strings.show).closest('.js-media-library-widget').find('.js-media-library-item-weight').parent().toggle();
}).text(strings.show);
$('.js-media-library-item-weight', context).once('media-library-toggle').parent().hide();
}
};
Drupal.behaviors.MediaLibraryWidgetDisableButton = {
attach: function attach(context) {
$('.js-media-library-open-button[data-disabled-focus="true"]', context).once('media-library-disable').each(function () {
var _this = this;
$(this).focus();
setTimeout(function () {
$(_this).attr('disabled', 'disabled');
}, 50);
});
}
};
})(jQuery, Drupal, Sortable);