Replace the word "district" site wide, including ADA statement
place into "Site-wide custom HTML before </body>"
The code currently changes District ---> department
So just change the "department" to whatever you need
<script>
(function () {
// What we’re replacing
const replacements = [
{ regex: /\bdistrict\b/g, replacement: 'department' },
{ regex: /\bDistrict\b/g, replacement: 'Department' }
];
function replaceTextInDocument(doc) {
if (!doc || !doc.body) return;
const walker = doc.createTreeWalker(
doc.body,
NodeFilter.SHOW_TEXT,
{
acceptNode(node) {
// Skip empty / whitespace-only nodes to avoid extra work
if (!node.nodeValue || !node.nodeValue.trim()) {
return NodeFilter.FILTER_REJECT;
}
return NodeFilter.FILTER_ACCEPT;
}
}
);
let node;
while ((node = walker.nextNode())) {
let text = node.nodeValue;
let newText = text;
replacements.forEach(({ regex, replacement }) => {
newText = newText.replace(regex, replacement);
});
if (newText !== text) {
node.nodeValue = newText;
}
}
}
function processIframes(doc) {
const iframes = doc.getElementsByTagName('iframe');
Array.from(iframes).forEach((iframe) => {
function handleIframe() {
try {
const idoc = iframe.contentDocument || iframe.contentWindow.document;
replaceTextInDocument(idoc);
} catch (e) {
// Likely a cross-origin iframe (YouTube, Maps, etc.) – we can’t touch it.
}
}
// If it's already loaded
try {
if (iframe.contentDocument && iframe.contentDocument.readyState === 'complete') {
handleIframe();
} else {
iframe.addEventListener('load', handleIframe);
}
} catch (e) {
// Ignore cross-origin access errors
}
});
}
function run(doc) {
replaceTextInDocument(doc);
processIframes(doc);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () {
run(document);
});
} else {
run(document);
}
})();
</script>