Move all files to 2017/
This commit is contained in:
parent
ac7370f67f
commit
2875863330
15717 changed files with 0 additions and 0 deletions
47
2017/web/core/misc/active-link.js
Normal file
47
2017/web/core/misc/active-link.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function (Drupal, drupalSettings) {
|
||||
Drupal.behaviors.activeLinks = {
|
||||
attach: function attach(context) {
|
||||
var path = drupalSettings.path;
|
||||
var queryString = JSON.stringify(path.currentQuery);
|
||||
var querySelector = path.currentQuery ? '[data-drupal-link-query=\'' + queryString + '\']' : ':not([data-drupal-link-query])';
|
||||
var originalSelectors = ['[data-drupal-link-system-path="' + path.currentPath + '"]'];
|
||||
var selectors = void 0;
|
||||
|
||||
if (path.isFront) {
|
||||
originalSelectors.push('[data-drupal-link-system-path="<front>"]');
|
||||
}
|
||||
|
||||
selectors = [].concat(originalSelectors.map(function (selector) {
|
||||
return selector + ':not([hreflang])';
|
||||
}), originalSelectors.map(function (selector) {
|
||||
return selector + '[hreflang="' + path.currentLanguage + '"]';
|
||||
}));
|
||||
|
||||
selectors = selectors.map(function (current) {
|
||||
return current + querySelector;
|
||||
});
|
||||
|
||||
var activeLinks = context.querySelectorAll(selectors.join(','));
|
||||
var il = activeLinks.length;
|
||||
for (var i = 0; i < il; i++) {
|
||||
activeLinks[i].classList.add('is-active');
|
||||
}
|
||||
},
|
||||
detach: function detach(context, settings, trigger) {
|
||||
if (trigger === 'unload') {
|
||||
var activeLinks = context.querySelectorAll('[data-drupal-link-system-path].is-active');
|
||||
var il = activeLinks.length;
|
||||
for (var i = 0; i < il; i++) {
|
||||
activeLinks[i].classList.remove('is-active');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})(Drupal, drupalSettings);
|
Reference in a new issue