Skip to content

Commit

Permalink
Merge branch 'shs-5963-fe-performance-refactor-theme-javascript' of g…
Browse files Browse the repository at this point in the history
…ithub.com:SU-HSDO/suhumsci into shs-5963-fe-performance-refactor-theme-javascript
  • Loading branch information
cienvaras committed Nov 27, 2024
2 parents edf990e + e3c1552 commit f9c4a0b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
/* global ed11yLang, ed11yOnce */
window.editoria11yOptionsOverride = true;
window.editoria11yOptions = (options) => {
// Change the default button text for the Heading Outline tab.
if (ed11yLang && ed11yLang.en) {
ed11yLang.en.buttonOutlineContent = 'Heading Outline';
}
return options;
};
(function (Drupal) {
Drupal.behaviors.editoria11yOptionsOverride = {
// eslint-disable-next-line no-unused-vars
attach(context) {
/* global ed11yLang, ed11yOnce */
window.editoria11yOptionsOverride = true;
window.editoria11yOptions = (options) => {
// Change the default button text for the Heading Outline tab.
if (ed11yLang && ed11yLang.en) {
ed11yLang.en.buttonOutlineContent = 'Heading Outline';
}
return options;
};

window.addEventListener('load', () => {
// If the editoria11y is not loaded, we don't need to do anything.
if (typeof ed11yOnce === 'undefined' || !ed11yOnce) {
return;
}
window.addEventListener('load', () => {
// If the editoria11y is not loaded, we don't need to do anything.
if (typeof ed11yOnce === 'undefined' || !ed11yOnce) {
return;
}

// Editoria11y element is added to the DOM after the load event, we need to
// observe the body element for changes.
const observer = new MutationObserver((mutationList) => {
mutationList.forEach((mutation) => {
if (mutation.addedNodes.length && mutation.addedNodes[0].nodeName === 'ED11Y-ELEMENT-PANEL') {
// Once we get the element, we update the styles to make the alert button text black.
const { shadowRoot } = mutation.addedNodes[0];
if (shadowRoot) {
const style = document.createElement('style');
style.textContent = `
// Editoria11y element is added to the DOM after the load event, we need to
// observe the body element for changes.
const observer = new MutationObserver((mutationList) => {
mutationList.forEach((mutation) => {
if (mutation.addedNodes.length && mutation.addedNodes[0].nodeName === 'ED11Y-ELEMENT-PANEL') {
// Once we get the element, we update the styles to make the alert button text black.
const { shadowRoot } = mutation.addedNodes[0];
if (shadowRoot) {
const style = document.createElement('style');
style.textContent = `
.ed11y-shut.ed11y-errors #ed11y-toggle {
color: #000000;
}
`;
shadowRoot.appendChild(style);
}
}
});
});
observer.observe(document.body, {
childList: true,
});
});
shadowRoot.appendChild(style);
}
}
});
});
observer.observe(document.body, {
childList: true,
});
});
},
};
}(Drupal));
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ const equalHeightGrid = (elements) => {
// Create array with all of the heights of each element
const elementHeights = Array.prototype.map.call(elements, (el) => el.scrollHeight);

// Create array with _unique_ height values
// const uniqueHeights = elementHeights.filter((height, index, array) => {
// return array.indexOf(height) == index;
// });

return new Promise((resolve) => {
const maxHeight = Math.max.apply(null, elementHeights);
const tallestElementIndex = elementHeights.indexOf(maxHeight);
Expand Down

0 comments on commit f9c4a0b

Please sign in to comment.