2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, Drupal, debounce) {
9 Drupal.behaviors.blockFilterByText = {
10 attach: function attach(context, settings) {
11 var $input = $('input.block-filter-text').once('block-filter-text');
12 var $table = $($input.attr('data-element'));
13 var $filterRows = void 0;
15 function filterBlockList(e) {
16 var query = $(e.target).val().toLowerCase();
18 function toggleBlockEntry(index, label) {
19 var $label = $(label);
20 var $row = $label.parent().parent();
21 var textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
22 $row.toggle(textMatch);
25 if (query.length >= 2) {
26 $filterRows.each(toggleBlockEntry);
27 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.'));
29 $filterRows.each(function (index) {
30 $(this).parent().parent().show();
36 $filterRows = $table.find('div.block-filter-text-source');
37 $input.on('keyup', debounce(filterBlockList, 200));
42 Drupal.behaviors.blockHighlightPlacement = {
43 attach: function attach(context, settings) {
44 if (settings.blockPlacement && $('.js-block-placed').length) {
45 $(context).find('[data-drupal-selector="edit-blocks"]').once('block-highlight').each(function () {
46 var $container = $(this);
48 $('html, body').animate({
49 scrollTop: $('.js-block-placed').offset().top - $container.offset().top + $container.scrollTop()
55 })(jQuery, Drupal, Drupal.debounce);