2014-01-23 18:04:41 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2014-01-23 18:04:41 +00:00
|
|
|
|
|
|
|
(function (Drupal, drupalSettings) {
|
2014-01-27 21:41:32 +00:00
|
|
|
Drupal.behaviors.activeLinks = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
var path = drupalSettings.path;
|
|
|
|
var queryString = JSON.stringify(path.currentQuery);
|
2020-01-30 09:08:38 +00:00
|
|
|
var querySelector = path.currentQuery ? "[data-drupal-link-query='".concat(queryString, "']") : ':not([data-drupal-link-query])';
|
|
|
|
var originalSelectors = ["[data-drupal-link-system-path=\"".concat(path.currentPath, "\"]")];
|
|
|
|
var selectors;
|
2014-01-27 21:41:32 +00:00
|
|
|
|
|
|
|
if (path.isFront) {
|
|
|
|
originalSelectors.push('[data-drupal-link-system-path="<front>"]');
|
|
|
|
}
|
2014-01-23 18:04:41 +00:00
|
|
|
|
2017-05-19 22:12:53 +00:00
|
|
|
selectors = [].concat(originalSelectors.map(function (selector) {
|
2020-01-30 09:08:38 +00:00
|
|
|
return "".concat(selector, ":not([hreflang])");
|
2017-05-19 22:12:53 +00:00
|
|
|
}), originalSelectors.map(function (selector) {
|
2020-01-30 09:08:38 +00:00
|
|
|
return "".concat(selector, "[hreflang=\"").concat(path.currentLanguage, "\"]");
|
2017-05-19 22:12:53 +00:00
|
|
|
}));
|
|
|
|
selectors = selectors.map(function (current) {
|
|
|
|
return current + querySelector;
|
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
var activeLinks = context.querySelectorAll(selectors.join(','));
|
2015-04-19 15:30:43 +00:00
|
|
|
var il = activeLinks.length;
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2015-04-19 15:30:43 +00:00
|
|
|
for (var i = 0; i < il; i++) {
|
Issue #2031641 by aburrows, lauriii, nlisgo, Pol, redsquid, tuutti, LewisNyman, akalata, agviu, kallehauge, _nolocation, rpayanm, saki007ster, mdrummond, RavindraSingh, brahmjeet789: Change active class to is-active
2015-04-16 14:25:55 +00:00
|
|
|
activeLinks[i].classList.add('is-active');
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
},
|
2017-05-19 22:12:53 +00:00
|
|
|
detach: function detach(context, settings, trigger) {
|
2014-01-27 21:41:32 +00:00
|
|
|
if (trigger === 'unload') {
|
Issue #2031641 by aburrows, lauriii, nlisgo, Pol, redsquid, tuutti, LewisNyman, akalata, agviu, kallehauge, _nolocation, rpayanm, saki007ster, mdrummond, RavindraSingh, brahmjeet789: Change active class to is-active
2015-04-16 14:25:55 +00:00
|
|
|
var activeLinks = context.querySelectorAll('[data-drupal-link-system-path].is-active');
|
2015-04-19 15:30:43 +00:00
|
|
|
var il = activeLinks.length;
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2015-04-19 15:30:43 +00:00
|
|
|
for (var i = 0; i < il; i++) {
|
Issue #2031641 by aburrows, lauriii, nlisgo, Pol, redsquid, tuutti, LewisNyman, akalata, agviu, kallehauge, _nolocation, rpayanm, saki007ster, mdrummond, RavindraSingh, brahmjeet789: Change active class to is-active
2015-04-16 14:25:55 +00:00
|
|
|
activeLinks[i].classList.remove('is-active');
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2014-01-23 18:04:41 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-27 21:41:32 +00:00
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
})(Drupal, drupalSettings);
|