...
Step 1: Copy the Entire Code Snippet
Code Block |
---|
breakoutMode | wide |
---|
language | js |
---|
|
<script>
$(document).ready(function() {
var siteDomain = "thisisatestsiteonly.com";
if (window.location && window.location.href && window.location.href.includes(siteDomain)) {
var languageReplacementMap = {
" TEXT-NEEDING-CHANGE ": " DESIRED-TEXT ",
" TEXT-NEEDING-CHANGE ": " DESIRED-TEXT "
}
setInterval(function() {
try {
for (var str in languageReplacementMap) {
var ccNode, ccWalker = document.createTreeWalker(document, NodeFilter.SHOW_TEXT, null, false);
while (ccNode = ccWalker.nextNode()) {
var parentTagName = ccNode && ccNode.parentElement && ccNode.parentElement.nodeName;
if ((parentTagName === "DIV" || parentTagName === "SPAN") && parentTagName !== "SCRIPT") {
ccNode.textContent = ccNode.textContent.replaceAll(str, languageReplacementMap[str]);
}
}
}
} catch(error) {}
}, 100);
}
});
</script> |
If that script is not successful then this is an alternative:
Code Block |
---|
breakoutMode | wide |
---|
language | js |
---|
|
<!-- language script to support div,span,select -->
<script>
$(document).ready(function() {
var siteDomain = "thisisatestsiteonly.com";
if (window.location && window.location.href && window.location.href.includes(siteDomain)) {
var languageReplacementMap = {
"TEXT-NEEDING-CHANGE": "DESIRED-TEXT",
"TEXT-NEEDING-CHANGE": "DESIRED-TEXT",
"TEXT-NEEDING-CHANGE": "DESIRED-TEXT"
}
setInterval(function() {
try {
for (var str in languageReplacementMap) {
var ccNode, ccWalker = document.createTreeWalker(document, NodeFilter.SHOW_TEXT, null, false);
while (ccNode = ccWalker.nextNode()) {
var parentTagName = ccNode && ccNode.parentElement && ccNode.parentElement.nodeName;
if (["DIV", "SPAN", "OPTION"].includes(parentTagName) && parentTagName !== "SCRIPT") {
ccNode.textContent = ccNode.textContent.replaceAll(str, languageReplacementMap[str]);
}
}
}
} catch(error) {}
}, 100);
}
});
</script> |
...