Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / js / system.modules.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
8 (function ($, Drupal, debounce) {
9   Drupal.behaviors.tableFilterByText = {
10     attach: function attach(context, settings) {
11       var $input = $('input.table-filter-text').once('table-filter-text');
12       var $table = $($input.attr('data-table'));
13       var $rowsAndDetails = void 0;
14       var $rows = void 0;
15       var $details = void 0;
16       var searching = false;
17
18       function hidePackageDetails(index, element) {
19         var $packDetails = $(element);
20         var $visibleRows = $packDetails.find('tbody tr:visible');
21         $packDetails.toggle($visibleRows.length > 0);
22       }
23
24       function filterModuleList(e) {
25         var query = $(e.target).val();
26
27         var re = new RegExp('\\b' + query, 'i');
28
29         function showModuleRow(index, row) {
30           var $row = $(row);
31           var $sources = $row.find('.table-filter-text-source, .module-name, .module-description');
32           var textMatch = $sources.text().search(re) !== -1;
33           $row.closest('tr').toggle(textMatch);
34         }
35
36         $rowsAndDetails.show();
37
38         if (query.length >= 2) {
39           searching = true;
40           $rows.each(showModuleRow);
41
42           $details.not('[open]').attr('data-drupal-system-state', 'forced-open');
43
44           $details.attr('open', true).each(hidePackageDetails);
45
46           Drupal.announce(Drupal.t('!modules modules are available in the modified list.', {
47             '!modules': $rowsAndDetails.find('tbody tr:visible').length
48           }));
49         } else if (searching) {
50           searching = false;
51           $rowsAndDetails.show();
52
53           $details.filter('[data-drupal-system-state="forced-open"]').removeAttr('data-drupal-system-state').attr('open', false);
54         }
55       }
56
57       function preventEnterKey(event) {
58         if (event.which === 13) {
59           event.preventDefault();
60           event.stopPropagation();
61         }
62       }
63
64       if ($table.length) {
65         $rowsAndDetails = $table.find('tr, details');
66         $rows = $table.find('tbody tr');
67         $details = $rowsAndDetails.filter('.package-listing');
68
69         $input.on({
70           keyup: debounce(filterModuleList, 200),
71           keydown: preventEnterKey
72         });
73       }
74     }
75   };
76 })(jQuery, Drupal, Drupal.debounce);