Mercurial > hg > isophonics-drupal-site
comparison core/modules/block/js/block.admin.js @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
8 (function ($, Drupal, debounce) { | 8 (function ($, Drupal, debounce) { |
9 Drupal.behaviors.blockFilterByText = { | 9 Drupal.behaviors.blockFilterByText = { |
10 attach: function attach(context, settings) { | 10 attach: function attach(context, settings) { |
11 var $input = $('input.block-filter-text').once('block-filter-text'); | 11 var $input = $('input.block-filter-text').once('block-filter-text'); |
12 var $table = $($input.attr('data-element')); | 12 var $table = $($input.attr('data-element')); |
13 var $filter_rows = void 0; | 13 var $filterRows = void 0; |
14 | 14 |
15 function filterBlockList(e) { | 15 function filterBlockList(e) { |
16 var query = $(e.target).val().toLowerCase(); | 16 var query = $(e.target).val().toLowerCase(); |
17 | 17 |
18 function toggleBlockEntry(index, label) { | 18 function toggleBlockEntry(index, label) { |
21 var textMatch = $label.text().toLowerCase().indexOf(query) !== -1; | 21 var textMatch = $label.text().toLowerCase().indexOf(query) !== -1; |
22 $row.toggle(textMatch); | 22 $row.toggle(textMatch); |
23 } | 23 } |
24 | 24 |
25 if (query.length >= 2) { | 25 if (query.length >= 2) { |
26 $filter_rows.each(toggleBlockEntry); | 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.')); | 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.')); |
28 } else { | 28 } else { |
29 $filter_rows.each(function (index) { | 29 $filterRows.each(function (index) { |
30 $(this).parent().parent().show(); | 30 $(this).parent().parent().show(); |
31 }); | 31 }); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 if ($table.length) { | 35 if ($table.length) { |
36 $filter_rows = $table.find('div.block-filter-text-source'); | 36 $filterRows = $table.find('div.block-filter-text-source'); |
37 $input.on('keyup', debounce(filterBlockList, 200)); | 37 $input.on('keyup', debounce(filterBlockList, 200)); |
38 } | 38 } |
39 } | 39 } |
40 }; | 40 }; |
41 | 41 |