diff --git a/core/modules/filter/filter.admin.js b/core/modules/filter/filter.admin.js index 959442a..872c990 100644 --- a/core/modules/filter/filter.admin.js +++ b/core/modules/filter/filter.admin.js @@ -3,25 +3,24 @@ * Attaches administration-specific behavior for the Filter module. */ -(function ($) { +(function ($, Drupal, drupalSettings) { "use strict"; Drupal.behaviors.filterStatus = { attach: function (context, settings) { - var $context = $(context); - $context.find('#filters-status-wrapper input.form-checkbox').once('filter-status', function () { - var $checkbox = $(this); + $(context).find('#filters-status-wrapper input.form-checkbox').once('filterStatus', 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(); @@ -48,14 +47,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 38797e5..d003b00 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"; @@ -11,18 +11,18 @@ * Displays the guidelines of the selected text format automatically. */ 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 @@ -31,4 +31,4 @@ } }; -})(jQuery); +})(jQuery, Drupal, drupalSettings);