X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmisc%2Factive-link.es6.js;fp=web%2Fcore%2Fmisc%2Factive-link.es6.js;h=fd95376020d3212ae28863ec6a1c54ad0fa0fdc8;hp=425e4f1c98c3cf082dcddaca2b1670d545ab5a7f;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/misc/active-link.es6.js b/web/core/misc/active-link.es6.js index 425e4f1c9..fd9537602 100644 --- a/web/core/misc/active-link.es6.js +++ b/web/core/misc/active-link.es6.js @@ -3,7 +3,7 @@ * Attaches behaviors for Drupal's active link marking. */ -(function (Drupal, drupalSettings) { +(function(Drupal, drupalSettings) { /** * Append is-active class. * @@ -23,8 +23,12 @@ // Start by finding all potentially active links. const path = drupalSettings.path; const queryString = JSON.stringify(path.currentQuery); - const querySelector = path.currentQuery ? `[data-drupal-link-query='${queryString}']` : ':not([data-drupal-link-query])'; - const originalSelectors = [`[data-drupal-link-system-path="${path.currentPath}"]`]; + const querySelector = path.currentQuery + ? `[data-drupal-link-query='${queryString}']` + : ':not([data-drupal-link-query])'; + const originalSelectors = [ + `[data-drupal-link-system-path="${path.currentPath}"]`, + ]; let selectors; // If this is the front page, we have to check for the path as @@ -38,7 +42,9 @@ // Links without any hreflang attributes (most of them). originalSelectors.map(selector => `${selector}:not([hreflang])`), // Links with hreflang equals to the current language. - originalSelectors.map(selector => `${selector}[hreflang="${path.currentLanguage}"]`), + originalSelectors.map( + selector => `${selector}[hreflang="${path.currentLanguage}"]`, + ), ); // Add query string selector for pagers, exposed filters. @@ -53,7 +59,9 @@ }, detach(context, settings, trigger) { if (trigger === 'unload') { - const activeLinks = context.querySelectorAll('[data-drupal-link-system-path].is-active'); + const activeLinks = context.querySelectorAll( + '[data-drupal-link-system-path].is-active', + ); const il = activeLinks.length; for (let i = 0; i < il; i++) { activeLinks[i].classList.remove('is-active'); @@ -61,4 +69,4 @@ } }, }; -}(Drupal, drupalSettings)); +})(Drupal, drupalSettings);