You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
965 B

(function () {
if (window.__miradorSpaceFixInitialized) return;
window.__miradorSpaceFixInitialized = true;
const observer = new MutationObserver((mutations) => {
const elements = document.querySelectorAll(
".mirador-third-party-html:not([data-fixed])"
);
elements.forEach((el) => {
// Create a TreeWalker to find all text nodes inside this container
const walker = document.createTreeWalker(
el,
NodeFilter.SHOW_TEXT,
null,
false
);
let node;
while ((node = walker.nextNode())) {
// Replace both non-breaking space characters and entity text if present
if (node.nodeValue) {
node.nodeValue = node.nodeValue
.replace(/\u00A0/g, " ")
.replace(/ /g, " ");
}
}
el.setAttribute("data-fixed", "true");
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
})();