diff --git a/core/modules/filter/filter.admin.js b/core/modules/filter/filter.admin.js index 8010671..8665d2d 100644 --- a/core/modules/filter/filter.admin.js +++ b/core/modules/filter/filter.admin.js @@ -3,7 +3,7 @@ * Attaches administration-specific behavior for the Filter module. */ -(function ($) { +(function ($, Drupal, drupalSettings) { 'use strict'; @@ -21,15 +21,15 @@ $context.find('#filters-status-wrapper input.form-checkbox').once('filter-status').each(function () { var $checkbox = $(this); // Retrieve the tabledrag row belonging to this filter. - var $row = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-weight')).closest('tr'); + $row = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-weight')).closest('tr'), // Retrieve the vertical tab belonging to this filter. - var $filterSettings = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-settings')); - var filterSettingsTab = $filterSettings.data('verticalTab'); + $filterSettings = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-settings')), + filterSettingsTab = $filterSettings.data('verticalTab'); // Bind click handler to this checkbox to conditionally show and hide // the filter's tableDrag row and vertical tab pane. $checkbox.on('click.filterUpdate', function () { - if ($checkbox.is(':checked')) { + if ($checkbox.prop('checked')) { $row.show(); if (filterSettingsTab) { filterSettingsTab.tabShow().updateSummary(); @@ -56,14 +56,14 @@ // Attach summary for configurable filters (only for screen readers). if (filterSettingsTab) { filterSettingsTab.details.drupalSetSummary(function (tabContext) { - return $checkbox.is(':checked') ? Drupal.t('Enabled') : Drupal.t('Disabled'); + return $checkbox.prop('checked') ? Drupal.t('Enabled') : Drupal.t('Disabled'); }); } // Trigger our bound click handler to update elements to initial state. - $checkbox.triggerHandler('click.filterUpdate'); + $checkbox.trigger('click.filterUpdate'); }); } }; -})(jQuery); +})(jQuery, Drupal, drupalSettings); diff --git a/core/modules/filter/filter.js b/core/modules/filter/filter.js index 2455b7f..4be429c 100644 --- a/core/modules/filter/filter.js +++ b/core/modules/filter/filter.js @@ -3,7 +3,7 @@ * Attaches behavior for the Filter module. */ -(function ($) { +(function ($, Drupal, drupalSettings) { 'use strict'; @@ -16,18 +16,18 @@ * Attaches behavior for updating filter guidelines. */ Drupal.behaviors.filterGuidelines = { - attach: function (context) { + attach: function (context, settings) { function updateFilterGuidelines(event) { - var $this = $(event.target); - var value = $this.val(); + var $this = $(event.target), + value = $this.val(); $this.closest('.filter-wrapper') .find('.filter-guidelines-item').hide() .filter('.filter-guidelines-' + value).show(); } - $(context).find('.filter-guidelines').once('filter-guidelines') - .find(':header').hide() + $('.filter-guidelines').once('filterGuidelines') + .find('h1, h2, h3, h4, h5, h6').hide() .closest('.filter-wrapper').find('select.filter-list') .on('change.filterGuidelines', updateFilterGuidelines) // Need to trigger the namespaced event to avoid triggering formUpdated @@ -36,4 +36,4 @@ } }; -})(jQuery); +})(jQuery, Drupal, drupalSettings);