Mercurial > hg > isophonics-drupal-site
view core/modules/media_library/js/media_library.widget.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
line wrap: on
line source
/** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (function ($, Drupal) { Drupal.behaviors.MediaLibraryWidgetSortable = { attach: function attach(context) { $('.js-media-library-selection', context).once('media-library-sortable').sortable({ tolerance: 'pointer', helper: 'clone', handle: '.js-media-library-item-preview', stop: function stop(_ref) { var target = _ref.target; $(target).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).parent().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);