* Block admin behaviors.
*/
-(function ($, Drupal, debounce) {
+(function($, Drupal, debounce) {
/**
* Filters the block list by a text input search string.
*
* The jQuery event for the keyup event that triggered the filter.
*/
function filterBlockList(e) {
- const query = $(e.target).val().toLowerCase();
+ const query = $(e.target)
+ .val()
+ .toLowerCase();
/**
* Shows or hides the block entry based on the query.
function toggleBlockEntry(index, label) {
const $label = $(label);
const $row = $label.parent().parent();
- const textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
+ const textMatch =
+ $label
+ .text()
+ .toLowerCase()
+ .indexOf(query) !== -1;
$row.toggle(textMatch);
}
'@count blocks are available in the modified list.',
),
);
- }
- else {
- $filterRows.each(function (index) {
- $(this).parent().parent().show();
+ } else {
+ $filterRows.each(function(index) {
+ $(this)
+ .parent()
+ .parent()
+ .show();
});
}
}
Drupal.behaviors.blockHighlightPlacement = {
attach(context, settings) {
if (settings.blockPlacement) {
- $(context).find('[data-drupal-selector="edit-blocks"]').once('block-highlight').each(function () {
- const $container = $(this);
- // Just scrolling the document.body will not work in Firefox. The html
- // element is needed as well.
- $('html, body').animate({
- scrollTop: ($('.js-block-placed').offset().top - $container.offset().top) + $container.scrollTop(),
- }, 500);
- });
+ $(context)
+ .find('[data-drupal-selector="edit-blocks"]')
+ .once('block-highlight')
+ .each(function() {
+ const $container = $(this);
+ // Just scrolling the document.body will not work in Firefox. The html
+ // element is needed as well.
+ $('html, body').animate(
+ {
+ scrollTop:
+ $('.js-block-placed').offset().top -
+ $container.offset().top +
+ $container.scrollTop(),
+ },
+ 500,
+ );
+ });
}
},
};
-}(jQuery, Drupal, Drupal.debounce));
+})(jQuery, Drupal, Drupal.debounce);