views_ui.listing.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. (function ($, Drupal) {
  8. Drupal.behaviors.viewTableFilterByText = {
  9. attach: function attach(context, settings) {
  10. var $input = $('input.views-filter-text').once('views-filter-text');
  11. var $table = $($input.attr('data-table'));
  12. var $rows = void 0;
  13. function filterViewList(e) {
  14. var query = $(e.target).val().toLowerCase();
  15. function showViewRow(index, row) {
  16. var $row = $(row);
  17. var $sources = $row.find('[data-drupal-selector="views-table-filter-text-source"]');
  18. var textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
  19. $row.closest('tr').toggle(textMatch);
  20. }
  21. if (query.length >= 2) {
  22. $rows.each(showViewRow);
  23. } else {
  24. $rows.show();
  25. }
  26. }
  27. if ($table.length) {
  28. $rows = $table.find('tbody tr');
  29. $input.on('keyup', filterViewList);
  30. }
  31. }
  32. };
  33. })(jQuery, Drupal);