Chris@0: /** Chris@0: * DO NOT EDIT THIS FILE. Chris@0: * See the following change record for more information, Chris@0: * https://www.drupal.org/node/2815083 Chris@0: * @preserve Chris@0: **/ Chris@0: Chris@0: (function ($, Drupal, debounce) { Chris@0: Drupal.behaviors.blockFilterByText = { Chris@0: attach: function attach(context, settings) { Chris@0: var $input = $('input.block-filter-text').once('block-filter-text'); Chris@0: var $table = $($input.attr('data-element')); Chris@14: var $filterRows = void 0; Chris@0: Chris@0: function filterBlockList(e) { Chris@0: var query = $(e.target).val().toLowerCase(); Chris@0: Chris@0: function toggleBlockEntry(index, label) { Chris@0: var $label = $(label); Chris@0: var $row = $label.parent().parent(); Chris@0: var textMatch = $label.text().toLowerCase().indexOf(query) !== -1; Chris@0: $row.toggle(textMatch); Chris@0: } Chris@0: Chris@0: if (query.length >= 2) { Chris@14: $filterRows.each(toggleBlockEntry); Chris@0: Drupal.announce(Drupal.formatPlural($table.find('tr:visible').length - 1, '1 block is available in the modified list.', '@count blocks are available in the modified list.')); Chris@0: } else { Chris@14: $filterRows.each(function (index) { Chris@0: $(this).parent().parent().show(); Chris@0: }); Chris@0: } Chris@0: } Chris@0: Chris@0: if ($table.length) { Chris@14: $filterRows = $table.find('div.block-filter-text-source'); Chris@0: $input.on('keyup', debounce(filterBlockList, 200)); Chris@0: } Chris@0: } Chris@0: }; Chris@0: Chris@0: Drupal.behaviors.blockHighlightPlacement = { Chris@0: attach: function attach(context, settings) { Chris@17: if (settings.blockPlacement && $('.js-block-placed').length) { Chris@0: $(context).find('[data-drupal-selector="edit-blocks"]').once('block-highlight').each(function () { Chris@0: var $container = $(this); Chris@0: Chris@0: $('html, body').animate({ Chris@0: scrollTop: $('.js-block-placed').offset().top - $container.offset().top + $container.scrollTop() Chris@0: }, 500); Chris@0: }); Chris@0: } Chris@0: } Chris@0: }; Chris@0: })(jQuery, Drupal, Drupal.debounce);